# SPEI

## Submit a payout by SPEI in Mexico

<mark style="color:green;">`POST`</mark> `https://sandbox.transfersmile.com/api/payout`

This endpoint allows you to submit a payout by SPEI in Mexico.

#### Headers

| Name                                            | Type   | Description                         |
| ----------------------------------------------- | ------ | ----------------------------------- |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; charset=UTF-8     |
| AppId<mark style="color:red;">\*</mark>         | string | Your App ID in payout platform      |
| Authorization<mark style="color:red;">\*</mark> | string | SHA256($sorted\_params + $app\_key) |

#### Request Body

| Name                                                 | Type   | Description                                                                                                                                                                                                        |
| ---------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| name<mark style="color:red;">\*</mark>               | string | beneficiary's name, length must between 5 and 40                                                                                                                                                                   |
| phone                                                | string | <p>beneficiary's phone</p><p>- Max 15, valid phone -</p>                                                                                                                                                           |
| email                                                | string | <p>beneficiary 's email<br>- Max 64, valid email -</p>                                                                                                                                                             |
| bank\_code<mark style="color:red;">\*</mark>         | number | <p>bank code, see <a href="/pages/-Mhw9IU7UCOkOod1aBGs"><em><strong>bank list</strong></em></a></p><p><em><strong>-</strong></em> Required when account\_type is <strong>not</strong> <strong>clabe</strong> -</p> |
| account<mark style="color:red;">\*</mark>            | number | <p>account</p><p>- 10 \~ 18 digits -</p>                                                                                                                                                                           |
| account\_type<mark style="color:red;">\*</mark>      | string | one of \[debit \| phone \| clabe]                                                                                                                                                                                  |
| document\_id<mark style="color:red;">\*</mark>       | string | beneficiary document id                                                                                                                                                                                            |
| document\_type<mark style="color:red;">\*</mark>     | string | one of \[RFC \| CURP ]                                                                                                                                                                                             |
| method<mark style="color:red;">\*</mark>             | string | payout method, e.g. SPEI                                                                                                                                                                                           |
| custom\_code<mark style="color:red;">\*</mark>       | string | merchant payout id                                                                                                                                                                                                 |
| fee\_bear<mark style="color:red;">\*</mark>          | string | <p>All fees charge to merchant or beneficiary<br>- One of: merchant, beneficiary -</p>                                                                                                                             |
| amount<mark style="color:red;">\*</mark>             | number | <p>Payout Amount, 2 decimal numbers</p><p>- Min 0.01, Max 400,000 - </p>                                                                                                                                           |
| source\_currency<mark style="color:red;">\*</mark>   | string | <p>Merchant Account Currency<br>One of: USD, EUR, GBP, MXN </p>                                                                                                                                                    |
| arrival\_currency<mark style="color:red;">\*</mark>  | string | MXN for Mexico                                                                                                                                                                                                     |
| notify\_url<mark style="color:red;">\*</mark>        | string | Where pagsmile will callback to                                                                                                                                                                                    |
| additional\_remark<mark style="color:red;">\*</mark> | string | <p>Additional Remark<br>- Max Length: 40 - </p>                                                                                                                                                                    |
| country<mark style="color:red;">\*</mark>            | string | MEX for Mexico                                                                                                                                                                                                     |

{% tabs %}
{% tab title="200: OK submit successfully." %}

```
{
    "code": 200,
    "msg": "success",
    "time": 1628580845,
    "data": {
        "id": "S202108100734054iRiUZFPXfQM",
        "custom_code": "custom_code9982674851738108",
        "arrival_amount": "0.51",
        "arrival_currency": "MXN",
        "source_amount": "0.07",
        "source_currency": "USD",
        "status": "IN_PROCESSING"
    }
}
```

{% endtab %}

{% tab title="400: Bad Request order already existed." %}

```
{
    "code": 4001020,
    "msg": "order already existed",
    "time": 1628580940,
    "data": {}
}
```

{% endtab %}

{% tab title="401: Unauthorized unauthorized" %}

```javascript
{
    "code": 4004003,
    "msg": "permission denied",
    "time": 1637224716,
    "data": {
        ... ...
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error fee not configured" %}

```javascript
{
    "code": 5001003,
    "msg": "fee not configured",
    "time": 1637224716,
    "data": {
        ... ...
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error balance insufficient" %}

```javascript
{
    "code": 5001102,
    "msg": "balance insufficient",
    "time": 1637224716,
    "data": {
        ... ...
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error system error" %}

```javascript
{
    "code": 5001000,
    "msg": "system error",
    "time": 1637224716,
    "data": {
        ... ...
    }
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://sandbox.transfersmile.com/api/payout' \
--header 'AppId: 94FAC**********************68548' \
--header 'Authorization: d6181db0d6548b94b162e75d095b59147172d914699f83b2bd17951a671b6302' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "name" : "GUILHERME ****** SOUZA",
      "phone" : "468****068",
      "email" : "g******me@gmail.com",
    * "bank_code" : "40002",
    * "account" : "002010077777777771",
    * "account_type" : "clabe",
    * "document_id" : "CUP800****691",
    * "document_type" : "RFC",
    * "method" : "SPEI", // fixed value: SPEI
    * "custom_code" : "custom_code9982674851738108", // merchant order id
    * "fee_bear" : "merchant",
    * "amount" : "0.51",
    * "source_currency" : "MXN",
    * "arrival_currency" : "MXN", // fixed value: MXN
    * "notify_url" : "https://notify.url",
    * "additional_remark" : "pagsmile payout test remark",
    * "country" : "MEX" // fixed value: MEX
}'
```

{% hint style="info" %}
Note:  ***94FAC\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*68548*** is Pagsmile's test App ID for sandbox, and ***d6181db0d6548b94b162e75d095b59147172d914699f83b2bd17951a671b6302*** is authorization token associated with the test App ID.
{% endhint %}

{% hint style="success" %}
In **sandbox** environment, please use *<mark style="color:green;">**002010077777777771**</mark>* as  <mark style="color:blue;">**SPEI**</mark> account for testing **PAID** payout,  and the account *<mark style="color:red;">**014027000005555558**</mark>* for testing **FAILED** payout.
{% endhint %}

## Example of SPEI account <a href="#example-of-spei-account" id="example-of-spei-account"></a>

| Account Type | Account            |           |
| ------------ | ------------------ | --------- |
| clabe        | 112233445566778899 | 18 digits |
| debit        | 1122334455667788   | 16 digits |
| phone        | 5522123456         | 10 digits |

{% tabs %}
{% tab title="Mexico document type" %}
Mexican taxpayers could get RFC.&#x20;

RFCs are 13 digits long for individuals, 12 for companies, and they’re made up of letters and numbers. The first 4 digits for individuals, or 3 for companies, are taken from the name, then there are six numbers denoting the date of birth or when the business was founded, and the end digits are check digits.

Mexican citizen or resident could get CURP.

It’s an 18-digit social security number for people living in Mexico. The 18 characters combine information deriving from your name, date and place of birth, and gender to create a unique code.

{% endtab %}

{% tab title="Mexico bank account" %}
The first three digits of the bank account should be the last three digits of the bank code.&#x20;

<pre><code>"bank_code":"90<a data-footnote-ref href="#user-content-fn-1">646</a>",
"account":"<a data-footnote-ref href="#user-content-fn-1">646</a>18**********1800"
</code></pre>

{% endtab %}
{% endtabs %}

[^1]:


---

# 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.pagsmile.com/payout/submit-a-payout/mexico/spei.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.
