# Pix

## Submit a payout by PIX in Brazil.

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

This endpoint allows you to submit a payout by PIX in Brazil.

#### Headers

| Name                                            | Type   | Description                         |
| ----------------------------------------------- | ------ | ----------------------------------- |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=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

<table><thead><tr><th width="173">Name</th><th width="136">Type</th><th>Description</th></tr></thead><tbody><tr><td>name<mark style="color:red;">*</mark></td><td>string</td><td><p>Beneficiary's name<br>- Length between 5 and 100 -</p><ul><li><strong>When <code>document_id = CPF</code></strong><br>The <code>name</code> field <strong>only supports English alphabet characters</strong> (<code>A–Z</code>, <code>a–z</code>) and spaces.</li><li><p><strong>When <code>document_id = CNPJ</code></strong><br>The <code>name</code> field supports:</p><ul><li>English alphabet characters (<code>A–Z</code>, <code>a–z</code>)</li><li>Numbers (<code>0–9</code>)</li><li>Dot (<code>.</code>)</li><li>Hyphen (<code>-</code>)</li><li>Spaces</li></ul></li></ul></td></tr><tr><td>phone</td><td>string</td><td><p>Beneficiary's phone</p><p>- Max 15, valid phone - </p></td></tr><tr><td>email</td><td>string</td><td>Beneficiary's email<br>- Max 64, valid email -</td></tr><tr><td>document_id<mark style="color:red;">*</mark></td><td>string</td><td>Beneficiary's personal identification number</td></tr><tr><td>account<mark style="color:red;">*</mark></td><td>string</td><td>Beneficiary's PIX account</td></tr><tr><td>account_type<mark style="color:red;">*</mark></td><td>string</td><td>Beneficiary's PIX account type<br>- One of: CPF, CNPJ, EVP, PHONE, EMAIL -</td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: PIX</td></tr><tr><td>custom_code<mark style="color:red;">*</mark></td><td>string</td><td>Merchant Payout ID<br>- Max. 50 chars - </td></tr><tr><td>fee_bear<mark style="color:red;">*</mark></td><td>string</td><td>Processing fee charges to merchant or beneficiary.<br>- One of: merchant beneficiary -</td></tr><tr><td>amount<mark style="color:red;">*</mark></td><td>number</td><td><p>Payout Amount, 2 decimal numbers</p><p>- Min 0.01, Max 15,000 -  </p></td></tr><tr><td>source_currency<mark style="color:red;">*</mark></td><td>string</td><td>Merchant Account Currency<br>- One of: USD, EUR, GBP, BRL -</td></tr><tr><td>arrival_currency<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: BRL </td></tr><tr><td>notify_url<mark style="color:red;">*</mark></td><td>string</td><td>Where pagsmile will send notification to.</td></tr><tr><td>additional_remark<mark style="color:red;">*</mark></td><td>string</td><td>Descriptor on the user's bank bill<br>- Max length: 40 -</td></tr><tr><td>country<mark style="color:red;">*</mark></td><td>string</td><td>BRA for Brazil</td></tr><tr><td>document_type<mark style="color:red;">*</mark></td><td>string</td><td><p>Beneficiary's personal identification type</p><p>- One of: CPF, CNPJ -</p></td></tr><tr><td>amount_type</td><td>String</td><td>Specify the amount value is fixed for merchant or beneficiary<br>- One of: source_amount, arrival_amount(default) -</td></tr></tbody></table>

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

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

{% endtab %}

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

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

{% endtab %}

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

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

{% endtab %}

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

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

{% endtab %}

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

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

{% endtab %}

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

```javascript
{
    "code": 5001003,
    "msg": "fee not configured",
    "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": "",
      "email": "payout@pagsmile.com",
    * "amount": 150,
    * "arrival_currency": "BRL", // fixed value: BRL
    * "custom_code" : "custom_code_your_order_id",
    * "document_id": "22*******99",
    * "document_type": "CPF",
    * "fee_bear": "merchant",
    * "method": "PIX",   // fixed value: PIX
    * "notify_url": "https://notify.url",
    * "account": "22*******99",
    * "account_type": "CPF",  // should be one of CPF CNPJ PHONE EMAIL EVP
    * "source_currency": "BRL", 
    * "additional_remark": "pagsmile payout test remark",
    * "country": "BRA" // fixed value: BRA
}'
```

{% 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 %}

## Example of Document

| Document Type | Document ID              | Description |
| ------------- | ------------------------ | ----------- |
| CPF           | 22\*\*\*\*\*\*\*99       | 11 digits   |
| CNPJ          | 23\*\*\*\*\*\*\*\*\*\*31 | 14 digits   |

## Third-party CPF/CNPJ Validator

* <mark style="color:blue;">**Go:**</mark> [<mark style="color:blue;">https://github.com/paemuri/brdoc</mark>](https://github.com/paemuri/brdoc)
* <mark style="color:blue;">**JavaScript:**</mark> <https://www.npmjs.com/package/cpf-cnpj-validator>
* <mark style="color:blue;">**Online:**</mark> [<mark style="color:blue;">https://4app.net/tools/validator/document/cpf\_validator</mark>](https://4app.net/tools/validator/document/cpf_validator)

## Example of PIX account

<table><thead><tr><th width="249.33333333333331">Account Type</th><th>Account</th><th>Description</th></tr></thead><tbody><tr><td>CPF</td><td>22*******99</td><td>11 digits</td></tr><tr><td>CNPJ</td><td>23**********31</td><td>14 digits</td></tr><tr><td>Phone</td><td>+5511987654321<br>or<br>11987654321</td><td>country code (+55) is optional</td></tr><tr><td>Email</td><td>merchant@pagsmile.com</td><td></td></tr><tr><td>EVP</td><td>A UUID-like string: a1073db4-a3a0-11ed-a8fc-0242ac120002</td><td>alphanumeric string of 32 digits that is sent from the central bank to the institution</td></tr></tbody></table>
