# Mexico

## Required fields

| Field                  | Format                                                                                                                               | Description                                                                                     |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
| `login`                | String                                                                                                                               | Cashouts login                                                                                  |
| `pass`                 | String                                                                                                                               | Cashouts pass                                                                                   |
| `external_id`          | String (max length: 100)                                                                                                             | Transaction's ID on your end                                                                    |
| `document_id`          | See [document validations](/specifications/countries-specifications.md#documents-validations)                                        | Beneficiary's document ID                                                                       |
| `country`              | `MX`                                                                                                                                 | See [country codes](/specifications/countries-specifications.md#countries-and-currencies)       |
| `currency`             | `MXN` / `USD`                                                                                                                        | See [currency codes](/specifications/countries-specifications.md#countries-and-currencies)      |
| `amount`               | Number with up to 2 decimals                                                                                                         | Cashout amount                                                                                  |
| `bank_code`            | See [bank codes](/api-documentation/cashouts-api/countries-validations/american-countries/mexico.md#bank-codes)                      | Code specifying the beneficiary's bank. **Only mandatory if the bank\_account is a debit card** |
| `bank_account`         | See [validations below](/api-documentation/cashouts-api/countries-validations/american-countries/mexico.md#bank-account-validations) | Beneficiary's bank account                                                                      |
| `beneficiary_name`     | String (max length: 100)                                                                                                             | Beneficiary's name                                                                              |
| `beneficiary_lastname` | String (max length: 100)                                                                                                             | Beneficiary's last name                                                                         |

## Bank Account Validations

| Bank name                               | Bank code | Format                                                                                                                                                                                                                                                                                                                       | Example            |
| --------------------------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| All                                     |     -     | [CLABE](https://en.wikipedia.org/wiki/CLABE): 18 digits long, applies verifier algorithm.                                                                                                                                                                                                                                    | 021790064060296642 |
| All                                     |     -     | [DEBIT CARD](/api-documentation/cashouts-api/endpoints/cashout-creation-endpoint.md#cashouts-to-debit-cards): 15-16 digits long, applies verifier algorithm. Can only be sent through [the Cashout to Debit Cards Endpoint](/api-documentation/cashouts-api/endpoints/cashout-creation-endpoint.md#cashouts-to-debit-cards). | 5344867217683750   |
| Todit&#x6F;*(\*to be implemented soon)* |   10000   | 10 digits long.                                                                                                                                                                                                                                                                                                              | 2682883311         |

### CLABE validation algorithm

[Click here](https://en.wikipedia.org/wiki/CLABE) for more information about CLABE format.

Since the first three digits of the CLABE are the bank code, it is not mandatory to send the `bank_code` field.

{% tabs %}
{% tab title="Java" %}
{% code title="Mexico CLABE validation algorithm in Java" %}

```java
public final class Validations {
    static int CLABE_LENGTH = 18;
    
    private static boolean validateClabeLength(String bankAcount) {
        return bankAcount.length() == CLABE_LENGTH;
    }
    
    private static boolean validateClabe(String clabe) {
        if (!validateClabeLength(clabe)) {
            return false;
        } else {
            int sum = 0;
            String clabeWithoutCd = clabe.substring(0, 17);
            Integer[] array = new Integer[]{3, 7, 1};
    
            int checkDigitToVerify;
            for(checkDigitToVerify = 0; checkDigitToVerify < clabeWithoutCd.length(); ++checkDigitToVerify) {
                int digit = clabeWithoutCd.charAt(checkDigitToVerify);
                sum += digit * array[checkDigitToVerify % 3] % 10;
            }
    
            checkDigitToVerify = (10 - sum % 10) % 10;
            int checkDigit = Integer.parseInt(clabe.substring(17));
            return checkDigitToVerify == checkDigit;
        }
    }
}


```

{% endcode %}
{% endtab %}
{% endtabs %}

## Document Validations

[Click here](/specifications/countries-specifications.md#documents-validations) to check document types and validations.

## Example Request

```java
{
    "login": "xxxxxxxx",
    "pass": "xxxxxxxx",
    "external_id": "30000000001",
    "country": "MX",
    "currency": "MXN",
    "amount": 100,
    "document_id": "848392783",
    "bank_account": "021790064060296642",
    "beneficiary_name": "User",
    "beneficiary_lastname": "Test",
    "notification_url": "https://webhook.site/url",
    "type": "json"
}
```

## Bank codes

{% hint style="info" %}
Notice that the bank\_code for Mexico is only mandatory if the bank\_account length is between 15 and 16 (Debit Card). In that case, [use the Credit Cards endpoint: https://cc-api-stg.directa24.com/v3/cashout](/api-documentation/cashouts-api/endpoints/cashout-creation-endpoint.md#cashouts-to-debit-cards)
{% endhint %}

| Bank                                | Code  |
| ----------------------------------- | ----- |
| BANAMEX                             | 002   |
| BANCOMEXT                           | 006   |
| BANOBRAS                            | 009   |
| BBVA BANCOMER                       | 012   |
| SANTANDER                           | 014   |
| BANJERCITO                          | 019   |
| HSBC                                | 021   |
| BAJIO                               | 030   |
| IXE                                 | 032   |
| INBURSA                             | 036   |
| INTERACCIONES                       | 037   |
| MIFEL                               | 042   |
| SCOTIABANK                          | 044   |
| BANREGIO                            | 058   |
| INVEX                               | 059   |
| BANSI                               | 060   |
| AFIRME                              | 062   |
| BANORTE                             | 072   |
| THE ROYAL BANK                      | 102   |
| AMERICAN EXPRESS                    | 103   |
| BAMSA                               | 106   |
| TOKYO                               | 108   |
| JP MORGAN                           | 110   |
| BMONEX                              | 112   |
| VE POR MAS                          | 113   |
| ING                                 | 116   |
| DEUTSCHE                            | 124   |
| CREDIT SUISSE                       | 126   |
| AZTECA                              | 127   |
| AUTOFIN                             | 128   |
| BARCLAYS                            | 129   |
| COMPARTAMOS                         | 130   |
| BANCO FAMSA                         | 131   |
| BMULTIVA                            | 132   |
| ACTINVER                            | 133   |
| WALMART                             | 134   |
| NAFIN                               | 135   |
| INTERBANCO                          | 136   |
| BANCOPPEL                           | 137   |
| ABC CAPITAL                         | 138   |
| UBS BANK                            | 139   |
| CONSUBANCO                          | 140   |
| VOLKSWAGEN                          | 141   |
| CIBANCO                             | 143   |
| BBASE                               | 145   |
| BANSEFI                             | 166   |
| HIPOTECARIA FEDERAL                 | 168   |
| MONEXCB                             | 600   |
| GBM                                 | 601   |
| MASARI                              | 602   |
| VALUE                               | 605   |
| ESTRUCTURADORES                     | 606   |
| TIBER                               | 607   |
| VECTOR                              | 608   |
| B\&B                                | 610   |
| MERRILL LYNCH                       | 615   |
| FINAMEX                             | 616   |
| VALMEX                              | 617   |
| UNICA                               | 618   |
| MAPFRE                              | 619   |
| PROFUTURO                           | 620   |
| CB ACTINVER                         | 621   |
| OACTIN                              | 622   |
| SKANDIA VIDA                        | 623   |
| CBDEUTSCHE                          | 626   |
| ZURICH                              | 627   |
| ZURICHVI                            | 628   |
| SU CASITA                           | 629   |
| CB INTERCAM                         | 630   |
| CI BOLSA                            | 631   |
| BULLTICK CB                         | 632   |
| STERLING                            | 633   |
| FINCOMUN                            | 634   |
| HDI SEGUROS                         | 636   |
| ORDER                               | 637   |
| AKALA                               | 638   |
| CB JPMORGAN                         | 640   |
| REFORMA                             | 642   |
| STP                                 | 646   |
| TELECOMM                            | 647   |
| EVERCORE                            | 648   |
| SKANDIA OPERADORA                   | 649   |
| SEGMTY                              | 651   |
| ASEA                                | 652   |
| KUSPIT                              | 653   |
| SOFIEXPRESS                         | 655   |
| UNAGRA                              | 656   |
| OPCIONES EMPRESARIALES DEL NOROESTE | 659   |
| LIBERTAD                            | 670   |
| CLS                                 | 901   |
| INDEVAL                             | 902   |
| Todito *(\*to be implemented soon)* | 10000 |

{% hint style="info" %}
For the full and most up-to-date list of banks and its codes, please check the [Cashout Bank Code endpoint.](/api-documentation/cashouts-api/endpoints/cashout-bank-codes.md)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pandablue.com/api-documentation/cashouts-api/countries-validations/american-countries/mexico.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
