# Checkout Page

## This endpoint allows you to request a checkout page.

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

#### Headers

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

#### Request Body

| Name                                                 | Type    | Description                                                           |
| ---------------------------------------------------- | ------- | --------------------------------------------------------------------- |
| user\_id<mark style="color:red;">\*</mark>           | String  | user id                                                               |
| custom\_code<mark style="color:red;">\*</mark>       | String  | merchant payout id                                                    |
| fee\_bear<mark style="color:red;">\*</mark>          | String  | one of \[beneficiary \| merchant]                                     |
| source\_currency<mark style="color:red;">\*</mark>   | String  | <p>Merchant Account Currency</p><p>- One of: USD, EUR, GBP, BRL -</p> |
| payout\_currency<mark style="color:red;">\*</mark>   | String  | <p>Payout/Arrival Currency</p><p>- One of: USD, BRL, MXN -</p>        |
| payout\_amount<mark style="color:red;">\*</mark>     | String  | Payout Amount, Numeric                                                |
| timeout                                              | Integer | default & max 1800 seconds                                            |
| notify\_url<mark style="color:red;">\*</mark>        | String  | Where pagsmile will send notification to.                             |
| return\_url<mark style="color:red;">\*</mark>        | String  | When a user completes the payout, where will return back to.          |
| additional\_remark<mark style="color:red;">\*</mark> | String  | <p>transaction description</p><p>- Length must less than 40 -</p>     |
| country                                              | String  | <p>BRA for Brazil</p><p>MEX for Mexico</p><p>GLOBAL for PayPal</p>    |
| method                                               | String  | <p>Payment Method</p><p>- e.g. PIX, SPEI, PayPal,BANKTRANSFER -</p>   |

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

```javascript
{
    "code": 200,
    "msg": "success",
    "time": 1639473556,
    "data": {
        "checkout_url": "https://sandbox-payout.pagsmile.com/?t=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMTAwMDEiLCJwYXlvdXRfaWQiOiJUUzIwMjExMjE0MDkxOTE2NHExNE4yVUhCVTVYQiIsImN1c3RvbV9jb2RlIjoiY2hlY2tvdXRfdGVzdF8xMDAwMDQiLCJmZWVfYmVhciI6Im1lcmNoYW50Iiwic291cmNlX2N1cnJlbmN5IjoiVVNEIiwicGF5b3V0X2N1cnJlbmN5IjoiVVNEIiwicGF5b3V0X2Ftb3VudCI6IjEwLjAxIiwibm90aWZ5X3VybCI6Imh0dHBzOi8vc2FuZGJveC50cmFuc2ZlcnNtaWxlLmNvbS9hcGkvbm90aWZ5L2RlbW8iLCJyZXR1cm5fdXJsIjoiaHR0cHM6Ly93d3cuYmFpZHUuY29tIiwiYWRkaXRpb25hbF9yZW1hcmsiOiJjaGVja291dCB0ZXN0IiwiY291bnRyeSI6IkJSQSIsInNlc3Npb25fdGltZW91dCI6MTgwMCwiY3JlYXRlZF9hdCI6MTYzOTQ3MzU1NiwiaXNzIjoiUGFnc21pbGUgLSBUcmFuc2ZlcnNtaWxlIiwiZXhwIjoxNjM5NDc1MzU2LCJqdGkiOiIzMiJ9.6Bmm2jrJUtlfWy9FrxPagsmilePayouttIwbhUx-OoCdU2aZMw"
    }
}
```

{% endtab %}

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

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

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "code": 4001000,
    "msg": "invalid parameter",
    "time": 1637224716,
    "data": {}
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Request Example

```
curl --location --request POST 'https://sandbox.transfersmile.com/api/checkout' \
--header 'AppId: 94FAC**********************68548' \
--header 'Authorization: d6181db0d6548b94b162e75d095b59147172d914699f83b2bd17951a671b6302' \
--header 'Content-Type: application/json' \
--data-raw '{
    "user_id": "10001",
    "custom_code": "my_checkout_test_10001",
    "source_currency": "USD",
    "payout_currency": "BRL",
    "fee_bear": "merchant",
    "payout_amount": "10.01",
    "notify_url": "https://sandbox.transfersmile.com/api/notify/demo",
    "return_url": "https://merchant.return.url",
    "additional_remark": "pagsmile checkout test",
    "country": "BRA"
}'   
```

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

## Checkout Logo

| Front End | Specification |
| --------- | ------------- |
| WEB       | 128px \* 64px |
| H5        | 42px \* 42px  |

## Supported Countries

| Country Code | Payment Method    | Source Currency | Payout Currency |
| ------------ | ----------------- | --------------- | --------------- |
| BRA(Brazil)  | PIX, Banktransfer | USD, BRL        | BRL             |
| MEX(Mexico)  | SPEI              | USD, MXN        | MXN             |
| GLOBAL       | PayPal            | USD             | USD             |

{% hint style="info" %}

{% endhint %}
