A payment method is the bank account that you (or your user) register so that funds can be withdrawn from them. To withdraw funds from the payment method, you will need to create a payment request.

Using Batch Imports?
If you're using our Batch Imports feature, we automatically create the payment method during the process.

# Payment Method Flow

When you create a payment method, it will go through the following flow to be either:

- `active`: The financial institution confirms the bank account details and you can retrieve funds from it.
- `error` : The financial institution could not confirm the bank account and you cannot retrieve funds from it.


# Create a payment method

You can create a payment method using either our:

- Dashboard
- API
- Batch Imports


Batch Imports and Payment Methods
If you're using our Batch Imports functionality, the Payment Method is created automatically. For more information, see our dedicated Bulk Import Direct Debit Payments article.

## Via the dashboard

To create a payment method using our dashboard:

1. In your Direct Debit dashboard:
  1. Go to **Payment Methods**.
  2. Click **Create**.
2. In the **Create Payment Method** pop-up;
  1. Select the **Customer** that this payment method relates to.
  2. Select the **Bank** where the customer's account is located.
  3. Select the **Account** type: **Savings** for a CLABE account, or **Debit Card** for a debit card number.
  4. Provide the account identifier: if you selected **Savings**, enter the customer's **CLABE**; if you selected **Debit Card**, enter the **debit card number**.
  5. Provide your internal **Reference** for this payment method.
  6. Click **Create**.



Success
You will now need to retrieve Consent from your user for the account to be debited. For more information, see our dedicated Consent article.

## Via the API

To create a payment method using our API, you just need to make a POST Create a payment method request with the following payload:


```json
{
  "customerId": "0d1a377b-b4c5-4a94-9e2e-83e59d1f6a9c",
  "accountType": "savings",
  "accountNumber": "445566790",
  "bank": "mx_bancoppel",
  "reference": "SAVINGS_445566790"
}
```

| Parameter | Type | Required | Description | Example |
|  --- | --- | --- | --- | --- |
| `customerId` | string (uuid) | Yes | The Belvo-generated ID for the customer. | `0d1a377b-b4c5-4a94-9e2e-83e59d1f6a9c` |
| `accountType` | string (enum) | Yes | The bank account or card type. Can be either `savings` (a CLABE account) or `debit_card` (a debit card number). | `savings` |
| `accountNumber` | string | Yes | The bank account or debit card number. For `savings`, provide the CLABE account number; for `debit_card`, provide the debit card number. | `"445566790"` |
| `bank` | string (enum) | Yes | The financial institution where the bank account is held. For a full list of available institutions, see our dedicated Institutions article. | `mx_bancoppel` |
| `reference` | string | Yes | Your internal reference for the payment method. | `SAVINGS_445566790` |


`checking` account type deprecated
The `checking` (also seen as `checkings`) value for `accountType` is deprecated and should no longer be used. Use `savings` for a CLABE account or `debit_card` for a debit card number.

Success
You will now need to retrieve Consent from your user for the account to be debited. For more information, see our dedicated Consent article.

# Payment Method Statuses

In the diagram below, we provide you with the statuses that a payment method can go through. If you have implemented webhooks, you'll receive a notification for the statuses, indicated in purple.


```mermaid
stateDiagram-v2
    classDef pending fill:#ADD8E6,color:#000,stroke:none
    classDef success fill:#2E8B57,color:#fff,stroke:none
    classDef failed fill:#CC3300,color:#fff,stroke:none
    classDef cancelled fill:#FFA500,color:#fff,stroke:none

    [*] --> pending_agreement_acceptance
    [*] --> active
    pending_agreement_acceptance --> pending_activation
    pending_agreement_acceptance --> active
    pending_agreement_acceptance --> [*] : If user does not accept agreement
    pending_activation --> waiting_for_activation_response
    waiting_for_activation_response --> active
    waiting_for_activation_response --> error
    active --> inactive : If bank account no longer active
    active --> [*]
    error --> [*]
    inactive --> [*]

    class pending_agreement_acceptance,pending_activation,waiting_for_activation_response pending
    class active success
    class error failed
    class inactive cancelled

    note right of active
        Webhook: payment_method_registration_successful
    end note
    note right of error
        Webhook: payment_method_registration_failed
    end note
    note right of inactive
        Webhook: payment_method_registration_canceled
    end note
```

## States

#### `initial`

Initial state when the payment method is created.

| Transitions to | Trigger/Event |
|  --- | --- |
| - `pending_agreement_acceptance`

 | - Payment method agreement sent to customer

 |


#### `pending_agreement_acceptance`

The payment method is pending confirmation by the customer. This can be done by sending an agreement generated by our Agreements API resource.

| Transitions to | Trigger/Event |
|  --- | --- |
| - `pending_activation`- `active`- End state - no further transitions

 | - Customer accepts payment method and is sent to financial institution for confirmation- (Optimized Partner) Payment method confirmed by bank- User does not accept agreement

 |


#### `pending_activation`

The payment method is scheduled to be sent to the financial institution to be confirmed.

| Transitions to | Trigger/Event |
|  --- | --- |
| - `pending_activation_response`

 | - The payment method is sent to the financial institution.

 |


#### `pending_activation_response`

The financial institution is evaluating the payment method.

| Transitions to | Trigger/Event |
|  --- | --- |
| - `active`- `error`

 | - Payment method confirmed by financial institution- Financial institution returns error (for example, bank account does not exist)

 |


#### `active`

The payment method is active and funds can be withdrawn.

**Note**: The status can change to `inactive` if the owner cancels or removes the payment method within their financial institution.

| Transitions to | Trigger/Event |
|  --- | --- |
| End state - no further transitions (see the note above regarding the `inactive` state. | - 
 |


#### `error`

The financial institution was not able to confirm the bank account registration (usually due to the owner providing incorrect bank account information or an error in the financial institution). The payment method cannot be used.

| Transitions to | Trigger/Event |
|  --- | --- |
| End state - no further transitions | - 
 |


#### `inactive`

The customer has canceled their bank account or removed their agreement for the payment method within their financial institution. The payment method cannot be used.

| Transitions to | Trigger/Event |
|  --- | --- |
| End state - no further transitions | - 
 |