# Introduction

Information

Pagsmile allows merchants to easily enter a new market through local payment methods. We cover different payment methods in the main Latin American countries. Receive international payments with no extra taxes.

Accepting payments worldwide with our Payin solution.

{% content-ref url="/pages/WPetNepnyP0IRBBbKyg3" %}
[Payin API](/reference/payin)
{% endcontent-ref %}

Or send funds to your customers with our Payout solution.

{% content-ref url="/pages/-Mgnp08LKXYlUajxFG63" %}
[Payout API](/reference/payout)
{% endcontent-ref %}

{% hint style="info" %}
This site is the API Reference of Pagsmile's most updated API.

Looking for the documentation of Pagsmile's past version API? Find it [here](https://developer.pagsmile.com/en/reference/).
{% endhint %}


# Payin API

This section covers technical details of the Payin API. It contains functional examples of the requests and important observations to be taken into account during integration.

{% hint style="success" %}

* All calls to the Payin API use HTTP POST Request.
* All calls to the Payin API should with JSON body parameters.
* All calls to the Payin API will return JSON responses, including errors.
  {% endhint %}

## Content

* [<mark style="color:orange;">**Environment**</mark>](/reference/payin/environments)
  * Sandbox environment vs Production.
* [<mark style="color:orange;">**Checkout Page**</mark>](/reference/payin/checkout-page)
  * How to create a checkout page.
* [<mark style="color:orange;">**Submit a payin**</mark>](/reference/payin/submit-a-payin)
  * How to submit a payin request.
* [<mark style="color:orange;">**Notification**</mark>](/reference/payin/notification)
  * Receiving a notification. When and how.
* [<mark style="color:orange;">**Recurring Payment**</mark>](/reference/payin/recurring-payment)
  * Credit card recurring payment
* [<mark style="color:orange;">**Pagsmile JavaScript**</mark>](broken://pages/J8aQL6RYWEos7Tm2AEXg)
  * Use JS to get token and fingerprint
* [<mark style="color:orange;">**Support Bank List Query**</mark>](/reference/payin/tools/supported-bank-list-query)
  * Get support bank list for Cash and Banktransfer payment
* [<mark style="color:orange;">**Payin Detail**</mark>](broken://pages/yzeW9I1csYiP0CeQvPOh)
  * Query the details of an order
* [<mark style="color:orange;">**Installment Detail Query**</mark>](/reference/payin/tools/installment-detail-query)
  * Query the installment detail of a credit card order
* [<mark style="color:orange;">**Refund**</mark>](/reference/payin/refund)
  * Submit refund request
* [<mark style="color:orange;">**Data**</mark>](/reference/payin/data)
  * Some usefully data like methods, test data, etc
* <mark style="color:orange;">**API Code**</mark>
  * Pagsmile Payin API Code


# Environments

### Sandbox

There is a test environment available for integration development and testing, which simulates most of the requests and transaction types available in the platform. You can use this environment to ensure your requests are handled accordingly.

The base URL for development is: <https://gateway-test.pagsmile.com>/

{% hint style="info" %}
***Please note that in the test environment, no transactions will actually be processed.***
{% endhint %}

### Production

After the testing phase is successful, you are ready to go live in the production environment.

The base URL for production is: <https://gateway.pagsmile.com>/


# All-In-One Checkout

How to use Pagsmile Checkoutpage to submit a payin.

## Payin by using Pagsmile checkout page

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by using Pagsmile checkout page

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                                                                                                                                                                            |
| ------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                                                                                                           |
| method                                            | string | Add this object to show only the selected method. For instance, “method”: “PIX” will only show the PIX method. To show all the methods do not add this object in the request body. Check [here](/reference/payin/data/payment-method) for all methods. |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                                                                                                   |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                                                                                                                                                                               |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                                                                                                        |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                                                                                                           |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>order amount<br>- 0.01 \~ 999999999 -</p><p>(refer to amount limit for different <a href="/reference/payin/data/payment-method">methods</a>)</p>                                                                                                    |
| order\_currency<mark style="color:red;">\*</mark> | string | <p>order currency<br>- Max. 3 chars -<br>Check <a href="/reference/payin/data/payment-method">here</a> for all methods.</p>                                                                                                                            |
| content<mark style="color:red;">\*</mark>         | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p>                                                                                                                                             |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                                                                                                                                                                     |
| channel                                           | string | only use when method = Wallet                                                                                                                                                                                                                          |
| trade\_type<mark style="color:red;">\*</mark>     | string | fixed value: WEB                                                                                                                                                                                                                                       |
| return\_url                                       | sring  | web redirect url when payment is finish                                                                                                                                                                                                                |
| timeout\_express                                  | string | <p>m(minutes), h(hours), d(days), c(always end in current day).</p><p>Used to control the expiration time of <strong>submitting</strong> an order (from initial to processing). (90m in default, max 15d)</p>                                          |
| cancellation\_express                             | string | <p>m(minutes), h(hours), d(days). The value must be an integer.</p><p>Used to cancel an order. Ex: 90m Used to control the expiration time of a processing order.</p>                                                                                  |
| regions                                           | array  | <p>regions of the payment. Required if using Global App. The format is ISO 3166-1 alpha-3<br>- ARG, BRA, etc. Check <a href="/reference/payin/data/country-code">here</a> -</p>                                                                        |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354003",
    "web_url": "http://checkout-testv2.pagsmile.com?prepay_id=123456",
    "prepay_id":"123456"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Options

All-In-One Checkout is for querying Pagsmile checkout page (payment wall) to present one or all available payment methods to users. It is the most sample way for integrating for all countries and methods of Pagsmile.

* [**General**](/reference/payin/checkout-page/general)
  * More detailed examples for querying Pagsmile checkout page for general merchants.
* [**E-Commerce**](/reference/payout/submit-a-payout/paypal)
  * More detailed examples for querying Pagsmile checkout page for E-com merchants.


# Checkout Page (General)

How to use Pagsmile Checkoutpage to submit a payin.

## Payin by using Pagsmile checkout page

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by using Pagsmile checkout page

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                                                                                                                                                                           |
| ------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                                                                                                          |
| method                                            | string | Add this object to show only the selected method. For instance, “method”: “PIX” will only show the PIX method. To show all the methods do not add this object in the request body. Check [here](/reference/payin/data/payment-method) for all methods |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                                                                                                  |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                                                                                                                                                                              |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                                                                                                       |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                                                                                                          |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>order amount<br>- 0.01 \~ 999999999 -</p><p>(refer to amount limit for different <a href="/reference/payin/data/payment-method">methods</a>)</p>                                                                                                   |
| order\_currency<mark style="color:red;">\*</mark> | string | <p>order currency<br>- Max. 3 chars -<br>Check <a href="/reference/payin/data/payment-method">here</a> for all methods.</p>                                                                                                                           |
| content<mark style="color:red;">\*</mark>         | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p>                                                                                                                                            |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                                                                                                                                                                    |
| channel                                           | string | only use when method = Wallet                                                                                                                                                                                                                         |
| trade\_type<mark style="color:red;">\*</mark>     | string | fixed value: WEB                                                                                                                                                                                                                                      |
| return\_url                                       | sring  | web redirect url when payment is finish                                                                                                                                                                                                               |
| timeout\_express                                  | string | <p>m(minutes), h(hours), d(days), c(always end in current day).</p><p>Used to control the expiration time of <strong>submitting</strong> an order (from initial to processing). (90m in default, max 15d)</p>                                         |
| customer.name                                     | string | <p>User's name</p><p>- Will be pre-filled on the checkout page -</p>                                                                                                                                                                                  |
| customer.phone                                    | string | <p>User's phone</p><p>- Will be pre-filled on the checkout page -</p>                                                                                                                                                                                 |
| customer.email                                    | string | <p>User's email</p><p>- Will be pre-filled on the checkout page -</p>                                                                                                                                                                                 |
| customer.identify.number                          | string | <p>User's identification number</p><p>- Will be pre-filled on the checkout page -</p>                                                                                                                                                                 |
| customer.identify.type                            | string | <p>User's identification type</p><p>- Will be pre-filled on the checkout page -</p>                                                                                                                                                                   |
| address.zip\_code                                 | string | <p>zip code</p><p>- Will be pre-filled on the checkout page -</p>                                                                                                                                                                                     |
| regions                                           | array  | <p>regions of the payment. Required if using Global App. The format is ISO 3166-1 alpha-3<br>- ARG, BRA, etc. Check <a href="/reference/payin/data/country-code">here</a> -</p>                                                                       |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354003",
    "web_url": "http://checkout-testv2.pagsmile.com?prepay_id=123456",
    "prepay_id":"123456"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Check [here](/reference/payin/data/payment-method) for supported methods.

* If not passing the parameter "method" or pass "method": "", all enabled methods will be shown to the user on the checkout page.
* If passing "method": "PIX", only PIX will be shown to the user on the checkout page.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
      "charset": "UTF-8",
    * "app_id": "162************38",
    * "out_trade_no": "202201010354002",
    * "order_currency": "BRL",
    * "order_amount": "12.01",
    * "subject": "item name",
    * "content": "item description",
    * "trade_type": "WEB",
      "timeout_express": "1d",
    * "timestamp": "2022-01-01 03:54:01",
    * "notify_url": "http://merchant/callback/success",
    * "buyer_id": "buyer_0101_0001",
      "customer": {
          "identify": {
              "type": "CPF",
              "number": "50284414727"
          },
      "name": "Test User Name",
      "email": "test@pagsmile.com"
      },
      "regions": ["BRA"], //Support multiple regions. For example "regions": ["BRA","COL","MEX"]
      "address": {
          "zip_code": "38082365"
      }
}'
```

{% hint style="danger" %}
Return*url is not required in the request parameters. However if needed, you can overwrite it by appending the return\_*&#x75;rl after the web\_url when redirect.

`http://checkout.pagsmile.com?prepay_id={$prepay_id}`

↓↓↓

`http://checkout.pagsmile.com?prepay_id={$prepay_id}&return_url=encodeURIComponent({$return_url})`
{% endhint %}

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

<figure><img src="https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FwCxwlfFSl8nJxRoLYxD9%2Fimage.png?alt=media&amp;token=405d68ad-101b-4c6d-9aca-1597a360d3fb" alt=""><figcaption><p>The Checkout page without specifying "method"</p></figcaption></figure>

<figure><img src="https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FSSBtZS66w0UFztllBjng%2Fimage.png?alt=media&amp;token=ee75fced-9238-48ad-a9e6-8d0fd86abfbd" alt=""><figcaption><p>The Checkout page with specifying "method":"PIX" (as an exmaple)</p></figcaption></figure>


# Checkout Page (E-com)

How to use Pagsmile Checkoutpage to submit a payin.

## Payin by using Pagsmile checkout page

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by using Pagsmile checkout page

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                              | Type   | Description                                                                                                                                                                                                                                           |
| ----------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                                                                                                          |
| customer.identify.number<mark style="color:red;">\*</mark>        | string | User's identification number                                                                                                                                                                                                                          |
| method                                                            | string | Add this object to show only the selected method. For instance, “method”: “PIX” will only show the PIX method. To show all the methods do not add this object in the request body. Check [here](/reference/payin/data/payment-method) for all methods |
| out\_trade\_no<mark style="color:red;">\*</mark>                  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                                                                                                  |
| notify\_url<mark style="color:red;">\*</mark>                     | string | Where Pagsmile will send notification to                                                                                                                                                                                                              |
| customer.identify.type<mark style="color:red;">\*</mark>          | string | <p>User's identification type</p><p>- check <a href="/reference/payin/data/data-for-test-sandbox#user-data">here</a> to check identify type for different countries -</p>                                                                             |
| timestamp<mark style="color:red;">\*</mark>                       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                                                                                                       |
| subject<mark style="color:red;">\*</mark>                         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                                                                                                          |
| order\_amount<mark style="color:red;">\*</mark>                   | string | <p>order amount<br>- 0.01 \~ 999999999 -</p><p>(refer to amount limit for different <a href="/reference/payin/data/payment-method">methods</a>)</p>                                                                                                   |
| order\_currency<mark style="color:red;">\*</mark>                 | string | <p>order currency<br>- Max. 3 chars -<br>Check <a href="/reference/payin/data/payment-method">here</a> for all methods.</p>                                                                                                                           |
| content<mark style="color:red;">\*</mark>                         | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p>                                                                                                                                            |
| buyer\_id<mark style="color:red;">\*</mark>                       | string | merchant user's id                                                                                                                                                                                                                                    |
| address.postal\_code<mark style="color:red;">\*</mark>            | string | zip code                                                                                                                                                                                                                                              |
| address.street<mark style="color:red;">\*</mark>                  | string | street                                                                                                                                                                                                                                                |
| address.street\_number<mark style="color:red;">\*</mark>          | string | street number                                                                                                                                                                                                                                         |
| address.city<mark style="color:red;">\*</mark>                    | string | city                                                                                                                                                                                                                                                  |
| address.state<mark style="color:red;">\*</mark>                   | string | state                                                                                                                                                                                                                                                 |
| channel                                                           | string | only use when method = Wallet                                                                                                                                                                                                                         |
| customer.phone<mark style="color:red;">\*</mark>                  | string | User's phone                                                                                                                                                                                                                                          |
| customer.email<mark style="color:red;">\*</mark>                  | string | User's email                                                                                                                                                                                                                                          |
| customer.name<mark style="color:red;">\*</mark>                   | string | User's name                                                                                                                                                                                                                                           |
| address.country<mark style="color:red;">\*</mark>                 | string | country                                                                                                                                                                                                                                               |
| trade\_type<mark style="color:red;">\*</mark>                     | string | fixed value: WEB                                                                                                                                                                                                                                      |
| billing.address.postal\_code<mark style="color:red;">\*</mark>    | string | billing zip code                                                                                                                                                                                                                                      |
| billing.address.country<mark style="color:red;">\*</mark>         | string | billing country                                                                                                                                                                                                                                       |
| billing.address.state<mark style="color:red;">\*</mark>           | string | billing state                                                                                                                                                                                                                                         |
| billing.address.city<mark style="color:red;">\*</mark>            | string | billing city                                                                                                                                                                                                                                          |
| billing.address.street<mark style="color:red;">\*</mark>          | string | billing street                                                                                                                                                                                                                                        |
| billing.address.street\_number<mark style="color:red;">\*</mark>  | string | billing street number                                                                                                                                                                                                                                 |
| billing.address.neighborhood<mark style="color:red;">\*</mark>    | string | billing neighborhood                                                                                                                                                                                                                                  |
| billing.identification.number<mark style="color:red;">\*</mark>   | string | billing identify number                                                                                                                                                                                                                               |
| billing.identification.type<mark style="color:red;">\*</mark>     | string | billing identify type                                                                                                                                                                                                                                 |
| address.neighborhood<mark style="color:red;">\*</mark>            | string | neighborhood                                                                                                                                                                                                                                          |
| billing.phone<mark style="color:red;">\*</mark>                   | string | billing phone                                                                                                                                                                                                                                         |
| billing.email<mark style="color:red;">\*</mark>                   | string | billing email                                                                                                                                                                                                                                         |
| billing.name<mark style="color:red;">\*</mark>                    | string | billing name                                                                                                                                                                                                                                          |
| shipping.address.street\_number<mark style="color:red;">\*</mark> | string | shipping street number                                                                                                                                                                                                                                |
| shipping.idenification.type<mark style="color:red;">\*</mark>     | string | shipping identify type                                                                                                                                                                                                                                |
| shipping.identification.number<mark style="color:red;">\*</mark>  | string | shipping identify number                                                                                                                                                                                                                              |
| shipping.address.neiborhood<mark style="color:red;">\*</mark>     | string | shipping neighborhood                                                                                                                                                                                                                                 |
| shipping.address.street<mark style="color:red;">\*</mark>         | string | shipping street                                                                                                                                                                                                                                       |
| shipping.address.city<mark style="color:red;">\*</mark>           | string | shipping city                                                                                                                                                                                                                                         |
| shipping.address.state<mark style="color:red;">\*</mark>          | string | shipping state                                                                                                                                                                                                                                        |
| shipping.address.country<mark style="color:red;">\*</mark>        | string | shipping country                                                                                                                                                                                                                                      |
| shipping.address.postal\_code<mark style="color:red;">\*</mark>   | string | shipping zip code                                                                                                                                                                                                                                     |
| shipping.phone<mark style="color:red;">\*</mark>                  | string | shipping phone                                                                                                                                                                                                                                        |
| shipping.email<mark style="color:red;">\*</mark>                  | string | shipping email                                                                                                                                                                                                                                        |
| shipping.name<mark style="color:red;">\*</mark>                   | string | shipping name                                                                                                                                                                                                                                         |
| products.quanity<mark style="color:red;">\*</mark>                | string | product quantity                                                                                                                                                                                                                                      |
| products.name<mark style="color:red;">\*</mark>                   | string | <p>product name<br>- Max. 200 chars -</p>                                                                                                                                                                                                             |
| products.url<mark style="color:red;">\*</mark>                    | string | <p>product url<br>- Max. 2000 chars -</p>                                                                                                                                                                                                             |
| products.description<mark style="color:red;">\*</mark>            | string | <p>product description<br>- Max. 1000 chars -</p>                                                                                                                                                                                                     |
| return\_url                                                       | sring  | web redirect url when payment is finish                                                                                                                                                                                                               |
| timeout\_express                                                  | string | <p>m(minutes), h(hours), d(days), c(always end in current day).</p><p>Used to control the expiration time of <strong>submitting</strong> an order (from initial to processing). (90m in default, max 15d)</p>                                         |
| cancellation\_express                                             | string | <p>m(minutes), h(hours), d(days). The value must be an integer.</p><p>Used to cancel an order. Ex: 90m Used to control the expiration time of a processing order.</p>                                                                                 |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354003",
    "web_url": "http://checkout.pagsmile.com?prepay_id=123456"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
      "charset": "UTF-8",
    * "app_id": "162************38",
    * "out_trade_no": "202201010354002",
    * "order_currency": "BRL",
    * "order_amount": "12.01",
    * "subject": "item name",
    * "content": "20 item description",
    * "trade_type": "WEB",
      "timeout_express": "15d",
    * "timestamp": "2022-01-01 03:54:01",
    * "notify_url": "http://merchant/callback/success",
    * "buyer_id": "buyer_0101_0001",
    * "customer" : {
    *     "identification": {
    *         "type": "CPF",
    *         "number": "50284414001"
        },
    *     "name": "customer user name",
    *     "email": "test@gmail.com",
    *     "phone": "5511987654321",
    * 	"buyer_id": "buyer_0101_0001",
        "ip": "127.0.0.1"
      },
    * "address":{
    * 	         "postal_code":"38082365",
    *            "country":"address test country",
    *            "state":"address state123",
    *            "city":"address city123",
    *            "street":"address streetqqq",
    *            "street_number":"4567",
    *            "neighborhood":"neighbor address222"
   			 },
    * "billing": {
    *     "address": {
    *            "postal_code":"38082365",
    *            "country":"billingtest country001",
    *            "state":"billingstate123",
    *            "city":"billingcity123",
    *            "street":"billingstreetqqq",
    *            "street_number":"22222",
    *            "neighborhood":"billingneighborhood222"
          },
    *     "identification": {
    *         "type": "cpf",
    *         "number": "50284414727"
        },
    *     "email": "email@test.com",
    *     "name": "test",
    *     "phone": "5511987654321"
      },
    * "shipping": {
    *     "address": {
    *            "postal_code":"38082365",
    *            "country":"Brazil",
    *            "state":"shipping state123",
    *            "city":"shipping city123",
    *            "street":"shipping streetqqq",
    *            "street_number":"4567",
    *            "neighborhood":"shipping hood222"
          },
    *     "identification": {
    *         "type": "cpf",
    *         "number": "50284414727"
          },
    *     "email": "email@test.com",
    *     "name": "test",
    *     "phone": "5511987654321"
      },
    * "products": [
          {
    *         "quantity": "1",
    *         "name": "product 1",
    *         "url": "https://www.pagsmile.com/product/1",
    *         "description": "this is a product"
          },
          {
           "quantity": "1",
           "name": "product 2",
           "url": "https://www.pagsmile.com/product/2",
           "description": "this is a product"
          },
          {
           "quantity": "3",
           "name": "product 3",
           "url": "https://www.pagsmile.com/product/3",
           "description": "this is a product"
        },
        {
           "quantity": "4",
            "name": "product 4",
            "url": "https://www.pagsmile.com/product/4",
            "description": "this is a product"
        }
    ]
}'
```

{% hint style="danger" %}
Return*url is not required in the request parameters. However if needed, you can overwrite it by appending the return\_*&#x75;rl after the web\_url when redirect.

`http://checkout.pagsmile.com?prepay_id={$prepay_id}`

↓↓↓

`http://checkout.pagsmile.com?prepay_id={$prepay_id}&return_url=encodeURIComponent({$return_url})`
{% endhint %}

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Direct integration

API Direct Payment

#### Request Base URL <a href="#request-base-url" id="request-base-url"></a>

```
  Test Environment : https://gateway-test.pagsmile.com
  Prod Environment : https://gateway.pagsmile.com
```

#### EndPoints <a href="#endpoints" id="endpoints"></a>

```
  /trade/pay
```

#### Request Header <a href="#request-header" id="request-header"></a>

| Parameter     | Required  | Description                         |
| ------------- | --------- | ----------------------------------- |
| Content-Type  | recommend | application/json                    |
| Authorization | yes       | Basic Base64(app\_id:security\_key) |

#### Request Body (JSON format) <a href="#request-body-json-format" id="request-body-json-format"></a>

| Parameter                | Type    | Required                     | Max Length(or Default Value) | Description                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------------------ | ------- | ---------------------------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id                  | string  | yes                          | 32                           | created app's id at dashboard                                                                                                                                                                                                                                                                                                                                                                                                     |
| timestamp                | string  | yes                          | 19                           | yyyy-MM-dd HH:mm:ss                                                                                                                                                                                                                                                                                                                                                                                                               |
| out\_trade\_no           | string  | yes                          | 64                           | ID given by the merchant in their system                                                                                                                                                                                                                                                                                                                                                                                          |
| method                   | string  | no                           | 32                           | [Payment Methods](https://docs.pagsmile.com/payin/data/payment-method)                                                                                                                                                                                                                                                                                                                                                            |
| channel                  | string  | no                           | 32                           | sub channel(only use at method 'Wallet')                                                                                                                                                                                                                                                                                                                                                                                          |
| order\_currency          | string  | yes                          | 3                            | BRL for brazil                                                                                                                                                                                                                                                                                                                                                                                                                    |
| order\_amount            | decimal | yes                          | 0.01 \~ 99999999999999.99    | request payment amount                                                                                                                                                                                                                                                                                                                                                                                                            |
| subject                  | string  | yes                          | 128                          | payment reason or item title                                                                                                                                                                                                                                                                                                                                                                                                      |
| content                  | string  | Yes                          | 255                          | payment reason detail or item detail. . This will be shown on the bank bill.                                                                                                                                                                                                                                                                                                                                                      |
| notify\_url              | string  | yes                          |                              | IPN URL to merchant(start with http                                                                                                                                                                                                                                                                                                                                                                                               |
| buyer\_id                | string  | yes                          |                              | merchant user's id                                                                                                                                                                                                                                                                                                                                                                                                                |
| token                    | string  | no                           |                              | [required for CreditCard](broken://pages/J8aQL6RYWEos7Tm2AEXg)                                                                                                                                                                                                                                                                                                                                                                    |
| fingerprint              | string  | no                           |                              | [required for CreditCard](broken://pages/J8aQL6RYWEos7Tm2AEXg)                                                                                                                                                                                                                                                                                                                                                                    |
| issuer                   | string  | no                           |                              | issuer of credit card（required for CreditCard）                                                                                                                                                                                                                                                                                                                                                                                    |
| installments             | integer | no                           | 1                            | installments for CreditCard                                                                                                                                                                                                                                                                                                                                                                                                       |
| bank                     | string  | no                           |                              | <p>bank code, required for</p><p>DepositExpress (itau,santander,bradesco,banco-do-brasil,caixa)<br>Cash (Use bank\_id from <a href="/reference/payin/tools/supported-bank-list-query">Bank Query</a>);<br>BankTransfer (Use bank\_id from<a href="/reference/payin/tools/supported-bank-list-query"> Bank Query</a>);<br>Khipu (Use bank\_id from <a href="/reference/payin/tools/supported-bank-list-query">Bank Query</a>);</p> |
| language\_code           | string  | no                           |                              | language code, required for Cash, BankTransfer. (Use language\_code from [Bank query](/reference/payin/tools/supported-bank-list-query))                                                                                                                                                                                                                                                                                          |
| customer.name            | string  | yes                          |                              | user's name                                                                                                                                                                                                                                                                                                                                                                                                                       |
| customer.email           | string  | yes                          |                              | user's email                                                                                                                                                                                                                                                                                                                                                                                                                      |
| customer.phone           | string  | yes                          |                              | user's mobile phone number                                                                                                                                                                                                                                                                                                                                                                                                        |
| customer.identify.number | string  | yes                          |                              | user's ID number                                                                                                                                                                                                                                                                                                                                                                                                                  |
| customer.identify.type   | string  | yes                          |                              | user's ID type                                                                                                                                                                                                                                                                                                                                                                                                                    |
| address.zip\_code        | string  | yes                          |                              | zip code                                                                                                                                                                                                                                                                                                                                                                                                                          |
| address.state            | string  | yes                          |                              | state                                                                                                                                                                                                                                                                                                                                                                                                                             |
| address.city             | string  | yes                          |                              | city                                                                                                                                                                                                                                                                                                                                                                                                                              |
| address.street\_number   | string  | yes                          |                              | street1 number                                                                                                                                                                                                                                                                                                                                                                                                                    |
| address.street           | string  | yes                          |                              | street1                                                                                                                                                                                                                                                                                                                                                                                                                           |
| address.neighborhood     | string  | no                           |                              | street2                                                                                                                                                                                                                                                                                                                                                                                                                           |
| user\_ip                 | string  | no                           |                              | user's IP address(required for CreditCard)                                                                                                                                                                                                                                                                                                                                                                                        |
| website\_url             | string  | no                           | 128                          | merchant website URL                                                                                                                                                                                                                                                                                                                                                                                                              |
| region                   | string  | required if using Global app |                              | <p>region of the payment. The format is ISO 3166-1 alpha-3<br>- ARG, BRA, etc. Check <a href="/reference/payin/data/country-code">here</a> -</p>                                                                                                                                                                                                                                                                                  |

#### Request Sample <a href="#request-sample" id="request-sample"></a>

```
curl --location --request POST 'https://gateway.pagsmile.com/trade/pay' \
--header 'Authorization: Basic Base64(appid:security_key)' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "app_id",
    "content": "content",
    "method": "Boleto",
    "notify_url": "notify_url",
    "order_amount": 10,
    "order_currency": "BRL",
    "out_trade_no": "{{$randomUUID}}",
    "subject": "subject",
    "timestamp": "{{datetime}}",
    "customer": {
      "name": "name",
      "email": "email",
	  "phone": "phone",
	  "identify": {
		"number":"number",
		"type":"type“，
	  }
      ...
    },
    "address": {
      "zip_code": "84043450",
      "state": "Parana",
      "city": "Ponta Grossa",
      "street"; "Colônia Dona Luíza",
      "street_number": "18",
    },
    "user_ip": "127.0.0.1",
    "region": "BRA"
}'
```

#### Http Response (JSON format) <a href="#http-response-json-format" id="http-response-json-format"></a>

<table><thead><tr><th width="191">Parameter</th><th>Type</th><th width="249">Description</th><th width="344">Method</th><th></th></tr></thead><tbody><tr><td>code</td><td>string</td><td>return code</td><td></td><td></td></tr><tr><td>msg</td><td>string</td><td>return msg</td><td></td><td></td></tr><tr><td>sub_code</td><td>string</td><td>return sub code(only error)</td><td></td><td></td></tr><tr><td>sub_msg</td><td>string</td><td>return sub msg(only error)</td><td></td><td></td></tr><tr><td>out_trade_no</td><td>string</td><td>request out_trade_no</td><td></td><td></td></tr><tr><td>trade_no</td><td>string</td><td>Pagsmile trade NO.</td><td></td><td></td></tr><tr><td>trade_status</td><td>string</td><td></td><td></td><td></td></tr><tr><td>pay_url</td><td>string</td><td>Redirect users to the payment URL</td><td><p>Argentina: Khipu, Bank Transfer;</p><p>Brazil: PIX, Lottery, Boleto, DepositExpress;</p><p>Mexico: SPEI, OXXO, OXXOPay;</p><p>Colombia: PSE, Efecty, Bancolombia, SuRed, Wallet ClaroPay, Gana;</p><p>Chile: Khipu, Pago46, Bank Transfer, Cash, Wallet Chek;</p><p>Peru: Bank Transfer, Cash;</p><p>Ecuador: Bank Transfer, Cash;</p><p>Costa Rica: Cash, BNCR;</p><p>Panama, Guatemala: Cash;</p><p>Bolivia, Paraguay, Uruguay: Bank Transfer;</p></td><td></td></tr><tr><td>reference</td><td>string</td><td>The value of reference is the ticket number that the user needs to use for payment</td><td><p>Argentina: Bank Transfer, Rapipago, PagoFacil;</p><p>Mexico: SPEI, CoDi, Cash;</p><p>Colombia: Bancolombia, SuRed, Gana;</p><p>Chile: Cash;</p><p>Peru: Bank Transfer, Cash;</p><p>Costa Rica: Cash, BNCR;</p><p>Panama, Guatemala: Cash;</p><p>Bolivia, Paraguay, Uruguay: Bank Transfer</p></td><td></td></tr><tr><td>barcode</td><td>string</td><td>Use the value of barcode to generate a scanable barcode can help users to make payment faster</td><td><p>Argentina: Rapipago, PagoFacil;</p><p>Brazil: Lottery, Boleto;</p><p>Mexico: OXXO, OXXOPay</p></td><td></td></tr><tr><td>qr_code</td><td>string</td><td>QR code</td><td><p>Brazil: PIX;</p><p>Mexico: CoDi</p></td><td></td></tr><tr><td>qr_code_url</td><td>string</td><td>System generated images of qr code which can be used directly on merchant website depending on needs.</td><td>Brazil: PIX</td><td></td></tr><tr><td>qr_code_img</td><td>string</td><td>System generated images of qr code which can be used directly on merchant website depending on needs.</td><td>Brazil: PIX</td><td></td></tr><tr><td>provider_owner</td><td>string</td><td>bank info : account owner; only in DepositExpress</td><td></td><td></td></tr><tr><td>provider_owner_document</td><td>string</td><td>bank info : account owner document; only in DepositExpress</td><td></td><td></td></tr><tr><td>provider_agency</td><td>string</td><td>bank info : account agency; only in DepositExpress</td><td></td><td></td></tr><tr><td>provider_number</td><td>string</td><td>bank info : account number; only in DepositExpress</td><td></td><td></td></tr><tr><td>partner_code</td><td>string</td><td>The value of reference is the ticket number that the user needs to use for payment</td><td><p>Colombia: Bancolombia, SuRed, Gana;</p><p>Costa Rica: BNCR</p></td><td></td></tr><tr><td>bank_name</td><td>string</td><td>bank info : bank name</td><td><p>Brazil: DepositExpress;</p><p>Mexico: SPEI</p></td><td></td></tr><tr><td>bank_no</td><td>string</td><td>Users only need to use the value of bank_no to finish payment at loterica store</td><td>Brazil: Lottery</td><td></td></tr><tr><td>bank_code</td><td>string</td><td>The ticket number that the user needs to use for payment</td><td>Brazil: Boleto</td><td></td></tr><tr><td>clabe</td><td>string</td><td>Unique automatically generated bank account</td><td>Only SPEI Mexico</td><td></td></tr><tr><td>wallet_url</td><td>string</td><td>Redirect users to the wallet payment page</td><td><p>Only in Wallet payment method Brazil: AME, PicPay;</p><p>Colombia: Wallets (Tpaga, Dale, Daviplata, Movii, Nequi, Rappipay)</p></td><td></td></tr><tr><td>app_link_url</td><td>string</td><td>Redirect users to the wallet app payment page (for mobile walle application)</td><td><p>For mobile wallet app use only Brazil: AME;</p><p>Chile: Mach, Vita</p></td><td></td></tr><tr><td>instruction</td><td>string</td><td>Take the recipient's bank details from the response parameter - "instruction" and present to users</td><td>Bolivia, Paraguay, Uruguay: Bank Transfer</td><td></td></tr></tbody></table>

#### Return Code (Success) <a href="#return-code-success" id="return-code-success"></a>

```
{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "{out_trade_no}",
    "trade_no": "{trade_no}",
    "trade_status": "PROCESSING",
    "pay_url": "https://checkout-testv2.pagsmile.com/checkout?prepay_id=XX",
    "barcode": "{barcode}",
    "qr_code": "{qr_code}",
    "provider_owner": "{provider_owner}",
    "provider_owner_document": "{provider_owner_document}",
    "provider_agency": "{provider_agency}",
    "provider_number": "{provider_number}",
    "wallet_url": "{wallet_url}",
    "app_link_url": "{app_link_url}"
}
```

#### Return Code (Fail) <a href="#return-code-fail" id="return-code-fail"></a>

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "invalid-signature",
    "sub_msg": "invalid signature"
}
```

{% hint style="warning" %}
**Attention**

Return\_url is not required in the request parameters, you can also append the return\_url after the web\_url when redirect:

<http://checkout.pagsmile.com?prepay\\_id={$prepay\\_id}>

↓↓↓

<http://checkout.pagsmile.com?prepay\\_id={$prepay\\_id}\\&return\\_url={$return\\_url}>
{% endhint %}


# Argentina

Argentina methods for API direct payment


# Virtual Account

This section describes how to create a Virtual Account, query the Virtual Account status, and receive payment notifications for Argentina Virtual Account payments.

Argentina Virtual Account payments use `BankTransfer` as the payment method.

For Argentina Virtual Account payments, the Virtual Account is created first. After the payer transfers funds to the assigned account number, Pagsmile sends an asynchronous notification to the merchant's `notify_url`.

### Create Virtual Account

Use this endpoint to create a Virtual Account for Argentina.

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/virtual-account/create`

#### Request Body

<table><thead><tr><th width="232.64453125">Parameter</th><th width="92.93359375">Type</th><th width="120.77734375">Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>Required</td><td>Max length: 32</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Required</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; max length: 19</td><td>Request timestamp.</td></tr><tr><td><code>notify_url</code></td><td>string</td><td>Required</td><td>Valid URL</td><td>The URL to receive Virtual Account payment notifications.</td></tr><tr><td><code>method</code></td><td>string</td><td>Required</td><td>Fixed value: <code>BankTransfer</code></td><td>Payment method.</td></tr><tr><td><code>region</code></td><td>string</td><td>Required</td><td>Fixed value: <code>ARG</code></td><td>Country or region code.</td></tr><tr><td><code>customer.buyer_id</code></td><td>string</td><td>Required</td><td>Maximum length: 128 characters.</td><td>Merchant-side user ID.</td></tr><tr><td><code>customer.username</code></td><td>string</td><td>Optional</td><td>Max length: 128</td><td>Customer name.</td></tr><tr><td><code>customer.identify.type</code></td><td>string</td><td>Optional</td><td>Example: <code>CUIT</code></td><td>Customer identification type.</td></tr><tr><td><code>customer.identify.number</code></td><td>string</td><td>Optional</td><td>Maximum length: 64 characters.</td><td>Customer identification number.</td></tr></tbody></table>

#### Request Sample

```json
{
  "app_id": "165***62",
  "timestamp": "2026-07-21 11:11:11",
  "notify_url": "http://demo.gemini-tiger.cn/callback/success",
  "method": "BankTransfer",
  "region": "ARG",
  "customer": {
    "buyer_id": "19***1",
    "username": "User Name",
    "identify": {
      "type": "CUIT",
      "number": "2***20"
    }
  }
}
```

#### Response Sample

```json
{
  "code": "10000",
  "msg": "Success",
  "account_id": "VC***DJ",
  "account_number": "00***659",
  "buyer_id": "19***41",
  "status": "ACTIVE",
  "notify_url": "http://demo.gemini-tiger.cn/callback/success",
  "method": "BankTransfer"
}
```

After the Virtual Account is created successfully, use the returned `account_number` to instruct the payer to complete the bank transfer.

### Query Virtual Account

Use this endpoint to query the Virtual Account information and status.

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/virtual-account/query`

#### Request Body

<table><thead><tr><th width="116.8515625">Parameter</th><th width="83.03515625">Type</th><th width="112.75390625">Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>Required</td><td>Max length: 32</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Required</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; max length: 19</td><td>Request timestamp.</td></tr><tr><td><code>account_id</code></td><td>string</td><td>Required</td><td>Max length: 64</td><td>The Virtual Account ID returned by the Create Virtual Account API.</td></tr></tbody></table>

#### Request Sample

```json
{
  "app_id": "165***462",
  "timestamp": "2026-07-21 11:11:11",
  "account_id": "VC***DJ"
}
```

#### Response Sample

```json
{
  "code": "10000",
  "msg": "Success",
  "account_id": "VC***DJ",
  "account_number": "00***659",
  "buyer_id": "19***1",
  "status": "ACTIVE",
  "notify_url": "http://demo.gemini-tiger.cn/callback/success",
  "method": "BankTransfer"
}
```

### Notification

After the payer completes the bank transfer, Pagsmile sends an asynchronous notification to the merchant's `notify_url`.

#### Notification Body

<table><thead><tr><th width="298.046875">Parameter</th><th width="102.18359375">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount</code></td><td>string</td><td>Payment amount received.</td></tr><tr><td><code>out_trade_no</code></td><td>string</td><td>Pagsmile-generated transaction reference.</td></tr><tr><td><code>method</code></td><td>string</td><td>Payment method. Fixed value: <code>BankTransfer</code>.</td></tr><tr><td><code>trade_status</code></td><td>string</td><td>Transaction status. Example: <code>SUCCESS</code>.</td></tr><tr><td><code>trade_no</code></td><td>string</td><td>Pagsmile transaction number.</td></tr><tr><td><code>currency</code></td><td>string</td><td>Payment currency. Fixed value: <code>ARS</code>.</td></tr><tr><td><code>app_id</code></td><td>string</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>user.buyer_id</code></td><td>string</td><td>Merchant-side user ID used when creating the Virtual Account.</td></tr><tr><td><code>user.email</code></td><td>string</td><td>User's email address used when creating the Virtual Account.</td></tr><tr><td><code>user.identification.number</code></td><td>string</td><td>User identification number used when creating the Virtual Account.</td></tr><tr><td><code>user.identification.type</code></td><td>string</td><td>User identification type used when creating the Virtual Account. Example: <code>CUIT</code>.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Notification timestamp.</td></tr><tr><td><code>transfer_account.account_id</code></td><td>string</td><td>Virtual Account ID.</td></tr><tr><td><code>transfer_account.account_number</code></td><td>string</td><td>Virtual Account number.</td></tr></tbody></table>

#### Notification Sample

```json
{
  "amount": "11.22",
  "out_trade_no": "16113d91aa0044048670d*****",
  "method": "BankTransfer",
  "trade_status": "SUCCESS",
  "trade_no": "202607200911******",
  "currency": "ARS",
  "app_id": "1659332*****",
  "user": {
    "buyer_id": "19***1",
    "email": "TEST780917000@test.com",
    "identification": {
      "number": "2***20",
      "type": "CUIT"
    }
  },
  "timestamp": "1784538679",
  "transfer_account": {
    "account_id": "VC***DJ",
    "account_number": "00***659"
  }
}
```

Use the asynchronous notification as the final transaction result. The payer may complete the bank transfer after the Virtual Account is created.


# Bank Transfer

How to use BankTransfer to submit a payin in Argentina.

Use this endpoint to submit a Bank Transfer payment in Argentina.

{% hint style="warning" %}
Refunds are not supported for this payment method.
{% endhint %}

### Endpoint

```
POST https://gateway-test.pagsmile.com/trade/pay
```

### Request headers

<table><thead><tr><th width="142.8203125">Header</th><th width="125.44140625">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Type</code></td><td>Yes</td><td>Fixed value: <code>application/json</code>.</td></tr><tr><td><code>Authorization</code></td><td>Yes</td><td>Basic authentication using <code>Base64(app_id:security_key)</code>.</td></tr></tbody></table>

### Request body

<table><thead><tr><th width="247.1953125">Parameter</th><th width="89.3828125">Type</th><th width="110.27734375">Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>Yes</td><td>Maximum 32 characters.</td><td>Merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>out_trade_no</code></td><td>string</td><td>Yes</td><td>Maximum 64 characters; must be unique for the merchant application.</td><td>Merchant order number.</td></tr><tr><td><code>method</code></td><td>string</td><td>Yes</td><td>Fixed value: <code>BankTransfer</code>.</td><td>Payment method.</td></tr><tr><td><code>order_amount</code></td><td>decimal</td><td>Yes</td><td>No minimum amount is specified. Maximum: <code>5,000,000</code> ARS. Supports up to two decimal places.</td><td>Payment amount.</td></tr><tr><td><code>order_currency</code></td><td>string</td><td>Yes</td><td>Fixed value: <code>ARS</code>.</td><td>Payment currency.</td></tr><tr><td><code>subject</code></td><td>string</td><td>Yes</td><td>Maximum 128 characters.</td><td>Payment subject or order title.</td></tr><tr><td><code>content</code></td><td>string</td><td>No</td><td>Maximum 255 characters.</td><td>Payment description.</td></tr><tr><td><code>trade_type</code></td><td>string</td><td>No</td><td>Fixed value: <code>API</code>.</td><td>Indicates a direct API payment.</td></tr><tr><td><code>notify_url</code></td><td>string</td><td>Yes</td><td>Must be a valid URL. HTTPS is recommended.</td><td>Endpoint that receives asynchronous payment notifications.</td></tr><tr><td><code>return_url</code></td><td>string</td><td>No</td><td>Must be a valid URL. HTTPS is recommended.</td><td>URL to which the customer is redirected after the payment flow.</td></tr><tr><td><code>buyer_id</code></td><td>string</td><td>Yes</td><td>Maximum 128 characters.</td><td>Merchant-side customer ID.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Yes</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; maximum 19 characters.</td><td>Time at which the request is sent.</td></tr><tr><td><code>timeout_express</code></td><td>string</td><td>No</td><td>Supports <code>m</code> (minutes), <code>h</code> (hours), <code>d</code> (days), and <code>c</code> (end of the current day). The default is <code>90m</code> and the maximum is <code>15d</code>.</td><td>Payment expiration time.</td></tr><tr><td><code>customer.identify.type</code></td><td>string</td><td>Yes</td><td>Fixed value: <code>CUIT</code>.</td><td>Customer identification type.</td></tr><tr><td><code>customer.identify.number</code></td><td>string</td><td>Yes</td><td>Must contain 11 digits.</td><td>Customer CUIT number.</td></tr></tbody></table>

### Request example

```json
{
  "app_id": "16***2",
  "out_trade_no": "out_tr***41",
  "method": "BankTransfer",
  "order_amount": "51.19",
  "order_currency": "ARS",
  "subject": "trade pay test",
  "content": "trade pay test content",
  "trade_type": "API",
  "notify_url": "http://demo.gemini-tiger.cn/callback/success",
  "return_url": "https://www.pag.com",
  "buyer_id": "agt",
  "timestamp": "2026-08-18 13:18:10",
  "timeout_express": "1c",
  "customer": {
    "identify": {
      "type": "CUIT",
      "number": "2***0"
    }
  }
}
```

### Response example

```json
{
  "code": "10000",
  "msg": "Success",
  "prepay_id": "R2t***a841",
  "trade_no": "2026***27",
  "out_trade_no": "out_t***41",
  "web_url": "",
  "trade_status": "PROCESSING",
  "reference": "000***18"
}
```

Present the returned `reference` to the customer so that it can be included with the bank transfer.

{% hint style="warning" %}
A successful API response with `code=10000` only confirms that the payment request was created. It does not mean that the transfer has been completed. Use payment notifications or the Payin Detail API to determine the final payment status.
{% endhint %}


# Credit Card

This endpoint allows you to submit a payin by CreditCard in Argentina.

To submit a CreditCard payin, you need to tokenize the card first, and then use the returned `token` to submit the payment.

{% hint style="info" %}
Argentina CreditCard supports partial refund.
{% endhint %}

### Step 1: Tokenize Card

Use the Card Tokenization API to tokenize the card information.

<mark style="color:green;">POST</mark> `https://security-test.pagsmile.com/card/tokenize`

#### Request Body

<table><thead><tr><th width="178.12109375">Parameter</th><th width="101.65234375">Type</th><th>Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td>app_id</td><td>string</td><td>Required</td><td>Max length: 32</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td>format</td><td>string</td><td>Required</td><td>Fixed value: <code>JSON</code></td><td>Request format.</td></tr><tr><td>version</td><td>string</td><td>Required</td><td>Fixed value: <code>2.0</code></td><td>API version.</td></tr><tr><td>timestamp</td><td>string</td><td>Required</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; max length: 19</td><td>Request timestamp.</td></tr><tr><td>card.card_no</td><td>string</td><td>Required</td><td>Card number; use a valid test card number in the sandbox environment</td><td>Card number.</td></tr><tr><td>card.issuer</td><td>string</td><td>Required</td><td>Example: <code>visa</code></td><td>Card issuer.</td></tr><tr><td>card.holder.name</td><td>string</td><td>Required</td><td>-</td><td>Cardholder name.</td></tr><tr><td>card.cvv</td><td>string</td><td>Required</td><td>3 or 4 digits</td><td>Card CVV.</td></tr><tr><td>card.valid_thru_year</td><td>string</td><td>Required</td><td>Format: <code>yyyy</code></td><td>Card expiration year.</td></tr><tr><td>card.valid_thru_month</td><td>string</td><td>Required</td><td>Format: <code>MM</code>; value: <code>01</code>–<code>12</code></td><td>Card expiration month.</td></tr></tbody></table>

#### Request Sample

```json
{
  "app_id": "162***33",
  "format": "JSON",
  "version": "2.0",
  "timestamp": "2026-07-06 11:08:10",
  "card": {
    "card_no": "4012***12",
    "issuer": "visa",
    "holder": {
      "name": "test uuu yyy"
    },
    "cvv": "123",
    "valid_thru_year": "2027",
    "valid_thru_month": "12"
  }
}
```

#### Response Sample

```json
{
  "code": "10000",
  "msg": "Success",
  "token": "psct_ec031b***8eae"
}
```

### Step 2: Submit Payin with Token

Use the returned `token` to submit a CreditCard payin.

<mark style="color:green;">POST</mark> `https://gateway-test.pagsmile.com/trade/pay`

#### Request Body

<table><thead><tr><th width="261.8359375">Parameter</th><th>Type</th><th>Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td>app_id</td><td>string</td><td>Required</td><td>Max length: 32</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td>timestamp</td><td>string</td><td>Required</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; max length: 19</td><td>Request timestamp.</td></tr><tr><td>version</td><td>string</td><td>Required</td><td>Fixed value: <code>2.0</code></td><td>API version.</td></tr><tr><td>order_amount</td><td>string</td><td>Required</td><td>Supports up to 2 decimal places</td><td>Payment amount.</td></tr><tr><td>order_currency</td><td>string</td><td>Required</td><td>Fixed value: <code>ARS</code></td><td>Payment currency.</td></tr><tr><td>method</td><td>string</td><td>Required</td><td>Fixed value: <code>CreditCard</code></td><td>Payment method.</td></tr><tr><td>out_trade_no</td><td>string</td><td>Required</td><td>Max length: 64</td><td>Merchant order number. Must be unique.</td></tr><tr><td>subject</td><td>string</td><td>Required</td><td>Max length: 128</td><td>Payment subject or order title.</td></tr><tr><td>notify_url</td><td>string</td><td>Required</td><td>Valid URL</td><td>The URL to receive payment notifications.</td></tr><tr><td>buyer_id</td><td>string</td><td>Required</td><td>Max length: 64</td><td>Merchant-side user ID.</td></tr><tr><td>token</td><td>string</td><td>Required</td><td>Card token returned by the card tokenization API</td><td>The tokenized card information used to submit the card payment.</td></tr><tr><td>customer.identification.type</td><td>string</td><td>Required</td><td>Example: one of <code>CUIT</code>, <code>DNI</code></td><td>Customer identification type.</td></tr><tr><td>customer.identification.number</td><td>string</td><td>Required</td><td>Required length: 11 digits for CPF, 14 digits for CNPJ</td><td>Customer identification number.</td></tr></tbody></table>

#### Request Sample

```json
{
  "app_id": "1629***33",
  "timestamp": "2026-07-06 11:08:15",
  "version": "2.0",
  "order_amount": "61.6",
  "order_currency": "ARS",
  "method": "CreditCard",
  "out_trade_no": "out_193***00",
  "subject": "Test",
  "notify_url": "http://demo.testcase.cn/callback/success",
  "buyer_id": "buyer_1108",
  "token": "psct_ec031b***8eae",
  "customer": {
    "identification": {
      "type": "CUIT",
      "number": "502**7"
    }
  }
}
```

#### Response Sample

```json
{
  "code": "10000",
  "msg": "Success",
  "sub_code": "200",
  "sub_msg": "",
  "out_trade_no": "53***4604",
  "prepay_id": "c2E***F9Ba6076",
  "trade_no": "2026***087",
  "trade_status": "PROCESSING",
  "web_url": ""
}
```


# DEBIN

How to use DEBIN to submit a payin in Argentina.

Use this endpoint to submit a DEBIN payment in Argentina. The customer must provide a CBU, CVU, or account alias together with their name and identification information. After the payment request is created, redirect the customer to the returned `pay_url` to authorize the payment.

{% hint style="warning" %}
The payment amount must be between `1,750` and `5,000,000` ARS. Requests outside this range may be rejected. Refunds are not supported for this payment method.
{% endhint %}

### Endpoint

For sandbox testing, use:

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

### Request headers

<table><thead><tr><th width="182.546875">Header</th><th width="120.81640625">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Type</code></td><td>Yes</td><td>Fixed value: <code>application/json</code>.</td></tr><tr><td><code>Authorization</code></td><td>Yes</td><td>Basic authentication using <code>Base64(app_id:security_key)</code>.</td></tr></tbody></table>

### Request body

<table><thead><tr><th width="170.78515625">Parameter</th><th width="96.6875">Type</th><th width="106.40625">Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>Yes</td><td>Must not exceed 32 characters.</td><td>Merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>out_trade_no</code></td><td>string</td><td>Yes</td><td>Must not exceed 64 characters and must be unique for the merchant application.</td><td>Merchant order number.</td></tr><tr><td><code>method</code></td><td>string</td><td>Yes</td><td>Fixed value: <code>DEBIN</code>.</td><td>Payment method.</td></tr><tr><td><code>order_amount</code></td><td>decimal</td><td>Yes</td><td>Must be from <code>1,750</code> to <code>5,000,000</code> ARS and may contain up to two decimal places.</td><td>Payment amount.</td></tr><tr><td><code>order_currency</code></td><td>string</td><td>Yes</td><td>Fixed value: <code>ARS</code>.</td><td>Payment currency.</td></tr><tr><td><code>subject</code></td><td>string</td><td>Yes</td><td>Must not exceed 128 characters.</td><td>Payment subject or order title.</td></tr><tr><td><code>content</code></td><td>string</td><td>Yes</td><td>Must not exceed 255 characters.</td><td>Payment description.</td></tr><tr><td><code>notify_url</code></td><td>string</td><td>Yes</td><td>Must be a valid URL; HTTPS is recommended.</td><td>Endpoint that receives asynchronous payment notifications.</td></tr><tr><td><code>return_url</code></td><td>string</td><td>No</td><td>Must be a valid URL; HTTPS is recommended.</td><td>URL to which the customer is redirected after completing the payment flow.</td></tr><tr><td><code>buyer_id</code></td><td>string</td><td>Yes</td><td>Must not exceed 128 characters.</td><td>Merchant-side customer ID.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Yes</td><td>Must use the <code>yyyy-MM-dd HH:mm:ss</code> format and must not exceed 19 characters.</td><td>Time at which the request is sent.</td></tr><tr><td><code>timeout_express</code></td><td>string</td><td>No</td><td>Must use a supported expiration expression, such as <code>1c</code>. The DEBIN payment request remains valid for up to five days; use the returned <code>due_date</code> as the authoritative deadline.</td><td>Merchant-specified payment expiration expression.</td></tr><tr><td><code>account_type</code></td><td>string</td><td>Yes</td><td>One of: <code>CBU/CVU</code>, <code>Alias</code>. Use <code>CBU/CVU</code> when providing a 22-digit account identifier and <code>Alias</code> when providing an account alias.</td><td>Type of account identifier supplied in <code>account_number</code>.</td></tr><tr><td><code>account_number</code></td><td>string</td><td>Yes</td><td>When <code>account_type</code> is <code>CBU/CVU</code>, provide a valid 22-digit CBU or CVU without spaces or separators. When <code>account_type</code> is <code>Alias</code>, provide a valid alias linked to the customer's CBU or CVU.</td><td>Bank or virtual account identifier to be debited.</td></tr><tr><td><code>customer.identify.type</code></td><td>string</td><td>Yes</td><td>One of: <code>DNI</code>, <code>CUIT</code>. The value must match the document supplied in <code>customer.identify.number</code>.</td><td>Customer identification type.</td></tr><tr><td><code>customer.identify.number</code></td><td>string</td><td>Yes</td><td>Provide a valid identification number corresponding to <code>customer.identify.type</code>: 8 digits for <code>DNI</code> or 11 digits for <code>CUIT</code>.</td><td>Customer identification number.</td></tr><tr><td><code>customer.name</code></td><td>string</td><td>Yes</td><td>Provide the account holder's full name.</td><td>Customer name.</td></tr></tbody></table>

### Request example

```json
{
  "app_id": "165***62",
  "out_trade_no": "out_***00",
  "method": "DEBIN",
  "order_amount": "1801",
  "order_currency": "ARS",
  "subject": "trade pay test",
  "content": "trade pay test content",
  "notify_url": "https://merchant.example.com/payment/notify",
  "return_url": "https://merchant.example.com/payment/result",
  "buyer_id": "agt",
  "timestamp": "2026-08-16 13:18:10",
  "timeout_express": "1c",
  "account_type": "CBU/CVU",
  "account_number": "07***90",
  "customer": {
    "identify": {
      "type": "CUIT",
      "number": "20***9"
    },
    "name": "Test User"
  }
}
```

To use an account alias, set `account_type` to `Alias` and provide the alias in `account_number`.

### Response example

```json
{
  "code": "10000",
  "msg": "Success",
  "prepay_id": "cG***858",
  "trade_no": "202***76",
  "out_trade_no": "out_***00",
  "web_url": "",
  "pay_url": "https://checkout.pagsmile.com/checkout?prepay_id=cG***58",
  "trade_status": "PROCESSING",
  "due_date": "2026-08-21T00:00:00-03:00"
}
```

### Complete the payment

1. Redirect the customer's browser to the complete `pay_url` returned by Pagsmile.
2. Do not construct or modify the payment URL.
3. Allow the customer to complete the DEBIN authorization flow before `due_date`.
4. Use the payment notification or the Payin Detail API to determine the final payment status.

{% hint style="warning" %}
A successful API response with `code=10000` only confirms that the payment request was created. `trade_status=PROCESSING` does not mean that the payment has been completed. Do not deliver goods or services until the final paid status is confirmed.
{% endhint %}


# Khipu

How to use Khipu to submit a payin in Argentina.

## Payin by Khipu

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Khipu in Argentina.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                 |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                        |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                    |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                        |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Khipu                                                                                          |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check limits <a href="/reference/payin/data/payment-method#argentina">here</a> -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: ARS                                                                                            |
| bank<mark style="color:red;">\*</mark>                     | string | Use [API](/reference/payin/tools/supported-bank-list-query) to get bank code                                |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                          |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                      |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- DNI or CUIT -</p>                                                     |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- DNI: 8 digts,<br>CUIT: 11 digits -</p>                              |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                 |

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

```
{
    "code":"10000",
    "msg":"Success",
    "prepay_id":"d3UwdDhRbnUx****NMzdaWT0=-17FBDFe8",
    "trade_no":"2022010110293900083",
    "out_trade_no":"202201010354006",
    "web_url":"",
    "pay_url":"https://khipu.com/payment/info/ab0cdezzmz3k",
    "trade_status":"PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Redirect users to the **pay\_url** to complete the payment
* KHIPU works as an interface that connects the user with the Bank platform and simplifies the bank transfer flow, therefore, the user **document id,** **Clave** (Password/PIN), and **username** that users enter on KHIPU should be the same as the one they used to enter their e-banking
  {% endhint %}

<figure><img src="https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2F8r5owO0pgWKLa4EaMPSO%2Fimage.png?alt=media&amp;token=c448ee2a-09a6-43f9-9e6f-dff15d1b1e60" alt="" width="275"><figcaption></figcaption></figure>

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "Khipu",
    * "order_amount": "50",
    * "order_currency": "ARS",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "bank": "Si9wa",
    * "customer": {
    *     "name": "Test Name",
    *     "identify": {
    *         "type": "DNI",
    *         "number": "********"
      }
      }
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# QRCode

How to use QRCode to submit a payin in Argentina.

## Payin by QRCode

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by QRCode in Argentina.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                 |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                        |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                    |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                        |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: QRCode                                                                                         |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check limits <a href="/reference/payin/data/payment-method#argentina">here</a> -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: ARS                                                                                            |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                          |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                      |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- DNI or CUIT -</p>                                                     |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- DNI: 8 digts,<br>CUIT: 11 digits -</p>                              |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                 |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone                                                                                                |

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

<pre><code><strong>{
</strong>    "msg": "Success",
    "reference": "1111111111",
    "code": "10000",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "trade_status": "PROCESSING",
    "pay_url": "https://checkout.pagsmile.com/payment-request/866***4bd7",
    "prepay_id": "dVZCMEw1ZWlL***NrUk82OVhlbz0=-e43F87BB",
    "qr_code":"00020101********630495f5"   
}
</code></pre>

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "QRCode",
    * "order_amount": "50",
    * "order_currency": "ARS",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "name": "Test Name",
    *     "email": "test@pagsmile.com",
    *     "identify": {
    *         "type": "DNI",
    *         "number": "********",
    *         "phone": "20109****01"

      }
    }
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Rapipago

How to use Rapipago to submit a payin in Argentina.

## Payin by Rapipago

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Rapipago in Argentina.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                 |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                        |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                    |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                        |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Rapipago                                                                                       |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check limits <a href="/reference/payin/data/payment-method#argentina">here</a> -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: ARS                                                                                            |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                          |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                      |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CUIT -</p>                                                            |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- CUIT: 11 digits -</p>                                               |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                 |

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

<pre><code><strong>{
</strong>    "msg": "Success",
    "code": "10000",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "trade_status": "PROCESSING",
    "trade_no": "2022010110293900083",
    "barcode": "53523***09",
    "due_date": "2025-12-09" //The due_date is always 7 days after creation.
    "prepay_id": "dVZCMEw1ZWlL***NrUk82OVhlbz0=-e43F87BB"   
}
</code></pre>

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Use the value of **barcode** to generate a scanable barcode for faster payment.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "Rapipago",
    * "order_amount": "50",
    * "order_currency": "ARS",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "name": "Test Name",
    *     "identify": {
    *         "type": "CUIT",
    *         "number": "203***2"
      }
    }
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# DebitCard

How to use DebitCard to submit a payin in Argentina.

## Payin by DebitCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by DebitCard in Argentina.

{% hint style="warning" %}
DebitCard has been unavailable since January 2026.
{% endhint %}

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                 |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                        |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                    |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                        |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: DebitCard                                                                                      |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check limits <a href="/reference/payin/data/payment-method#argentina">here</a> -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: ARS                                                                                            |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                          |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                      |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- DNI or CUIT -</p>                                                     |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- DNI: 8 digts,<br>CUIT: 11 digits -</p>                              |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                 |

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

<pre><code><strong>{
</strong>    "msg": "Success",
    "reference": "1111111111",
    "code": "10000",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "trade_status": "PROCESSING",
    "pay_url": "https://checkout.pagos360.com/payment-request/866***4bd7",
    "prepay_id": "dVZCMEw1ZWlL***NrUk82OVhlbz0=-e43F87BB"   
}
</code></pre>

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "DebitCard",
    * "order_amount": "50",
    * "order_currency": "ARS",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "name": "Test Name",
    *     "identify": {
    *         "type": "DNI",
    *         "number": "********"
      }
    }
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Wallet

How to use Wallet to submit a payin in Argentina.

{% hint style="danger" %}
Currently no available Wallet method in Argentina
{% endhint %}

## Payin by Wallet

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Wallet in Argentina.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| customer.phone                                    | string | User's phone                                                         |
| customer.email                                    | string | User's email                                                         |
| customer.identify.number                          | string | <p>User's identification number<br>- 8 digits or 11 digits -</p>     |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Wallet                                                  |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| customer.identify.type                            | string | <p>User's identification type</p><p>- DNI or CUIT/CUIL/CD -</p>      |
| customer.name                                     | string | User's name                                                          |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- min: 0.1 ARS, no max -</p>                    |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: ARS                                                     |
| content<mark style="color:red;">\*</mark>         | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| address.zip\_code                                 | string | <p>zip code<br>- 6 digits -</p>                                      |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |
| address.street                                    | string | street                                                               |
| address.street\_number                            | string | street number                                                        |
| address.city                                      | string | city                                                                 |
| address.state                                     | string | state                                                                |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |
| channel<mark style="color:red;">\*</mark>         | string | Fixed value: ~~Astropay~~                                            |

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "d3UwdDhRbnUx****NMzdaWT0=-17FBDFe8",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "wallet_url": "https://onetouch.astropay.com/deposit/",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "Wallet",
    * "channel": "Astropay",
    * "order_amount": "50",
    * "order_currency": "ARS",
    * "subject": "trade pay test",
    * "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01"
      }
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# PagoFacil

How to use PagoFacil to submit a payin in Argentina.

## Payin by PagoFacil

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by PagoFacil in Argentina.

{% hint style="danger" %}
PagoFacil has been unavailable since January 2026.
{% endhint %}

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                 |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- 8 digts or 11 digits -</p>                                             |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: PagoFacil                                                                                      |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                        |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- DNI or CUIT/CUIL/CD -</p>                                             |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check limits <a href="/reference/payin/data/payment-method#argentina">here</a> -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: ARS                                                                                            |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                        |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                          |
| address.zip\_code                                          | string | <p>zip code<br>- 6 digits -</p>                                                                             |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                        |
| address.street                                             | string | street                                                                                                      |
| address.street\_number                                     | string | street number                                                                                               |
| address.city                                               | string | city                                                                                                        |
| address.state                                              | string | state                                                                                                       |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                      |

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

<pre><code><strong>{
</strong>    "msg": "Success",
    "reference": "1111111111",
    "code": "10000",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "trade_status": "PROCESSING",
    "trade_no": "2022010110293900083",
    "barcode": "3335008****05200211740749",
    "prepay_id": "dVZCMEw1ZWlL***NrUk82OVhlbz0=-e43F87BB"   
}
</code></pre>

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* The value of **reference** is the ticket number that the user needs to use for payment
* Use the value of **barcode** to generate a scanable barcode can help users to make payment faster
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354006",
    "method": "PagoFacil",
    "order_amount": "50",
    "order_currency": "ARS",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"1c",
    "customer" : {
        "identify": {
            "type": "DNI",
            "number": "40754127"
        },
    }
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Bahrain

Bahrain methods for API direct payment


# Credit Card

How to use CreditCard to submit a payin in Bahrain.

## Payin by CreditCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by CreditCard in Bahrain.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CreditCard</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- 0.01~ BHD/USD -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>BHD or USD</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>trade_type<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: API</td></tr><tr><td>customer.name<mark style="color:red;">*</mark></td><td>string</td><td>User's name</td></tr><tr><td>customer.email<mark style="color:red;">*</mark></td><td>string</td><td>User's email</td></tr><tr><td>customer.phone<mark style="color:red;">*</mark></td><td>string</td><td>User's phone</td></tr><tr><td>billing.address.country<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address country<br>- Fixed value: BHR -</td></tr><tr><td>billing.address.state<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address state</td></tr><tr><td>billing.address.city<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address city</td></tr><tr><td>billing.address.street<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address street</td></tr><tr><td>billing.address.street_number<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address street_number</td></tr><tr><td>billing.address.postal_code<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address postal code</td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "out***300",
    "trade_no": "20240***34",
    "prepay_id": "UloyV0l3NFFyW***DTT0=-645a8F4c"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Step 1:** Get the "prepay\_id" from the API response. Each transaction should create a unique prepay\_id.

**Step 2:** Follow the step [here](/reference/payin/tools/pagsmile-javascript#step-1-include-pagsmile-script) to add the Pagsmile JavaScript library.

**Step 3:** Follow the step [here ](/reference/payin/tools/pagsmile-javascript#step-3-handle-payment-form-submission)to submit the payment form.
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "USD",
    * "method": "CreditCard",
    * "order_amount": "1",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "trade_type": "API",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023",
    * "version": "2.0",
    * "customer" : {
    *     "name": "Test name",
    *     "email": "Test name@gmail.com",
    *     "phone": "119***21"
      },
    * "billing": {
    *     "address": {
    *         "country":"BHR",
    *         "state":"billingstate",
    *         "city":"billingcity",
    *         "street":"billingstreetqqq",
    *         "street_number":"22222",
    *         "postal_code":"37866-5465"
          }
      }
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Debit Card

How to use DebitCard to submit a payin in Bahrain.

## Payin by DebitCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by DebitCard in Bahrain.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: DebitCard</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- limit unknown -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>BHD</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "UnR****ceB3aD",
    "trade_no": "202****18",
    "out_trade_no": "out_t****00",
    "web_url": "",
    "pay_url": "https://www.***.bh/payment/paymentpage.htm?PaymentID=32***126",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "BHD",
    * "method": "DebitCard",
    * "order_amount": "222",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023"
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# STCPAY

How to use STCPAY to submit a payin in Bahrain.

## Payin by STCPAY

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by STCPAY in Bahrain.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: STCPAY</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- limit unknown -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>BHD</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>customer.identify.type<mark style="color:red;">*</mark></td><td>string</td><td>User's identification type<br>- Fixed value: CPR -</td></tr><tr><td>customer.identify.number<mark style="color:red;">*</mark></td><td>string</td><td><p>User's identification number</p><p>- 9 digits -</p></td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "UnR****ceB3aD",
    "trade_no": "202****18",
    "out_trade_no": "out_t****00",
    "web_url": "",
    "pay_url": "https://api.stcpay.com.bh/StcpayCheckout/***",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "BHD",
    * "method": "STCPAY",
    * "order_amount": "2",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023",
    * "customer": {
    *     "identify": {
    *         "type": "CPR",
    *         "number": "9***28"
          }
      }
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Bangladesh

Bangladesh methods for API direct payment


# Bkash

How to use Bkash to submit a payin in Bangladesh.

## Payin by Bkash

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Bkash in Bangladesh.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Bkash                                                   |
| channel<mark style="color:red;">\*</mark>         | string | Fixed value: AssanPayBD                                              |
| region<mark style="color:red;">\*</mark>          | string | Fixed value: BGD                                                     |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 50 \~ 50,000.00 -</p>                         |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: BDT                                                     |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |

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

```
{
    "msg": "Success",
    "code": "10000",
    "prepay_id": "ZWloZXU4Y**0F173",
    "trade_no": "2024112710040502055",
    "out_trade_no": "out_tra***900",
    "pay_url":"https://payment.bkash.com/?paymentId=T********",
    "trade_status": "PROCESSING",
    "expired": "2026-01-05 09:05:22.359650599 +0000 UTC"
}

```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "out_tra***900",
    * "method": "Bkash",
    * "channel": "AssanPayBD",
    * "region": "BGD",
    * "order_amount": "123.55",
    * "order_currency": "BDT",
    * "subject": "trade pay test",
      "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01"
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Nagad

How to use Nagad to submit a payin in Bangladesh.

## Payin by Nagad

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Nagad in Bangladesh.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Nagad                                                   |
| channel<mark style="color:red;">\*</mark>         | string | Fixed value: AssanPayBD                                              |
| region<mark style="color:red;">\*</mark>          | string | Fixed value: BGD                                                     |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 50 \~ 50,000.00 -</p>                         |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: BDT                                                     |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |

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

```
{
    "msg": "Success",
    "code": "10000",
    "prepay_id": "ZWloZXU4Y**0F173",
    "trade_no": "2024112710040502055",
    "out_trade_no": "out_tra***900",
    "pay_url":"https://payment.mynagad.com:300*****WU2Yw==",
    "trade_status": "PROCESSING",
    "expired": "2026-01-05 09:05:22.359650599 +0000 UTC"
}

```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "out_tra***900",
    * "method": "Nagad",
    * "channel": "AssanPayBD",
    * "region": "BGD",
    * "order_amount": "123.55",
    * "order_currency": "BDT",
    * "subject": "trade pay test",
      "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01"
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Brazil

Brazil methods for API direct payment


# Credit Card

How to use CreditCard to submit a payin in Brazil.

Use the following server-side flow to submit a Credit Card payment in Brazil:

1. Tokenize the card details.
2. Submit the payment using the returned card token.
3. If 3DS verification is required, redirect the customer to the returned `check_url`.

### Step 1: Tokenize the card

Send the card details to Pagsmile and obtain a temporary card token.

#### Endpoint

<mark style="color:green;">`POST`</mark> `https://security-test.pagsmile.com/card/tokenize`

#### Request body

<table><thead><tr><th width="206.5234375">Parameter</th><th>Type</th><th width="87.32421875">Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>Yes</td><td>Maximum 32 characters.</td><td>Merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>version</code></td><td>string</td><td>No</td><td>Fixed value: <code>2.0</code>; defaults to <code>2.0</code> when omitted.</td><td>API version.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Yes</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; maximum 19 characters.</td><td>Time at which the request is sent.</td></tr><tr><td><code>card.card_no</code></td><td>string</td><td>Yes</td><td>Maximum 32 characters.</td><td>Card number.</td></tr><tr><td><code>card.issuer</code></td><td>string</td><td>Yes</td><td>For example, <code>visa</code> or <code>mastercard</code>.</td><td>Card brand.</td></tr><tr><td><code>card.holder.name</code></td><td>string</td><td>Yes</td><td>Maximum 64 characters.</td><td>Name printed on the card.</td></tr><tr><td><code>card.cvv</code></td><td>string</td><td>Yes</td><td>Maximum 8 characters.</td><td>Card security code. Never store this value.</td></tr><tr><td><code>card.valid_thru_year</code></td><td>string</td><td>Yes</td><td>Four digits in <code>YYYY</code> format.</td><td>Card expiration year.</td></tr><tr><td><code>card.valid_thru_month</code></td><td>string</td><td>Yes</td><td>Two digits from <code>01</code> to <code>12</code>.</td><td>Card expiration month.</td></tr></tbody></table>

#### Request example

```json
{
  "app_id": "161***24",
  "version": "2.0",
  "timestamp": "2026-08-14 13:18:10",
  "card": {
    "card_no": "4****9",
    "issuer": "visa",
    "holder": {
      "name": "****"
    },
    "cvv": "111",
    "valid_thru_year": "2030",
    "valid_thru_month": "10"
  }
}
```

#### Response example

```json
{
  "code": "10000",
  "msg": "Success",
  "token": "psct_5a****de"
}
```

{% hint style="info" %}
The card token expires one hour after it is created. Use it promptly when submitting the payment.&#x20;
{% endhint %}

### Step 2: Submit the payment

Use the token returned in Step 1 to create and process the Credit Card payment.

#### Endpoint

<mark style="color:green;">`POST`</mark>`https://gateway-test.pagsmile.com/trade/pay`

#### Request body

<table><thead><tr><th width="161.765625">Parameter</th><th width="99.7109375">Type</th><th>Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>Yes</td><td>Maximum 32 characters. Must match the application used to generate the card token.</td><td>Merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>version</code></td><td>string</td><td>No</td><td>Fixed value: <code>2.0</code>; defaults to <code>2.0</code> when omitted.</td><td>API version.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Yes</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; maximum 19 characters.</td><td>Time at which the request is sent.</td></tr><tr><td><code>out_trade_no</code></td><td>string</td><td>Yes</td><td>Maximum 64 characters; must be unique for the merchant application.</td><td>Merchant order number.</td></tr><tr><td><code>method</code></td><td>string</td><td>Yes</td><td>Fixed value: <code>CreditCard</code>.</td><td>Payment method.</td></tr><tr><td><code>trade_type</code></td><td>string</td><td>Yes</td><td>Fixed value: <code>API</code>.</td><td>Indicates a direct API payment.</td></tr><tr><td><code>order_amount</code></td><td>decimal</td><td>Yes</td><td>From <code>0.01</code> to <code>50000.00</code>; maximum two decimal places.</td><td>Payment amount.</td></tr><tr><td><code>order_currency</code></td><td>string</td><td>Yes</td><td>Fixed value: <code>BRL</code>.</td><td>Payment currency.</td></tr><tr><td><code>subject</code></td><td>string</td><td>Yes</td><td>Maximum 128 characters.</td><td>Payment subject or order title.</td></tr><tr><td><code>content</code></td><td>string</td><td>No</td><td>Maximum 255 characters.</td><td>Payment description.</td></tr><tr><td><code>notify_url</code></td><td>string</td><td>Yes</td><td>Must be a valid URL. HTTPS is recommended.</td><td>Endpoint that receives asynchronous payment notifications.</td></tr><tr><td><code>return_url</code></td><td>string</td><td>No</td><td>Must be a valid URL. HTTPS is recommended.</td><td>URL to which the customer is redirected after completing the payment flow.</td></tr><tr><td><code>buyer_id</code></td><td>string</td><td>Yes</td><td>Maximum 128 characters.</td><td>Merchant-side customer ID.</td></tr><tr><td><code>timeout_express</code></td><td>string</td><td>No</td><td>Supports <code>m</code> (minutes), <code>h</code> (hours), <code>d</code> (days), and <code>c</code> (end of the current day). The default is <code>90m</code> and the maximum is <code>15d</code>.</td><td>Time allowed for the payment to move from the initial state to processing.</td></tr><tr><td><code>token</code></td><td>string</td><td>Yes</td><td>Must be the unexpired <code>psct_</code> token returned in Step 1.</td><td>Tokenized card details.</td></tr><tr><td><code>user_ip</code></td><td>string</td><td>Yes</td><td>Valid public IPv4 or IPv6 address.</td><td>Customer IP address used for risk assessment.</td></tr><tr><td><code>installments</code></td><td>string</td><td>No</td><td>Positive integer represented as a string; defaults to <code>1</code>. Available values depend on the merchant and channel configuration.</td><td>Number of installments.</td></tr><tr><td><code>issuer</code></td><td>string</td><td>Yes</td><td>Must match the card brand, for example <code>visa</code> or <code>mastercard</code>.</td><td>Card brand.</td></tr></tbody></table>

#### Request example

```json
{
  "app_id": "16***4",
  "timestamp": "2026-08-14 14:21:25",
  "out_trade_no": "out_tr***58",
  "method": "CreditCard",
  "order_amount": "0.11",
  "order_currency": "BRL",
  "subject": "descriptor-PAGSMIL*Hype games",
  "content": "trade pay content",
  "trade_type": "API",
  "notify_url": "http://demo.gemini-tiger.cn/callback/success",
  "return_url": "https://www.xcloudgame.com/",
  "buyer_id": "111222",
  "timeout_express": "1c",
  "token": "psct_5a7***de",
  "user_ip": "8.29.109.148",
  "installments": "1",
  "issuer": "visa"
}
```

#### Response example

```json
{
  "code": "10000",
  "msg": "Success",
  "prepay_id": "VD****B8",
  "trade_no": "202***56",
  "out_trade_no": "out_t***58",
  "pay_url": "",
  "trade_status": "RISK_CONTROLLING",
  "check_url": "https://checkout-test.pagsmile.com/public/redirect/3ds-direct?prepay_id=b0***6e9&token=psct_c1****39"
}
```

### Complete 3DS verification

When `trade_status` is `RISK_CONTROLLING` and `check_url` is returned:

1. Redirect the customer's browser to the complete `check_url` returned by Pagsmile.
2. Do not construct or modify the URL or its query parameters.
3. Allow the customer to complete the 3DS challenge or verification flow.
4. Use the payment notification or the Payin Detail API to determine the final payment status.


# Credit Card Pre Auth

How to use CreditCard to submit a payin in Brazil.

## Payin by CreditCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by CreditCard in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CreditCard</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- 0.01~50,000 BRL -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: BRL</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>trade_type<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: API</td></tr><tr><td>timeout_express</td><td>string</td><td><p>m(minutes), h(hours), d(days), c(always end in current day).</p><p>Used to control the expiration time of <strong>submitting</strong> an order (from initial to processing). (90m in default, max 15d)</p></td></tr><tr><td>customer.name<mark style="color:red;">*</mark></td><td>string</td><td>User's name</td></tr><tr><td>customer.email<mark style="color:red;">*</mark></td><td>string</td><td>User's email</td></tr><tr><td>customer.phone<mark style="color:red;">*</mark></td><td>string</td><td>User's phone</td></tr><tr><td>customer.identify.type<mark style="color:red;">*</mark></td><td>string</td><td><p>User's identification type</p><p>- CPF or CNPJ -</p></td></tr><tr><td>customer.identify.number<mark style="color:red;">*</mark></td><td>string</td><td><p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p></td></tr><tr><td>address.zip_code<mark style="color:red;">*</mark></td><td>string</td><td>billing zip code</td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "out***300",
    "trade_no": "20240***34",
    "prepay_id": "UloyV0l3NFFyW***DTT0=-645a8F4c"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Step 1:** Get the "prepay\_id" from the API response. Each transaction should create a unique prepay\_id.

**Step 2:** Follow the step [here](/reference/payin/submit-a-payin/brazil/creditcardpreauth/pagsmile-javascript#step-1-include-pagsmile-script) to add the Pagsmile JavaScript library.

**Step 3:** Follow the step [here ](/reference/payin/submit-a-payin/brazil/creditcardpreauth/pagsmile-javascript#step-3-handle-payment-form-submission)to submit the payment form.
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "BRL",
    * "method": "CreditCard",
    * "order_amount": "1",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "trade_type": "API",
      "timeout_express": "15d",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023",
    * "version": "2.0",
    * "customer" : {
    * "identify": {
    *     "type": "CPF",
    *     "number": "39***826"
      },
    *     "name": "Test name",
    *     "email": "Test name@gmail.com",
    *     "phone": "119***21"
      }
    * "address": {
    *         "zip_code":"01001000"
          }
      }
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## 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)


# Capture

How to capture an authorization.

## Capture Authorization

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/capture`

This endpoint allows you to capture an authorization.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                             | Type   | Description                                                          |
| ------------------------------------------------ | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>        | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| timestamp<mark style="color:red;">\*</mark>      | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| version                                          | string | fixed value: 2.0                                                     |
| amount<mark style="color:red;">\*</mark>         | string |                                                                      |
| currency<mark style="color:red;">\*</mark>       | string |                                                                      |
| out\_trade\_no<mark style="color:red;">\*</mark> | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |

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

```json
{
    "msg": "Success",
    "code": "10000"
}
```

{% endtab %}

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

```json
{
    "code":"40002",
    "msg":"Business Failed",
    "sub_code":"invalid-signature",
    "sub_msg":"invalid signature"
}
```

{% endtab %}
{% endtabs %}

### Example

```
curl --location --request POST 'https://security-test.pagsmile.com/trade/capture' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "1617***052",
    "timestamp": "2022-08-11 10:26:03",
    "version": "2.0",
    "amount": "90",
    "currency": "brl",
    "out_trade_no": "out_18***1300"
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Void

How to void an authorization.

{% hint style="info" %}
An authorization can be voided before it is captured if the payment is no longer needed.
{% endhint %}

## Void Authorization

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/void`

This endpoint allows you to void an authorization.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                             | Type   | Description                                                                                                                 |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>        | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                |
| timestamp<mark style="color:red;">\*</mark>      | string | <p>yyyy-MM-dd HH<span data-gb-custom-inline data-tag="emoji" data-code="1f1f2-1f1f2">🇲🇲</span>ss<br>- Max. 19 chars -</p> |
| version                                          | string | fixed value: 2.0                                                                                                            |
| out\_trade\_no<mark style="color:red;">\*</mark> | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                        |

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

```json
{
    "msg": "Success",
    "code": "10000"
}
```

{% endtab %}

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

```json
{
    "msg": "Business Failed",
    "code": "40002"
}
```

{% endtab %}
{% endtabs %}

### Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/void' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "1617****052",
    "timestamp": "2022-08-11 16:17:36",
    "version": "2.0",
    "out_trade_no": "836***93"
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Pagsmile JavaScript

Updated on 2024.9.19

## Pagsmile Payment Gateway Integration Guide

This guide provides step-by-step instructions for integrating Pagsmile into your website for seamless payment processing. Pagsmile offers robust features and security measures to ensure smooth transactions for your customers.

### Prerequisites

1. **Pagsmile Account**: Ensure you have signed up for a Pagsmile account. You will need your `app_id` and `public_key` provided by Pagsmile.
2. **Environment**: Access to your website's HTML and JavaScript files for integration.

### Step 1: Include Pagsmile Script

Add the Pagsmile JavaScript library to the `<head>` section of your HTML file. This script is necessary to initialize and interact with the Pagsmile API.

```html
<head>
  <!-- Other head content -->
  <script src="https://res.pagsmile.com/lib/js/pagsmile.min.js"></script>
</head>
```

### Step 2: Initialize Pagsmile

After the page loads and the Pagsmile script has loaded, initialize Pagsmile with your credentials (`app_id` and `public_key`) other mandatory parameters. This step prepares Pagsmile for handling payment transactions securely.

### Step 3: Handle Payment Form Submission

Use createOrder method of returned clientinstance and initialize payment upon user submission. Check [Brazil](/reference/payin/submit-a-payin/brazil/creditcard), [Europe](/reference/payin/submit-a-payin/europe/creditcard), or [North America](/reference/payin/submit-a-payin/north-america/creditcard). Once you get <mark style="background-color:yellow;">status: "success"</mark> query transaction status with help of related backend endpoints.

#### *setPublishableKey* Optional Parameters

**pre\_auth**: `boolean` (required) Set to `true` to enable pre-authorization for payments.

**form\_id**: `string` (conditional) The ID of the form element to be used for payment processing.

#### *createOrder* Optional Parameters

**installments**: `object` (optional) parameter should be provided if there is installment information is returned by [Installment Detail Query](https://docs.pagsmile.com/payin/tools/installment-detail-query) endpoint.

**address**: `Object` (optional) An optional address object that specifies the country associated with the payment.

* **country\_code**: `string` (optional) A 3-letter ISO country code that specifies the country associated with the payment (e.g., `"SWE"` for Sweden). If not provided, this field will be omitted.

```
createOrder({ 
   installments: { stage: 3 }, //stage support 1 ~ 12
   address: { country_code: "SWE"} 
}) 
```

```html
<script>
  document.addEventListener('DOMContentLoaded', function() {
    Pagsmile.setPublishableKey({
      app_id: "1649*********8673",
      public_key: "Pagsmile_pk_86fc***************************************************",
      env: "sandbox", // Change to "production" in live environment
      region_code: "BRA", //BRA for Brazil
      prepay_id: "cjExNDB5dUZhK1lkLzgzMjhSUkpFdk13YVloaEZ5T09OVG5WdEcxdmNIaz0=-06168a6c",
      fields: {
         card_name: {
             id_selector: "card holder name",
          },
          card_number: {
            id_selector: "card number",
          },
          expiration_month: {
            id_selector: "exp month",
          },
          expiration_year: {
            id_selector: "exp year",
          },
          cvv: {
            id_selector: "card cvv",
          },
      },
    }).then((clientInstance) => {
          // successfully initiated
          document.getElementById("submit-pay").addEventListener("click", function (e) {
            clientInstance
              .createOrder()
              .then((res) => {
                console.log("res: ", res); 
                // {
                //   status: "success",
                //   query: true,       // query transaction status through API endpoint /trade/query
                // }
              })
              .catch((err) => {
                console.log("Error: ", err);
              });
          });
        })   
    .catch((err) => {
      console.log("Initializing Pagsmile Error: ", err);
    });
  });
</script>
```

### Step 4: Testing and Deployment

1. **Sandbox Mode**: During development and testing, use `env: "sandbox"`. Verify that payments process correctly and error handling works as expected.
2. **Production Mode**: Before deploying to production, change the `env` setting to `"prod"`.


# Pix

How to use Pix to submit a payin in Brazil.

## Payin by Pix

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Pix in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                         |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                        |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: PIX                                                                    |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                            |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                     |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                        |
| content                                                    | string | <p>payment reason detail or item detail.</p><p>- Max. 255 chars -</p>               |
| order\_amount<mark style="color:red;">\*</mark>            | string | payment amount. Per-transaction and monthly limit: Min 0.1, Max 50,000 BRL.         |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BRL                                                                    |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                  |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                         |
| customer.email                                             | string | User's email                                                                        |
| customer.phone                                             | string | User's phone                                                                        |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                             |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p> |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "pay_url": "https://checkout.pagsmile.com/checkout?prepay_id=TTd5Y1JJbDhKbi9Rd1NPNkZTUVIyNGNsOEFyRWZ4SWw1czd2UE00bmszOD0=-79697e50",
    "trade_status": "PROCESSING",
    "qr_code": "00020126580014br.gov.bcb.pix013627a44d0a-0736-4bbf-a4a4-6e11063973315204000053039865406100.005802BR5908PAGSMILE6008So Paulo62230519mpqrinter123742074363049E0B",
    "qr_code_url": "https://gateway.pagsmile.com/api/trade/qrcode-img?prepay_id=Y1N5dHVPOFJ4Ky9lZVVKVXBrdFFieWttVlhwSGZWMnJYRXBkWW9OaE8wRT0=-9036acF1",
    "qr_code_img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADIAQAAAACFI5MzAAACwUlEQVR42u2XPc7jIBCGx6Kgsy+AxDXouFJyAf9cIL4SHdewxAXsjgJ59p2sFPsrtlhodqVEkQs/UcDz8zAm/tOHvuRL/hkSqOM0O375tLttiES6gUQ+ouky76RWpoe2uNNA6IkbntdQiNKpTddIglpyOr3ibHrfTDKf3s5kd+KVGwliUKasFjYT4wl+RudvCfITzfP6/sjcXxN88jY6i3UelN6LNJBAD8JOcVXMZaT08g0kq5cncrzm8gyld6qJBLtkM2q7e1SiGeKVnxqSFbY8ZPtyW68RA+p1Awlbxxa1c8T0Dqrdm4g6tV0RV512jXDa2TcQ5pm2Ea0mG8c6/KnEGpKRYYW9P6hIwjOvLQQyIJoQ1IAtl1Gro4VEmoLdYT69PXxa81U7NQT7deLRI0gM0HNDbCAiA6wAKxsxn6OBWwjvkpx0hHRw6aK9YlBBsl3f5ns5XvImBe4bSICcTMdqFh+YZ7hFp4JAn0Ht6BLxMfqvNBE4Xm7ApsgzbiNFDSRvKEO4Cu37ZBR1uUxRQcJG2r7PH6xjukBjE+FTo5ztEjco4dQ40BpI5vcxa6Vxc3m4W+1UEDY9mQE5l14po1OXqyoIKpqxcRyzcsV88cl2DWFp3En6WHpuDTcnVpDIs5eEwwq7Q6rhrQbC+G8FuzA6OIpE1yaidpcWZIkhPzl/Zt1AcnoRH4wr+gM/KR9X1RBG725w1RLTu3Zu9q8gQbp29HYJCG3p/W12qSDy9DRxQmhhwdnfqqqG4Nw2MosFaC8tIX1msRqCo0wGOiJSJ85Got43EIHmt6vkFNJlbCGYYQOOa2gASoBTb1NaBcF8DX3CVQwxpx+OryF4k8BOZfY/3TYFerYShVkMj35keQP7OL6WWARywDjAmGSvab2KYDZRiCXiitqZ8eYUG4jkR2pniHCVIXSJbiDfN/4v+T/JL/qJUR2nh9cdAAAAAElFTkSuQmCC"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Users only need to scan the QR code to finish the payment. QR code can be generated with **qr\_code** value.
* Add a Copy QRCODE button. For mobile users, they can copy the string of **qr\_code** and paste it into their wallet app to finish the payment. Adding a copy button could help to improve the user's payment experience.
* **qr\_code\_url** and **qr\_code\_img** are system generated images of qr code which can be used directly on merchant website depending on needs.
  {% endhint %}

![Example of payment page](https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FJyhp2nD0UJOaHuzWaZp8%2Fimage.png?alt=media\&token=f7f7b183-81b4-406a-b903-e92007083bc0)

## Example of API Request

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354002",
    * "method": "PIX",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer" : {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## 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)


# Recurring Pix

How to use Recurring Pix to submit a payin in Brazil.

## Payin by Recurring Pix

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/recurring`

This endpoint allows you to submit a payin by Recurring Pix in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                                                                                     |
| ---------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                                    |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: PIX                                                                                                                                                                |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                            |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                                                                                        |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                                 |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                                    |
| content                                                    | string | <p>payment reason detail or item detail.</p><p>- Max. 255 chars -</p>                                                                                                           |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 0.1\~50,000 BRL -</p>                                                                                                                                    |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BRL                                                                                                                                                                |
| trade\_type<mark style="color:red;">\*</mark>              | string | Fixed value: API                                                                                                                                                                |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                                                                                              |
| interval<mark style="color:red;">\*</mark>                 | string | <p>W(week), M(month, only support 1M, 3M & 6M), Y(year)<br>- Default value: 1M -</p>                                                                                            |
| quantity<mark style="color:red;">\*</mark>                 | string | <p>Quantity of recurring<br>- No maximum limit. Default value: 0, means infinite quantity -</p>                                                                                 |
| timeout\_express<mark style="color:red;">\*</mark>         | string | <p>m(minutes), h(hours), d(days), c(always end in current day).</p><p>Used to control the expiration time of <strong>submitting</strong> an order (90m in default, max 15d)</p> |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                                                                                     |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                                                                                                                         |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p>                                                                                             |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354003",
    "web_url": "https://checkout.pagsmile.com?prepay_id=ZHJjd***29&return_url=https://pagsmile.com/zh/",
    "qr_code": "00020***04E03C",
    "prepay_id": "ZHJj***229"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}

* **Cancel Recurring PIX:** Use this [API ](/reference/payin/recurring-payment#cancel-recurring-payment)to cancel a recurring PIX order.
* **IPN Notification/Callback:** The callback of a recurring PIX payment is different from the callback of a regular PIX payment. Check the [Recurring Notification](/reference/payin/recurring-payment/notification) page.
  {% endhint %}

## Example of API Request

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/recurring' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354002",
    * "method": "PIX",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "trade_type": "API",
    * "interval": "1W",
    * "quantity": "3",
    * "timeout_express": "10900m",
    * "customer": {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          },
    *     "name": "Test User Name"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## 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)


# PIX Biometria

How to use Pix Biometria to submit a payin in Brazil.

## Payin by Pix Biometria

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Pix Biometria in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                         |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                        |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: PIXBiometria                                                           |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                            |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                             |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p> |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                     |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                        |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 0.1\~50,000 BRL -</p>                                        |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BRL                                                                    |
| content                                                    | string | <p>payment reason detail or item detail.</p><p>- Max. 255 chars -</p>               |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                  |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                              |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "pay_url": "https://checkout.******",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Redirect users to the pay\_url to complete payment.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354002",
    * "method": "PIXBiometria",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          }
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## 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)


# Static Pix

How to use Static Pix to submit a payin in Brazil.

## Payin by Static Pix

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Static Pix in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                                                 |
| ------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: PIX                                                                                                            |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                        |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                                                    |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                             |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 0.1\~50,000 BRL -</p>                                                                                |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: BRL                                                                                                            |
| content                                           | string | <p>payment reason detail or item detail.</p><p>- Max. 255 chars -</p>                                                       |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                                          |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                                        |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout                                                                      |
| cancellation\_express                             | string | <p>m(minutes), h(hours), d(days).<br>The value must be an integer. Ex: 90m<br>Used to control the expiration of QR code</p> |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "pay_url": "https://checkout.pagsmile.com/checkout?prepay_id=TTd5Y1JJbDhKbi9Rd1NPNkZTUVIyNGNsOEFyRWZ4SWw1czd2UE00bmszOD0=-79697e50",
    "trade_status": "PROCESSING",
    "qr_code": "00020126580014br.gov.bcb.pix013627a44d0a-0736-4bbf-a4a4-6e11063973315204000053039865406100.005802BR5908PAGSMILE6008So Paulo62230519mpqrinter123742074363049E0B",
    "qr_code_url": "https://gateway.pagsmile.com/api/trade/qrcode-img?prepay_id=Y1N5dHVPOFJ4Ky9lZVVKVXBrdFFieWttVlhwSGZWMnJYRXBkWW9OaE8wRT0=-9036acF1",
    "qr_code_img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADIAQAAAACFI5MzAAACwUlEQVR42u2XPc7jIBCGx6Kgsy+AxDXouFJyAf9cIL4SHdewxAXsjgJ59p2sFPsrtlhodqVEkQs/UcDz8zAm/tOHvuRL/hkSqOM0O375tLttiES6gUQ+ouky76RWpoe2uNNA6IkbntdQiNKpTddIglpyOr3ibHrfTDKf3s5kd+KVGwliUKasFjYT4wl+RudvCfITzfP6/sjcXxN88jY6i3UelN6LNJBAD8JOcVXMZaT08g0kq5cncrzm8gyld6qJBLtkM2q7e1SiGeKVnxqSFbY8ZPtyW68RA+p1Awlbxxa1c8T0Dqrdm4g6tV0RV512jXDa2TcQ5pm2Ea0mG8c6/KnEGpKRYYW9P6hIwjOvLQQyIJoQ1IAtl1Gro4VEmoLdYT69PXxa81U7NQT7deLRI0gM0HNDbCAiA6wAKxsxn6OBWwjvkpx0hHRw6aK9YlBBsl3f5ns5XvImBe4bSICcTMdqFh+YZ7hFp4JAn0Ht6BLxMfqvNBE4Xm7ApsgzbiNFDSRvKEO4Cu37ZBR1uUxRQcJG2r7PH6xjukBjE+FTo5ztEjco4dQ40BpI5vcxa6Vxc3m4W+1UEDY9mQE5l14po1OXqyoIKpqxcRyzcsV88cl2DWFp3En6WHpuDTcnVpDIs5eEwwq7Q6rhrQbC+G8FuzA6OIpE1yaidpcWZIkhPzl/Zt1AcnoRH4wr+gM/KR9X1RBG725w1RLTu3Zu9q8gQbp29HYJCG3p/W12qSDy9DRxQmhhwdnfqqqG4Nw2MosFaC8tIX1msRqCo0wGOiJSJ85Got43EIHmt6vkFNJlbCGYYQOOa2gASoBTb1NaBcF8DX3CVQwxpx+OryF4k8BOZfY/3TYFerYShVkMj35keQP7OL6WWARywDjAmGSvab2KYDZRiCXiitqZ8eYUG4jkR2pniHCVIXSJbiDfN/4v+T/JL/qJUR2nh9cdAAAAAElFTkSuQmCC"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Users only need to scan the QR code to finish the payment. QR code can be generated with **qr\_code** value.
* Add a Copy QRCODE button. For mobile users, they can copy the string of **qr\_code** and paste it into their wallet app to finish the payment. Adding a copy button could help to improve the user's payment experience.
* **qr\_code\_url** and **qr\_code\_img** are system generated images of qr code which can be used directly on merchant website depending on needs.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354002",
    * "method": "PIX",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01"
      }'
```

![Example of payment page](https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FJyhp2nD0UJOaHuzWaZp8%2Fimage.png?alt=media\&token=f7f7b183-81b4-406a-b903-e92007083bc0)

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Virtual PIX

How to use virtual PIX account to submit a payin in Brazil.

## Overviews

1. You collect the following customer details:

   A. Your customer's user\_id on your platform.

   B. Your customer's name and email (Optional).

   C. Your customer's identity (Optional).
2. You make a virtual pix account create request with the customer's details. Check [API](/reference/payin/submit-a-payin/brazil/virtual-pix/create).
3. Persist the virtual pix qr code and account id in your database, and inform customer the qr code.
4. This qr code has no expiration date, user can scan this qr code to make payment anytime.
5. Pagsmile will receive a notification from the bank, after the payment is successful.
6. Then you will receive a notification from pagsmile with the account id. Check [here](/reference/payin/submit-a-payin/brazil/virtual-pix/notification).


# Create Virtual PIX Account

How to create virtual PIX account to submit a payin in Brazil.

## Payin by Virtual Pix

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/virtual-account/create`

This endpoint allows you to create virtual PIX account number in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                 | Type   | Description                                                                         |
| ---------------------------------------------------- | ------ | ----------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>            | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                        |
| timestamp<mark style="color:red;">\*</mark>          | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                     |
| notify\_url<mark style="color:red;">\*</mark>        | string | Where Pagsmile will send notification to                                            |
| customer.buyer\_id<mark style="color:red;">\*</mark> | string | User's buyer id                                                                     |
| customer.name                                        | string | User's name                                                                         |
| customer.email                                       | string | User's email                                                                        |
| customer.identify.type                               | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                             |
| customer.identify.number                             | string | <p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p> |

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

```
{
    "code": "10000",
    "msg": "Success",
    "account_id": "QG9MAQFPLTT0BTY0",
    "buyer_id": "buyer_0101_0001",
    "status": "ACTIVE",
    "notify_url": "http://merchant/callback/success",
    "qr_code": "00020126580014br.gov.bcb.pix013627a44d0a-0736-4bbf-a4a4-6e11063973315204000053039865406100.005802BR5908PAGSMILE6008So Paulo62230519mpqrinter123742074363049E0B"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Users only need to scan the QR code to finish the payment. QR code can be generated with **qr\_code** value.
* Add a Copy QRCODE button. For mobile users, they can copy the string of **qr\_code** and paste it into their wallet app to finish the payment. Adding a copy button could help to improve the user's payment experience.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/virtual-account/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "timestamp": "2022-01-01 03:54:01",
    * "notify_url": "http://merchant/callback/success",
    * "customer" : {
    *     "buyer_id": "buyer_0101_0001",
          "name": "Test User Name",
          "email": "test@pagsmile.com",
          "identify": {
              "type": "CPF",
              "number": "11032341882"
          }
      }
      }'
```

![Example of payment page](https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FJyhp2nD0UJOaHuzWaZp8%2Fimage.png?alt=media\&token=f7f7b183-81b4-406a-b903-e92007083bc0)

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Query Virtual PIX Account

How to query PIX account number.

## Payin by Virtual Pix

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/virtual-account/query`

This endpoint allows you to query virtual PIX account number.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                          | Type   | Description                                                                          |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>     | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                         |
| timestamp<mark style="color:red;">\*</mark>   | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                      |
| account\_id<mark style="color:red;">\*</mark> | string | account id get from [api](/reference/payin/submit-a-payin/brazil/virtual-pix/create) |

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

```
{
    "code": "10000",
    "msg": "Success",
    "account_id": "QG9MAQFPLTT0BTY0"
    "buyer_id": "buyer_0101_0001",
    "status": "ACTIVE",
    "notify_url": "http://merchant/callback/success",
    "qr_code": "00020126580014br.gov.bcb.pix013627a44d0a-0736-4bbf-a4a4-6e11063973315204000053039865406100.005802BR5908PAGSMILE6008So Paulo62230519mpqrinter123742074363049E0B"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Users only need to scan the QR code to finish the payment. QR code can be generated with **qr\_code** value.
* Add a Copy QRCODE button. For mobile users, they can copy the string of **qr\_code** and paste it into their wallet app to finish the payment. Adding a copy button could help to improve the user's payment experience.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/virtual-account/query' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "timestamp": "2022-01-01 03:54:01",
    * "notify_url": "http://merchant/callback/success",
    * "account_id": "QG9MAQFPLTT0BTY0"
      }'
```

![Example of payment page](https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FJyhp2nD0UJOaHuzWaZp8%2Fimage.png?alt=media\&token=f7f7b183-81b4-406a-b903-e92007083bc0)

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Notification of Virtual PIX Account Payment

Notification of virtual PIX account payments

{% hint style="info" %}
Notification of virtual account payment follows the same rule as notification of other payment methods. The only difference is the "**transfer\_account**" part. Check [here](/reference/payin/notification) to view the general rules of notification.
{% endhint %}

## Example

```
curl --location --request POST 'http://merchant/callback/success' \\merchant's notify_url
--header 'Pagsmile-Signature: t=1645516741, v2=f6e345eca80d74c470ba456b7b559046f22b49fcaad9b81938ff1488b0f497ac' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "amount": "50.00",
    * "out_trade_no": "202201010354002",
    * "method": "PIX",
    * "trade_status": "SUCCESS",
    * "trade_no": "2022022201111100011",
    * "currency": "BRL",
    * "app_id": "162************38",
    * "user": {
    *     "buyer_id": "buyer_0101_0001",
          "email": "test@pagsmile.com",
          "identify": { //Same as identification.
              "number": "11032341882",
              "type": "CPF"
          },
          "identification": {
	      "number": "11032341882",
	      "type": "CPF"
	  },
          "ip": "0.0.0.0",
          "name": "test user name"
      },
      "payer": { 
          "account": {
	      "number": "",
	      "type": ""
	  },
	  "identification": {
	      "number": "",
	      "type": ""
	  },
	  "username": "",
	  "bank": {
	      "agency": "",
	      "bank_id": "",
	      "bank_name": ""
	  }
      },
    * "timestamp": "1645516741",
    * "transfer_account": {
    *     "account_id": "DP8F********ME4T",
    *     "qr_code": "00020126580014br.gov.bcb.pix013627a44d0a-0736-4bbf-a4a4-6e11063973315204000053039865406100.005802BR5908PAGSMILE6008So Paulo62230519mpqrinter123742074363049E0B",
    *     "transfer_timestamp": 1645516741
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# OpenFinance

How to use OpenFinance to submit a payin in Brazil.

## Payin by OpenFinance

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by OpenFinance in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                |
| ---------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                               |
| customer.phone                                             | string | User's phone                                                                                               |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                               |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 11 digits if CPF (CNPJ <strong>NOT</strong> support)-</p>          |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: OpenFinance                                                                                   |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                       |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                   |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CPF (CNPJ <strong>NOT</strong> support) -</p>                        |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                            |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                               |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 0.1 \~ 20,000 BRL -</p>                                                             |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BRL                                                                                           |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                         |
| address.zip\_code                                          | string | zip code                                                                                                   |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                       |
| address.street                                             | string | street                                                                                                     |
| address.street\_number                                     | string | street number                                                                                              |
| address.city                                               | string | city                                                                                                       |
| address.state                                              | string | state                                                                                                      |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                     |
| bank<mark style="color:red;">\*</mark>                     | string | Use [API](/reference/payin/tools/supported-bank-list-query) to get bank id                                 |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022021810560500094",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "pay_url": "https://nuapp.nubank.com.br/open-banking/authorize?client_id=",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* **pay\_url** is the bank URL which can redirect users to the bank mobile app or bank web.
* CNPJ is not supported.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "OpenFinance",
    * "bank": "75e2b9f4-4f60-4d07-916c-fde1163d43bc",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## 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;">**Java:**</mark> [<mark style="color:blue;">https://github.com/LuisGuadagnin/cpf-cnpj-handler</mark>](https://github.com/LuisGuadagnin/cpf-cnpj-handler)
* <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)


# Lottery

How to use Lottery to submit a payin in Brazil.

## Payin by Lottery

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Lottery in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                                                                                                     |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                                                    |
| customer.phone                                             | string | User's phone                                                                                                                                                                                    |
| customer.email                                             | string | User's email                                                                                                                                                                                    |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- 11 digits if CPF or 14 digits if CNPJ -</p>                                                                                                                |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Lottery                                                                                                                                                                            |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                                            |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                                                                                                        |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                                                                                                                                         |
| customer.name<mark style="color:red;">\*</mark>            | string | <p>User's name</p><p>- Max. 40 chars -</p>                                                                                                                                                      |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                                                 |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                                                    |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 4\~2000 BRL -</p>                                                                                                                                                        |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BRL                                                                                                                                                                                |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p>                                                                                      |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                                                                                                              |
| address.zip\_code                                          | string | zip code                                                                                                                                                                                        |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                                                                                                            |
| address.street                                             | string | street                                                                                                                                                                                          |
| address.street\_number                                     | string | street number                                                                                                                                                                                   |
| address.city                                               | string | city                                                                                                                                                                                            |
| address.state                                              | string | state                                                                                                                                                                                           |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                                                                                                          |
| cancellation\_express                                      | string | <p>m(minutes), h(hours), d(days).<br>The value must be an integer. Ex: 90m<br>The value must be larger than timeout\_express.</p><p>Used to control the expiration time of lottery voucher.</p> |
| timeout\_express                                           | string | Used to control the expiration time of **submitting** an order (from initial to processing). (90m in default, max 15d)                                                                          |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010106532400030",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "barcode": "10499647359216218774123156548721787200000011649",
    "bank_no": "10850221",
    "pay_url": "https://checkout-testv2.pagsmile.com/checkout?prepay_id=T3c0bUM5VDdQc1M4MThjeDlEVHBiZG5yNEc4V0hBZ3pEMlY2d3A0N2F6UT0=-B20807a4",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Users only need to use the value of **bank\_no** to finish payment at loterica store.
* Providing a locator could help the user to find a store faster. Can link it to <https://www.google.com/maps/search/loterias/>
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "Lottery",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "75991435892"
      },
      "address" : {
          "zip_code": "38082365"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## 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)


# Boleto

How to use Boleto to submit a payin in Brazil.

## Payin by Boleto

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Boleto in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                                                                                                      |
| ---------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                                                     |
| customer.phone                                             | string | User's phone                                                                                                                                                                                     |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                                                                                                     |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p>                                                                                                              |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Boleto                                                                                                                                                                              |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                                             |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                                                                                                         |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                                                                                                                                          |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                                                                                                      |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                                                  |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                                                     |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 5\~10,000 BRL -</p>                                                                                                                                                       |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BRL                                                                                                                                                                                 |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p>                                                                                       |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                                                                                                               |
| address.zip\_code<mark style="color:red;">\*</mark>        | string | zip code                                                                                                                                                                                         |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                                                                                                             |
| address.street                                             | string | <p>street</p><p>- Required if zip\_code not provide -</p>                                                                                                                                        |
| address.street\_number                                     | string | <p>street number</p><p>- Required if zip\_code not provide -</p>                                                                                                                                 |
| address.city                                               | string | <p>city</p><p>- Required if zip\_code not provide -</p>                                                                                                                                          |
| address.state                                              | string | <p>state<br>- Required if zip\_code not provide -</p>                                                                                                                                            |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                                                                                                           |
| cancellation\_express                                      | string | <p>m(minutes), h(hours), d(days).<br>The value must be an integer. Ex: 90m<br>The value must be larger than timeout\_express.</p><p>User to control the expiration time of a Boleto voucher.</p> |
| timeout\_express                                           | strng  | Used to control the expiration time of **submitting** an order (from initial to processing). (90m in default, max 15d)                                                                           |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110481300091",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "barcode": "23793864800029999003380260980157275200633330",
    "bank_code": "21890010070215182080679309377384187050000001125",
    "pay_url": "https://checkout-testv2.pagsmile.com/checkout?prepay_id=bkYvNytBMkN2dnFaVVhXTSs0ckJPaHBBVnkyT3J1M2tyekNzZ3RMZ05ubz0=-3872aF67",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* The value of **bank\_code** is the ticket number that the user needs to use for payment
* Use the value of **barcode** to generate a scanable barcode can help users to make payment faster
* Providing a downloadable PDF version could help mobile users to have their tickets on their phones without keeping the browser open
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "Boleto",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      },
    * "address" : {
    *     "zip_code": "38082365"
      }
      }'
```

![Example of payment page](https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FURnQbtG5UEQ44AKImv6u%2Fimage.png?alt=media\&token=168615ec-fa72-40c8-ad45-ec980168d995)

![Example of Boleto PDF](https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2F4YDzGh8RCJ2PyCmKLpi0%2Fimage.png?alt=media\&token=557e957d-ff66-42a3-b7ee-3b8dfad22126)

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## 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)


# Wallet

How to use Wallet to submit a payin in Brazil.

## Payin by Wallet

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Wallet in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                  |
| ---------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                 |
| customer.phone                                             | string | User's phone                                                                                                 |
| customer.email                                             | string | User's email                                                                                                 |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p>                          |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Wallet                                                                                          |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                         |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                     |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                                                      |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                  |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                              |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                 |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#brazil">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BRL                                                                                             |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p>   |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                           |
| address.zip\_code                                          | string | zip code                                                                                                     |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                         |
| address.street                                             | string | street                                                                                                       |
| address.street\_number                                     | string | street number                                                                                                |
| address.city                                               | string | city                                                                                                         |
| address.state                                              | string | state                                                                                                        |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                       |
| channel<mark style="color:red;">\*</mark>                  | string | <p>Wallet type<br>- <del>Mercadopago</del>, or PicPay -</p>                                                  |

{% tabs %}
{% tab title="200 submit successfully" %}
{% tabs %}
{% tab title="PicPay" %}

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354002",
    "web_url": "",
    "trade_status": "PROCESSING",
    "wallet_url": "https://app.picpay.com/checkout/NjIxOGE4ZDc3MzY5MDQ0MGU2MDRiNGM5" //If the user use mobile, wallet_url will redirect the user to Picpay app. 
}
```

{% endtab %}

{% tab title="Mercadopago" %}

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354002",
    "web_url": "",
    "trade_status": "PROCESSING",
    "wallet_url": "https://www.mercadopago.com.br/checkout/v1/redirect?pref_id=" //If the user use mobile, wallet_url will redirect the user to Mercadopago app. 
}
```

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

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* **wallet\_url** will need to be used to redirect users to the wallet page. Users will finish payment on the wallet page.
* **wallet\_url** of **Picpay** can only be opened in Brazil.
  {% endhint %}

## Example

<pre><code>curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "Wallet",
    * "channel": "PicPay",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
<strong>      }'
</strong></code></pre>

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## 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)


# Credit Card

How to use CreditCard to submit a payin in Brazil.

## Payin by CreditCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by CreditCard in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                        | Type   | Description                                                                                                                                                                          |
| ----------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>                   | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                                         |
| customer.phone<mark style="color:red;">\*</mark>            | string | User's phone                                                                                                                                                                         |
| customer.email<mark style="color:red;">\*</mark>            | string | User's email                                                                                                                                                                         |
| customer.identify.number<mark style="color:red;">\*</mark>  | string | <p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p>                                                                                                  |
| method<mark style="color:red;">\*</mark>                    | string | Fixed value: CreditCard                                                                                                                                                              |
| out\_trade\_no<mark style="color:red;">\*</mark>            | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                                 |
| notify\_url<mark style="color:red;">\*</mark>               | string | Where Pagsmile will send notification to                                                                                                                                             |
| customer.identify.type<mark style="color:red;">\*</mark>    | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                                                                                                                              |
| customer.name<mark style="color:red;">\*</mark>             | string | User's name                                                                                                                                                                          |
| timestamp<mark style="color:red;">\*</mark>                 | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                                      |
| subject<mark style="color:red;">\*</mark>                   | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                                         |
| order\_amount<mark style="color:red;">\*</mark>             | string | <p>payment amount<br>- 0.5\~50000 BRL -</p>                                                                                                                                          |
| order\_currency<mark style="color:red;">\*</mark>           | string | Fixed value: BRL                                                                                                                                                                     |
| content<mark style="color:red;">\*</mark>                   | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p>                                                                           |
| buyer\_id<mark style="color:red;">\*</mark>                 | string | merchant user's id                                                                                                                                                                   |
| address.zip\_code<mark style="color:red;">\*</mark>         | string | zip code                                                                                                                                                                             |
| website\_url                                                | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                                                                                                 |
| address.street                                              | string | <p>street</p><p>- Required if zip\_code not provide -</p>                                                                                                                            |
| address.street\_number                                      | string | <p>street number</p><p>- Required if zip\_code not provide -</p>                                                                                                                     |
| address.city                                                | string | <p>city</p><p>- Required if zip\_code not provide -</p>                                                                                                                              |
| address.state                                               | string | <p>state<br>- Required if zip\_code not provide -</p>                                                                                                                                |
| return\_url                                                 | string | Redirect to Merchant's url when user finished checkout                                                                                                                               |
| token<mark style="color:red;">\*</mark>                     | string | use [Pagsmile Javascript](broken://pages/J8aQL6RYWEos7Tm2AEXg) to get toekn                                                                                                          |
| fingerprint<mark style="color:red;">\*</mark>               | string | use [Pagsmile Javascript](broken://pages/J8aQL6RYWEos7Tm2AEXg) to get fingerprint                                                                                                    |
| issuer<mark style="color:red;">\*</mark>                    | string | issuer of CreditCard                                                                                                                                                                 |
| installments                                                | string | installments for CreditCard                                                                                                                                                          |
| user\_ip<mark style="color:red;">\*</mark>                  | string | user's IP address                                                                                                                                                                    |
| threeds.status\_code<mark style="color:red;">\*</mark>      | string | 3DSecure - Status code recieved from authorization/authentication response, (Possible values: U, N, Y, A, C, D, R, I)                                                                |
| threeds.status                                              | string | 3DSecure - Status text received from 3D secure vendor                                                                                                                                |
| threeds.avs                                                 | string | Procesor response code for AVS. Only required in cases where all AVS results (zipcode, street address, and name when available) arrive as one string                                 |
| threeds.cvv                                                 | string | CVV result                                                                                                                                                                           |
| threeds.xid<mark style="color:red;">\*</mark>               | string | A unique Visa or Amex transaction id                                                                                                                                                 |
| threeds.server\_trans\_id<mark style="color:red;">\*</mark> | string | Universally unique transaction identifier assigned by the 3DS Server to identify a single transaction generated by the Init 3DS API and used to link the init call to the order call |
| threeds.eci<mark style="color:red;">\*</mark>               | string | ECI value recieved from authorization/authentication response                                                                                                                        |
| threeds.caav<mark style="color:red;">\*</mark>              | string | Authentication Value (CAVV / AAV for 3DS1) recieved from authorization/Authentication response                                                                                       |
| threeds.version<mark style="color:red;">\*</mark>           | string | Version used in the transaction                                                                                                                                                      |
| threeds.sli<mark style="color:red;">\*</mark>               | string | Security level indicator                                                                                                                                                             |
| threeds.status\_reason\_code                                | string | String EMVCO Indicator of the reason for the 3DS status code provided during the authentication, (Possible values: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16)   |
| threeds.liability\_shift                                    | String | liability shift - indicate whether the chargeback liability shifted to the card issuer                                                                                               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900084",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
It is required to implement our JS library for integrating this method.
{% endhint %}

## Example

<pre><code>curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "CreditCard",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "user_ip":"127.0.0.1",
    * "token":"${token}",
    * "fingerprint":"${fingerprint}",
    * "issuer":"visa",
      "installments":"1",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "75991435892"
      },
    * "address" : {
    *     "zip_code": "38082365"
      },
    * "threeds": {
    *     "sli": "",
    *     "version": "",
    *     "cavv": "",
    *     "eci": "",
    *     "server_trans_id": "",
    *     "xid": "",
          "cvv": "",
          "avs": "",
          "status": "",
    *     "status_code": "",
          "status_reason_code": "",
          "liability_shift": true
      }
<strong>      }'
</strong></code></pre>

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Deposit Express

How to use Boleto to submit a payin in Brazil.

## Payin by Deposit Express

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Deposit Express in Brazil.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                |
| ---------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                               |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone                                                                                               |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                               |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 11 digits if CPF or 14 digits if CNPJ -</p>                        |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: DepositExpress                                                                                |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                       |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                   |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CPF or CNPJ -</p>                                                    |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                            |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                               |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 1\~50,000 BRL -</p>                                                                 |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BRL                                                                                           |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail. This will be shown on the bank bill.</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                         |
| address.zip\_code                                          | string | zip code                                                                                                   |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                       |
| address.street                                             | string | street                                                                                                     |
| address.street\_number                                     | string | street number                                                                                              |
| address.city                                               | string | city                                                                                                       |
| address.state                                              | string | state                                                                                                      |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                     |
| bank<mark style="color:red;">\*</mark>                     | string | <p>Bank code<br>- One of: bradesco, caixa （caixa not work in test environment) -</p>                       |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022021810560500094",
    "out_trade_no": "202201010354003",
    "web_url": "https://checkout-testv2.pagsmile.com/checkout?prepay_id=Um1RbHBsVENReWlLdWJXSzFDbEFTemtCYjN5S1JUUWJwbEtndFhWSGJ1dz0=-8357Fae6",
    "pay_url": "https://checkout-testv2.pagsmile.com/checkout?prepay_id=Um1RbHBsVENReWlLdWJXSzFDbEFTemtCYjN5S1JUUWJwbEtndFhWSGJ1dz0=-8357Fae6",
    "trade_status": "PROCESSING",
    "provider_owner": "Pagsmile Brasil",
    "provider_owner_document": "23.010.551/0001­-31",
    "provider_agency": "0154",
    "provider_number": "13006729-4",
    "bank_name": "santander"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Deposit Express was terminated on Feb 29th, 2024. Please check [OpenFinance](/reference/payin/submit-a-payin/brazil/openfinance) which is a new instant bank transfer method in Brazil. OpenFinance requires fewer actions to complete the payment.
{% endhint %}

{% hint style="info" %}
**User payment tips**

* Users need to use the complete bank account information of Pagsmile to finish the payment. Including **provider\_agency** (bank agency), **provider\_number** (bank account number), **bank\_name**, **provider\_owner\_document** (Pagsmile CNPJ)
* **pay\_url** is the page for users to submit the proof of payment to Pagsmile. In addition, an email should be sent to users with the link for submission.
* Users must submit the proof of payment for processing the payment. Users has **10** days to submit the proof of payment.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "DepositExpress",
    * "bank": "Bradesco",
    * "order_amount": "12.01",
    * "order_currency": "BRL",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "CPF",
    *         "number": "11032341882"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "75991435892"
      }
      }'
```

![Example of payment page](https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FS1XLFo5U0GjSXnCB4fTM%2FDepositExpress_Santander.png?alt=media\&token=887a46a2-d825-46a0-b52a-89c078c3cdb7)

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Bolivia

Bolivia methods for API direct payment


# QRCode

How to use QRCode to submit a payin in Bolivia.

## Payin by QRCode

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by QRCode in Bolivia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                                   |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                  |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                                   |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                                  |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CI, CE, NIT -</p>                                                                       |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- CI: 7<del>10 digits</del><br><del>CE: 8 digits</del><br><del>NIT: 9</del>12 digits -</p> |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: BankTransfer                                                                                                     |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                          |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                                      |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                               |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                  |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 1 - 69,000.00 BOB -</p>                                                                                |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BOB                                                                                                              |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                                          |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                                            |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                                        |

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

```
{
    "code":"10000",
    "msg":"Success",
    "prepay_id":"Q2RrZ***B0B769",
    "trade_no":"2026***6553",
    "out_trade_no":"out_trade_no_45***541",
    "web_url":"",
    "pay_url":"https://recaudodigital.sintesis.com.bo/pasare****ta=true",
    "trade_status":"PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

Format of customer.identify

<table><thead><tr><th width="146">Identify.type</th><th width="90">Length</th><th width="245">Format</th><th width="223">Description</th><th>Example</th></tr></thead><tbody><tr><td>CI</td><td>7-10</td><td>7 mandatory numerical digits and then optionally a space and two letters</td><td>Cedula de Identidad</td><td>SC 1234567 or 1234567</td></tr><tr><td>CE</td><td>8</td><td>numeric</td><td>Cedula de Identidad de Extranjero</td><td>12345678</td></tr><tr><td>NIT</td><td>9-12</td><td>numeric</td><td>Número de Identificación Tributaria</td><td>123456789</td></tr></tbody></table>

{% hint style="info" %}
The “CI” can be up to 10 characters. It is formed with 7 mandatory numerical digits and then optionally a space and two letters. The two letters represent the departments belonging to the “ Plurinational State of Bolivia”.

There are:

* BE - Beni
* CB- Cochabamba
* CH – Chuquisaca
* LP- La Paz
* OR- Oruro
* PD- Pando
* PT – Potosí
* SC – Santa Cruz
* TJ - Tarija

Examples : For Santa Cruz you can send “SC 1234567”, “1234567”, “SC1234567”, “1234567SC” or “1234567 SC”
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354008",
    * "method": "QRCode",
    * "order_amount": "50",
    * "order_currency": "BOB",
    * "subject": "trade pay test",
      "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer" : {
    *     "identify": {
    *         "type": "CI",
    *         "number": "12345678"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Bank Transfer

How to use BankTransfer to submit a payin in Bolivia.

## Payin by BankTransfer

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by BankTransfer in Bolivia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                                   |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                  |
| customer.phone                                             | string | User's phone                                                                                                                  |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                                  |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- CI: 7<del>10 digits</del><br><del>CE: 8 digits</del><br><del>NIT: 9</del>12 digits -</p> |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: BankTransfer                                                                                                     |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                          |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                                      |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CI, CE, NIT -</p>                                                                       |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                                   |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                               |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                  |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 1 - 1,000,000 BOB -</p>                                                                                |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: BOB                                                                                                              |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                                          |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                                            |
| address.zip\_code                                          | string | <p>zip code<br>- 5 digits -</p>                                                                                               |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                                          |
| address.street                                             | string | street                                                                                                                        |
| address.street\_number                                     | string | street number                                                                                                                 |
| address.city                                               | string | city                                                                                                                          |
| address.state                                              | string | state                                                                                                                         |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                                        |
| account\_number<mark style="color:red;">\*</mark>          | string | <p>User's bank account number<br>- numeric: 7 \~ 14 digits -</p>                                                              |
| bank<mark style="color:red;">\*</mark>                     | string | Use [API](/reference/payin/tools/supported-bank-list-query) to get bank code                                                  |
| account\_type<mark style="color:red;">\*</mark>            | string | <p>User's bank account type</p><p>- One of: SAVINGS, CHECKING -</p>                                                           |

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "V2VNU **** B8F7Fe",
    "trade_no": "20240603***81",
    "out_trade_no": "out_tr****000",
    "web_url": "",
    "pay_url": "https://checkoutv2.pagsmile.com/checkout?prepay_id=V2VN***=-50B8F7Fe",
    "trade_status": "PROCESSING",
    "qr_code_img": "data:image/png;base64, iVBORw0KGgoAAA********* AABJRU5ErkJggg==",
    "due_date": "2024-06-03T23:59:00"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

Format of customer.identify

<table><thead><tr><th width="146">Identify.type</th><th width="90">Length</th><th width="245">Format</th><th width="223">Description</th><th>Example</th></tr></thead><tbody><tr><td>CI</td><td>7-10</td><td>7 mandatory numerical digits and then optionally a space and two letters</td><td>Cedula de Identidad</td><td>SC 1234567 or 1234567</td></tr><tr><td>CE</td><td>8</td><td>numeric</td><td>Cedula de Identidad de Extranjero</td><td>12345678</td></tr><tr><td>NIT</td><td>9-12</td><td>numeric</td><td>Número de Identificación Tributaria</td><td>123456789</td></tr></tbody></table>

{% hint style="info" %}
The “CI” can be up to 10 characters. It is formed with 7 mandatory numerical digits and then optionally a space and two letters. The two letters represent the departments belonging to the “ Plurinational State of Bolivia”.

There are:

* BE - Beni
* CB- Cochabamba
* CH – Chuquisaca
* LP- La Paz
* OR- Oruro
* PD- Pando
* PT – Potosí
* SC – Santa Cruz
* TJ - Tarija

Examples : For Santa Cruz you can send “SC 1234567”, “1234567”, “SC1234567”, “1234567SC” or “1234567 SC”
{% endhint %}

{% hint style="info" %}
**User payment tips**

* The order will always expire at 23:59:00 GMT+0 on the same day of creation.
* Users need to scan the QR code to make the payment. Take the image of QR code from the parameter **qr\_code\_img**.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354008",
    * "method": "BankTransfer",
    * "order_amount": "50",
    * "order_currency": "BOB",
    * "subject": "trade pay test",
      "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "bank":"004",
    * "account_number":"87654321",
    * "account_type":CHECKING",
    * "customer" : {
    *     "identify": {
    *         "type": "CI",
    *         "number": "12345678"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Chile

Chile methods for API direct payment


# Credit Card

How to use CreditCard to submit a payin in Chile.

## Payin by CreditCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by CreditCard in Chile.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CreditCard</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- 1 ~ ? -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CLP</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>token<mark style="color:red;">*</mark></td><td>string</td><td>Get from <a href="/reference/payin/tools/tokenize">here</a></td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "sub_code": "200",
    "sub_msg": "",
    "prepay_id": "VGQ****05e9cB",
    "trade_no": "2025****80",
    "out_trade_no": "out_1****0",
    "web_url": "",
    "trade_status": "PROCESSING",
    "check_url": "https://***.com?token=***"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "CLP",
    * "method": "CreditCard",
    * "order_amount": "2000",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023",
    * "token": "psc****d1f4"
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Webpay

How to use Webpay to submit a payin in Chile.

## Payin by Webpay

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Webpay in Chile.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: WebPay                                                  |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| content<mark style="color:red;">\*</mark>         | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 1 \~ 1,000,000</p><p>(Only Integer) -</p>     |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: CLP                                                     |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |
| address.zip\_code                                 | string | <p>zip code<br>- 7 digits -</p>                                      |
| address.street                                    | string | street                                                               |
| address.street\_number                            | string | street number                                                        |
| address.city                                      | string | city                                                                 |
| address.state                                     | string | state                                                                |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example of identify

{% hint style="info" %}

* RUT / RUN numbers have eight digits, plus a verification digit, and are generally written in this format: xxxxxxxx-z. Z can be a digit or the letter K. For example 3\*\*\*\*\*\*7-K, 7\*\*\*\*\*\*8-5. **Only send alphanumeric values in the API**, like 3\*\*\*\*\*\*7K.
* For individuals, RUT is the same as RUN. For businesses, they only have RUT.
  {% endhint %}

<table><thead><tr><th width="154">Identify Type</th><th width="160">Identify Number</th><th width="135">Description</th><th width="405"></th><th></th></tr></thead><tbody><tr><td>RUN</td><td>7******85</td><td>9 digits</td><td>A RUN <em>(Rol Único Nacional)</em> is a unique identification number given to every Chilean resident, foreign resident, and anyone who stays in Chile on anything other than a tourist visa</td><td></td></tr><tr><td>RUT</td><td>7******85</td><td>9 digits</td><td>A RUT <em>(Rol Único Tributario)</em> is the individual tax ID number</td><td></td></tr></tbody></table>

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354006",
    "method": "WebPay",
    "order_amount": "2500",
    "order_currency": "CLP",
    "subject": "trade pay test",
    "content": "trade pay test content",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express": "1c",
    "customer": {}
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Khipu

How to use Khipu to submit a payin in Chile.

## Payin by Khipu

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Khipu in Chile.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                                                                                                                                                                                                                                                     |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                                                                                                                                                                                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- RUT or RUN -</p>                                                                                                                                                                                                                                                                                          |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- 9 digts -</p>                                                                                                                                                                                                                                                                                              |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                                                                                                                                                                                                                                                     |
| customer.email                                             | string | User's email                                                                                                                                                                                                                                                                                                                                    |
| customer.phone                                             | string | User's phone                                                                                                                                                                                                                                                                                                                                    |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Khipu                                                                                                                                                                                                                                                                                                                              |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                                                                                                                                                                                            |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                                                                                                                                                                                                                                                        |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                                                                                                                                                                                                 |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                                                                                                                                                                                                    |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- Averge limit is 1\~250,000 CLP; Different banks have different daily limits. Check <a href="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2F6pqcK7KutXYx56uRDIdC%2FChile_BankLimits.pdf?alt=media&#x26;token=5a01f83b-e39b-41ef-8673-02bb04ccd9cd">here</a>. -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: CLP                                                                                                                                                                                                                                                                                                                                |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                                                                                                                                                                                                                                                            |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                                                                                                                                                                                                                                                              |
| address.zip\_code                                          | string | <p>zip code<br>- 7 digits -</p>                                                                                                                                                                                                                                                                                                                 |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                                                                                                                                                                                                                                                            |
| address.street                                             | string | street                                                                                                                                                                                                                                                                                                                                          |
| address.street\_number                                     | string | street number                                                                                                                                                                                                                                                                                                                                   |
| address.city                                               | string | city                                                                                                                                                                                                                                                                                                                                            |
| address.state                                              | string | state                                                                                                                                                                                                                                                                                                                                           |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                                                                                                                                                                                                                                                          |
| bank<mark style="color:red;">\*</mark>                     | string | Use [API](/reference/payin/tools/supported-bank-list-query) to get bank code                                                                                                                                                                                                                                                                    |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "pay_url": "https://khipu.com/payment/info/rkrcge5jq30j",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example of identify

{% hint style="info" %}

* RUT / RUN numbers have eight digits, plus a verification digit, and are generally written in this format: xxxxxxxx-z. Z can be a digit or the letter K. For example 3\*\*\*\*\*\*7-K, 7\*\*\*\*\*\*8-5. **Only send alphanumeric values in the API**, like 3\*\*\*\*\*\*7K.
* For individuals, RUT is the same as RUN. For businesses, they only have RUT.
  {% endhint %}

<table><thead><tr><th width="154">Identify Type</th><th width="160">Identify Number</th><th width="135">Description</th><th width="405"></th><th></th></tr></thead><tbody><tr><td>RUN</td><td>7******85</td><td>9 digits</td><td>A RUN <em>(Rol Único Nacional)</em> is a unique identification number given to every Chilean resident, foreign resident, and anyone who stays in Chile on anything other than a tourist visa</td><td></td></tr><tr><td>RUT</td><td>7******85</td><td>9 digits</td><td>A RUT <em>(Rol Único Tributario)</em> is the individual tax ID number</td><td></td></tr></tbody></table>

## Test Environment

{% hint style="warning" %}
For test environment, please use "bank" : "Bawdf".
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "Khipu",
    * "order_amount": "12.01",
    * "order_currency": "CLP",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "bank" : "Bawdf", //Only this bank works in test env.   
    * "customer" : {
    *     "identify": {
    *         "type": "RUT",
    *         "number": "220604497"
          },
    *     "name": "Test User Name",
          "email": "test@pagsmile.com",
          "phone": "56985995523"
      }
      }'
```

{% hint style="info" %}
**User payment tips**

* KHIPU works as an interface that connects the user with the Bank platform and simplifies the bank transfer flow, therefore, the user RUT and Clave (Password/PIN) that users enter on KHIPU should be the same as the one they used to enter their e-banking
* Sending "email" in the request allows Khipu to send emails to the users to remind the payment.
  {% endhint %}

<figure><img src="https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FzxSnYQOsPtyU2gdN3uqJ%2Fimage.png?alt=media&amp;token=924e5c1e-671b-4ffd-bddf-179d4b3eb63d" alt="" width="308"><figcaption></figcaption></figure>

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Bank Transfer

How to use BankTransfer to submit a payin in Chile.

## Payin by BankTransfer

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by BankTransfer in Chile.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                                                                               |
| ---------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                                              |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                                      |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                                           |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: BankTransfer                                                                                                                                                 |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#chile">here</a> for limits -</p>                                                               |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: CLP                                                                                                                                                          |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                                                                                  |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                                                                                    |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                                                                                        |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                                              |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                                                                                      |
| bank                                                       | string | <p>Get from <a href="/reference/payin/data/bank-list/banktransferchile">bank list</a><br>- Without "bank" parameter, the user can select bank from the channel page -</p> |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                                                                              |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- RUT or RUN -</p>                                                                                                                    |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- 9 digts -</p>                                                                                                                        |
| address.zip\_code                                          | string | <p>zip code<br>- 7 digits -</p>                                                                                                                                           |
| address.street                                             | string | street                                                                                                                                                                    |
| address.street\_number                                     | string | street number                                                                                                                                                             |
| address.city                                               | string | city                                                                                                                                                                      |
| address.state                                              | string | state                                                                                                                                                                     |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example of identify

{% hint style="info" %}

* RUT / RUN numbers have eight digits, plus a verification digit, and are generally written in this format: xxxxxxxx-z. Z can be a digit or the letter K. For example 3\*\*\*\*\*\*7-K, 7\*\*\*\*\*\*8-5. **Only send alphanumeric values in the API**, like 3\*\*\*\*\*\*7K.
* For individuals, RUT is the same as RUN. For businesses, they only have RUT.
  {% endhint %}

<table><thead><tr><th width="154">Identify Type</th><th width="160">Identify Number</th><th width="135">Description</th><th width="405"></th><th></th></tr></thead><tbody><tr><td>RUN</td><td>7******85</td><td>9 digits</td><td>A RUN <em>(Rol Único Nacional)</em> is a unique identification number given to every Chilean resident, foreign resident, and anyone who stays in Chile on anything other than a tourist visa</td><td></td></tr><tr><td>RUT</td><td>7******85</td><td>9 digits</td><td>A RUT <em>(Rol Único Tributario)</em> is the individual tax ID number</td><td></td></tr></tbody></table>

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354006",
    "method": "BankTransfer",
    "order_amount": "20",
    "order_currency": "CLP",
    "subject": "trade pay test",
    "content": "trade pay test content",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "bank": "santander", //Without "bank" parameter, the user can select bank from pay_url page.
    "customer": {
    "identify": {
             "type": "RUT",
             "number": "220604497"
          },   
    "email": "test@pagsmile.com",
    
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# TAPP

How to use TAPP to submit a payin in Chile.

## Payin by TAPP

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by TAPP in Chile.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                                 |
| ------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: TAPP                                                                                           |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                        |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                                    |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                             |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#chile">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: CLP                                                                                            |
| content<mark style="color:red;">\*</mark>         | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                        |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                          |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout                                                      |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING",
    "expired": "1754385560"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "TAPP",
    * "order_amount": "20",
    * "order_currency": "CLP",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01"
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Wallet

How to use Wallet to submit a payin in Chile.

## Payin by Wallet

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Wallet in Chile.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                 |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                |
| customer.phone                                             | string | User's phone                                                                                                |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 9 digits -</p>                                                      |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Wallet                                                                                         |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                        |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- RUT or RUN -</p>                                                      |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                 |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#chile">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: CLP                                                                                            |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                        |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                          |
| address.zip\_code                                          | string | <p>zip code<br>- 7 digits -</p>                                                                             |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                        |
| address.street                                             | string | street                                                                                                      |
| address.street\_number                                     | string | street number                                                                                               |
| address.city                                               | string | city                                                                                                        |
| address.state                                              | string | state                                                                                                       |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                      |
| channel<mark style="color:red;">\*</mark>                  | string | <p>Wallet type<br>- Mach <del>or Chek</del> -</p>                                                           |

{% tabs %}
{% tab title="200 submit successfully" %}
{% tabs %}
{% tab title="Mach" %}

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "trade_status": "PROCESSING",
    "app_link_url": "machapp://pay-biz/payment/3e51efda-d80d-41c9-8fb1-2454a7cbc7e6"
}
```

{% endtab %}

{% tab title="(Disable) Chek" %}

```
//Method not available
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "trade_status": "PROCESSING",
    "pay_url": "https://app.payku.cl/gateway/cobro?id=trx12cfab0b34da56b0f&valid=78aecf9012"
}
```

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

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Payment Tips**

* If you receive "app\_link\_url" in the response, it will redirect users to the app on mobile. For products on the desktop, you can use this URL to generate a QR code to let users scan.
  {% endhint %}

<figure><img src="https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FmG6OZ788dbBxVUeSpI4Q%2F%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230727181614.png?alt=media&amp;token=ca880494-9a91-4af7-9ad7-6b557b181b19" alt=""><figcaption><p>Example of payment page</p></figcaption></figure>

## Example of identify

{% hint style="info" %}

* RUT / RUN numbers have eight digits, plus a verification digit, and are generally written in this format: xxxxxxxx-z. Z can be a digit or the letter K. For example 3\*\*\*\*\*\*7-K, 7\*\*\*\*\*\*8-5. **Only send alphanumeric values in the API**, like 3\*\*\*\*\*\*7K.
* For individuals, RUT is the same as RUN. For businesses, they only have RUT.
  {% endhint %}

<table><thead><tr><th width="154">Identify Type</th><th width="160">Identify Number</th><th width="135">Description</th><th width="405"></th><th></th></tr></thead><tbody><tr><td>RUN</td><td>7******85</td><td>9 digits</td><td>A RUN <em>(Rol Único Nacional)</em> is a unique identification number given to every Chilean resident, foreign resident, and anyone who stays in Chile on anything other than a tourist visa</td><td></td></tr><tr><td>RUT</td><td>7******85</td><td>9 digits</td><td>A RUT <em>(Rol Único Tributario)</em> is the individual tax ID number</td><td></td></tr></tbody></table>

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "Wallet",
    * "channel": "Mach",
    * "order_amount": "12.01",
    * "order_currency": "CLP",
    * "subject": "trade pay test",
      "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "RUT",
    *         "number": "220604497"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Pago46

How to use Pago46 to submit a payin in Chile.

## Payin by Pago46

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Pago46 in Chile.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                      |
| ---------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                     |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone                                                                                     |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                     |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- 9 digts -</p>                                               |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Pago46                                                                              |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                             |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                         |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- RUT or RUN -</p>                                           |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                      |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                  |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                     |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#chile">here</a> -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: CLP                                                                                 |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                             |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                               |
| address.zip\_code                                          | string | <p>zip code<br>- 7 digits -</p>                                                                  |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                             |
| address.street                                             | string | street                                                                                           |
| address.street\_number                                     | string | street number                                                                                    |
| address.city                                               | string | city                                                                                             |
| address.state                                              | string | state                                                                                            |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                           |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example of identify

{% hint style="info" %}

* RUT / RUN numbers have eight digits, plus a verification digit, and are generally written in this format: xxxxxxxx-z. Z can be a digit or the letter K. For example 3\*\*\*\*\*\*7-K, 7\*\*\*\*\*\*8-5. **Only send alphanumeric values in the API**, like 3\*\*\*\*\*\*7K.
* For individuals, RUT is the same as RUN. For businesses, they only have RUT.
  {% endhint %}

<table><thead><tr><th width="154">Identify Type</th><th width="160">Identify Number</th><th width="135">Description</th><th width="405"></th><th></th></tr></thead><tbody><tr><td>RUN</td><td>7******85</td><td>9 digits</td><td>A RUN <em>(Rol Único Nacional)</em> is a unique identification number given to every Chilean resident, foreign resident, and anyone who stays in Chile on anything other than a tourist visa</td><td></td></tr><tr><td>RUT</td><td>7******85</td><td>9 digits</td><td>A RUT <em>(Rol Único Tributario)</em> is the individual tax ID number</td><td></td></tr></tbody></table>

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "Pago46",
    * "order_amount": "2500",
    * "order_currency": "CLP",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "RUT/RUN",
    *         "number": "220604497"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "56233145118"
      },
      "address" : {
          "zip_code": "3007601",
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Cash

How to use Cash to submit a payin in Chile.

## Payin by Cash

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Cash in Chile.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                          |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone                                                         |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                         |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- 9 digts -</p>                   |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Cash                                                    |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                             |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- RUT or RUN -</p>               |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                          |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 500 - 999,999 CLP -</p>                       |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: CLP                                                     |
| content<mark style="color:red;">\*</mark>                  | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                   |
| address.zip\_code                                          | string | <p>zip code<br>- 7 digits -</p>                                      |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |
| address.street                                             | string | street                                                               |
| address.street\_number                                     | string | street number                                                        |
| address.city                                               | string | city                                                                 |
| address.state                                              | string | state                                                                |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "pay_url": "https://checkout/payment",
    "trade_status": "PROCESSING",
    "reference": "841234567"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example of identify

{% hint style="info" %}

* RUT / RUN numbers have eight digits, plus a verification digit, and are generally written in this format: xxxxxxxx-z. Z can be a digit or the letter K. For example 3\*\*\*\*\*\*7-K, 7\*\*\*\*\*\*8-5. **Only send alphanumeric values in the API**, like 3\*\*\*\*\*\*7K.
* For individuals, RUT is the same as RUN. For businesses, they only have RUT.
  {% endhint %}

<table><thead><tr><th width="154">Identify Type</th><th width="160">Identify Number</th><th width="135">Description</th><th width="405"></th><th></th></tr></thead><tbody><tr><td>RUN</td><td>7******85</td><td>9 digits</td><td>A RUN <em>(Rol Único Nacional)</em> is a unique identification number given to every Chilean resident, foreign resident, and anyone who stays in Chile on anything other than a tourist visa</td><td></td></tr><tr><td>RUT</td><td>7******85</td><td>9 digits</td><td>A RUT <em>(Rol Único Tributario)</em> is the individual tax ID number</td><td></td></tr></tbody></table>

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354006",
    * "method": "Cash",
    * "order_amount": "2500",
    * "order_currency": "CLP",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "RUT/RUN",
    *         "number": "220604497"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "56233145118"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# China

China methods for API direct payment


# Wallet

How to use Wallet to submit a payin in China.

## Payin by Wallet

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Wallet in China.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Wallet                                                  |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 0.04 - 300,000 -</p>                          |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: CNY                                                     |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |
| channel<mark style="color:red;">\*</mark>         | string | <p>Wallet type<br>- AlipayCN -</p>                                   |

{% tabs %}
{% tab title="200 submit successfully" %}
{% tabs %}
{% tab title="AlipayCN" %}

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "web_url": "",
    "trade_status": "PROCESSING",
    "qr_code":"28166604009zTUJZ0bKPDzUJay6G19rv3THA",
    "wallet_url":"https://open-sea.alipayplus.com/api/open/v1/ac/cashier/self/codevalue/checkout.htm?codeValue="
}
```

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

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354006",
    "method": "Wallet",
    "channel": "AlipayCN",
    "order_amount": "300",
    "order_currency": "CNY",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"300m"
    }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Vault

How to use Vault to submit a payin in China.

## Create Vault

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/vault/create`

This endpoint allows you to create a vault.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="265">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>type<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: wallet_account</td></tr><tr><td>wallet_account.region<mark style="color:red;">*</mark></td><td>string</td><td>CHN for China</td></tr><tr><td>wallet_account.method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: Wallet</td></tr><tr><td>wallet_account.channel<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: AlipayCN or AlipayHK</td></tr><tr><td>wallet_account.uid<mark style="color:red;">*</mark></td><td>string</td><td>Unique ID in merchant system</td></tr><tr><td>wallet_account.device_type<mark style="color:red;">*</mark></td><td>string</td><td>WEB or WAP</td></tr><tr><td>wallet_account.return_url<mark style="color:red;">*</mark></td><td>string</td><td></td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "auth_url": "https://demo.auth.url/",
    "token": "wa_***",
    "type": "wallet_account",
    "timestamp": "yyyy-MM-dd HH:mm:ss",
    "checkout_url": "https://demo.checkout.url"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/vault/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",,
    "timestamp": "2022-01-01 03:54:01",
    "version": "2.0",
    "type": "wallet_account",
    "wallet_account": {
        "region": "CHN",
        "method": "Wallet",
        "channel": "AlipayCN",
        "uid": "123",
        "device_type": "WEB",
        "return_url": "https://demo.return.url"
    }
}'
```

***

## Pay Vault

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Vault in China.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Wallet                                                  |
| channel<mark style="color:red;">\*</mark>         | string | <p>Wallet type<br>- AlipayCN -</p>                                   |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 0.04\~300,000 -</p>                           |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: CNY                                                     |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| vault\_token<mark style="color:red;">\*</mark>    | string | Token get from [Create Vault](#create-vault)                         |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id":"Q3pDNzRT****************VT0=-De8BDeB3",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354006",
    "method": "Wallet",
    "channel": "AlipayCN",
    "order_amount": "300",
    "order_currency": "CNY",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "vault_token": "wa_***"
    }'
```

***

## Refresh Vault

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/vault/refresh`

This endpoint allows you to refresh a vault.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                           | Type   | Description                                                  |
| ---------------------------------------------- | ------ | ------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>      | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p> |
| timestamp<mark style="color:red;">\*</mark>    | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>              |
| version<mark style="color:red;">\*</mark>      | string | Fixed value: 2.0                                             |
| type<mark style="color:red;">\*</mark>         | string | Fixed value: wallet\_account                                 |
| vault\_token<mark style="color:red;">\*</mark> | string |                                                              |

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

```
{
    "code": "10000",
    "msg": "Success",
    "token": "wa_***",
    "type": ""wallet_account",
    "timestamp": "yyyy-MM-dd HH:mm:ss"
}
```

{% endtab %}
{% endtabs %}

***

## Void Vault

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/vault/void`

This endpoint allows you to void a vault.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="254">Name</th><th width="239">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>type<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: wallet_account</td></tr><tr><td>vault_token<mark style="color:red;">*</mark></td><td>string</td><td></td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "token": "wa_***",
    "type": ""wallet_account",
    "timestamp": "yyyy-MM-dd HH:mm:ss"
}
```

{% endtab %}
{% endtabs %}

***

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Colombia

Colombia methods for API direct payment


# Virtual Account

This section describes how to create and query a Virtual Account and receive payment notifications for Colombia Virtual Account payments.

Colombia Virtual Account payments use `Bre-B` as the payment method.

The Virtual Account is created before the payer initiates a transfer. Creating the Virtual Account does not create a fixed-amount payment order. After funds are transferred to the assigned `account_number`, Pagsmile creates the Payin transaction and sends an asynchronous notification to the merchant's `notify_url`.

#### Create Virtual Account

Use this endpoint to create a Virtual Account for Colombia.

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/virtual-account/create`

**Request Body**

Only the required request parameters are listed below.

<table><thead><tr><th width="220">Parameter</th><th width="100">Type</th><th width="110">Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>Required</td><td>Maximum length: 32 characters.</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Required</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; maximum length: 19 characters.</td><td>Request timestamp.</td></tr><tr><td><code>notify_url</code></td><td>string</td><td>Required</td><td>Must be a valid, publicly accessible URL.</td><td>The URL that receives Virtual Account payment notifications.</td></tr><tr><td><code>method</code></td><td>string</td><td>Required</td><td>Fixed value: <code>Bre-B</code>.</td><td>Payment method.</td></tr><tr><td><code>region</code></td><td>string</td><td>Required</td><td>Fixed value: <code>COL</code>.</td><td>Country or region code.</td></tr><tr><td><code>customer</code></td><td>object</td><td>Required</td><td>Must contain <code>customer.buyer_id</code>.</td><td>Customer information.</td></tr><tr><td><code>customer.buyer_id</code></td><td>string</td><td>Required</td><td>Maximum length: 128 characters.</td><td>Merchant-side user ID.</td></tr></tbody></table>

**Request Sample**

```json
{
  "app_id": "16***05",
  "timestamp": "2026-08-24 15:30:00",
  "notify_url": "https://merchant.example.com/pagsmile/notify",
  "method": "Bre-B",
  "region": "COL",
  "customer": {
    "buyer_id": "colombia-va-test-001"
  }
}
```

**Response Sample**

```json
{
  "code": "10000",
  "msg": "Success",
  "account_id": "CD***RH",
  "account_number": "@VA***NRH",
  "buyer_id": "colombia-va-test-001",
  "status": "ACTIVE",
  "notify_url": "https://merchant.example.com/pagsmile/notify",
  "method": "Bre-B"
}
```

Save the returned `account_id` and `account_number`. The payer transfers funds to the `account_number` to complete a payment.

#### Query Virtual Account

Use this endpoint to query the Virtual Account information and status.

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/virtual-account/query`

**Request Body**

<table><thead><tr><th width="180">Parameter</th><th width="100">Type</th><th width="110">Required</th><th>Constraints</th><th>Description</th></tr></thead><tbody><tr><td><code>app_id</code></td><td>string</td><td>Required</td><td>Maximum length: 32 characters.</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Required</td><td>Format: <code>yyyy-MM-dd HH:mm:ss</code>; maximum length: 19 characters.</td><td>Request timestamp.</td></tr><tr><td><code>account_id</code></td><td>string</td><td>Required</td><td>Maximum length: 64 characters.</td><td>The Virtual Account ID returned by the Create Virtual Account API.</td></tr></tbody></table>

**Request Sample**

```json
{
  "app_id": "16***05",
  "timestamp": "2026-08-24 15:35:00",
  "account_id": "CD***RH"
}
```

**Response Sample**

```json
{
  "code": "10000",
  "msg": "Success",
  "account_id": "CD***RH",
  "account_number": "@VA***NRH",
  "buyer_id": "colombia-va-test-001",
  "status": "ACTIVE",
  "notify_url": "https://merchant.example.com/pagsmile/notify",
  "method": "Bre-B"
}
```

{% hint style="info" %}
The Query Virtual Account API returns the Virtual Account information and status. It does not return the result of an incoming transfer. Use the asynchronous notification as the final payment result.
{% endhint %}

#### Notification

After the payer transfers funds to the Virtual Account, Pagsmile sends an asynchronous notification to the merchant's `notify_url`.

**Notification Body**

<table><thead><tr><th width="300">Parameter</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount</code></td><td>string</td><td>Payment amount received.</td></tr><tr><td><code>out_trade_no</code></td><td>string</td><td>Pagsmile-generated transaction reference for the incoming transfer.</td></tr><tr><td><code>method</code></td><td>string</td><td>Payment method. Fixed value: <code>Bre-B</code>.</td></tr><tr><td><code>trade_status</code></td><td>string</td><td>Transaction status. Value: <code>SUCCESS</code>.</td></tr><tr><td><code>trade_no</code></td><td>string</td><td>Pagsmile transaction number.</td></tr><tr><td><code>currency</code></td><td>string</td><td>Payment currency. Fixed value: <code>COP</code>.</td></tr><tr><td><code>app_id</code></td><td>string</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>user.buyer_id</code></td><td>string</td><td>Merchant-side user ID used when creating the Virtual Account.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Unix timestamp in seconds indicating when the notification was generated.</td></tr><tr><td><code>transfer_account.account_id</code></td><td>string</td><td>Virtual Account ID.</td></tr><tr><td><code>transfer_account.account_number</code></td><td>string</td><td>Virtual Account number.</td></tr></tbody></table>

**Notification Sample**

#### Notification

After the payer transfers funds to the Virtual Account, Pagsmile sends an asynchronous notification to the merchant's `notify_url`.

**Notification Body**

<table><thead><tr><th width="300">Parameter</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount</code></td><td>string</td><td>Payment amount received.</td></tr><tr><td><code>out_trade_no</code></td><td>string</td><td>Pagsmile-generated transaction reference for the incoming transfer.</td></tr><tr><td><code>method</code></td><td>string</td><td>Payment method. Fixed value: <code>Bre-B</code>.</td></tr><tr><td><code>trade_status</code></td><td>string</td><td>Transaction status. Value: <code>SUCCESS</code>.</td></tr><tr><td><code>trade_no</code></td><td>string</td><td>Pagsmile transaction number.</td></tr><tr><td><code>currency</code></td><td>string</td><td>Payment currency. Fixed value: <code>COP</code>.</td></tr><tr><td><code>app_id</code></td><td>string</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td><code>user.buyer_id</code></td><td>string</td><td>Merchant-side user ID used when creating the Virtual Account.</td></tr><tr><td><code>user.ip</code></td><td>string</td><td>IP address stored with the user information.</td></tr><tr><td><code>payer.account.number</code></td><td>string</td><td>Payer bank account number.</td></tr><tr><td><code>payer.account.type</code></td><td>string</td><td>Payer account type reported by the provider. Example: <code>DORD</code>.</td></tr><tr><td><code>payer.bank.bank_id</code></td><td>string</td><td>Identifier of the payer's bank.</td></tr><tr><td><code>payer.bank.bank_name</code></td><td>string</td><td>Name of the payer's bank.</td></tr><tr><td><code>payer.identification.number</code></td><td>string</td><td>Payer identification number.</td></tr><tr><td><code>payer.identification.type</code></td><td>string</td><td>Payer identification type. Example: <code>NIT</code>.</td></tr><tr><td><code>card</code></td><td>object</td><td>Card information. This object is empty for a <code>Bre-B</code> bank transfer notification.</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Unix timestamp in seconds indicating when the notification was generated.</td></tr><tr><td><code>transfer_account.account_id</code></td><td>string</td><td>Virtual Account ID.</td></tr><tr><td><code>transfer_account.account_number</code></td><td>string</td><td>Virtual Account number.</td></tr></tbody></table>

**Notification Sample**

```json
{
  "amount": "1000.00",
  "out_trade_no": "90***1d",
  "method": "Bre-B",
  "trade_status": "SUCCESS",
  "trade_no": "202***63",
  "currency": "COP",
  "app_id": "163***05",
  "user": {
    "buyer_id": "24***3",
    "ip": "0.0.0.0"
  },
  "payer": {
    "account": {
      "number": "63***6",
      "type": "DORD"
    },
    "bank": {
      "bank_id": "9**5",
      "bank_name": "Kamin"
    },
    "identification": {
      "number": "9**0",
      "type": "NIT"
    }
  },
  "card": {},
  "timestamp": "1785470128",
  "transfer_account": {
    "account_id": "C***H",
    "account_number": "@VA***H"
  }
}
```

Use the asynchronous notification as the final payment result. The merchant callback endpoint must return HTTP status `200` with one of the following response bodies:

```
success
```

or

```json
{"result":"success"}
```

Pagsmile includes the following header in the notification:

```
Pagsmile-Signature: t=<unix_timestamp>,v2=<hmac_sha256>
```

Calculate the expected signature by applying HMAC-SHA256 to the original, unmodified Request Body using the merchant SecretKey. Do not parse and reserialize the JSON before signature verification. For more information, see [Notification](https://docs.pagsmile.com/payin/notification).


# Bre-B

How to use Bre-B to submit a payin in Colombia.

## Payin by Bre-B

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Bre-B in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                    |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                   |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                           |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                       |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Bre-B                                                                                             |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#colombia">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: COP                                                                                               |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                   |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                           |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout.                                                        |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- NIT, CC or CE -</p>                                                      |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- NIT: 10 digits, CC: 6<del>10 digits, CE: 5</del>12 characters -</p>       |

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

```
{
    "code":"10000",
    "msg":"Success",
    "prepay_id":"TDBySTJ0******1LST0=-D5D3c75F",
    "trade_no":"2025****399",
    "out_trade_no":"out_no_338****458",
    "web_url":"",
    "pay_url": "https://gateway.***",
    "trade_status":"PROCESSING",
    "qr_code":"00020*****4394B",
    "qr_code_img":"iVBORw0KGgo*****K5CYII="
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "out_no_338****458",
    * "method": "Bre-B",
    * "order_amount": "1000",
    * "order_currency": "COP",
    * "subject": "trade pay test",
      "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "identify": {
    *         "type": "NIT",
    *         "number": "1234123121"
          },
    *     "name": "Test User Name"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Credit Card

How to use Credit Card to submit a payin in Colombia.

### Payin by CreditCard

Colombia CreditCard supports Direct Integration. The payment flow includes two steps:

1. Tokenize the card information through the Card Tokenize API.
2. Use the returned card token to submit a payin through the Submit a Payin API.

{% hint style="info" %}
Colombia CreditCard supports refund.
{% endhint %}

### Step 1: Tokenize Card

<mark style="color:green;">POST</mark> `https://security-test.pagsmile.com/card/tokenize`

Use this API to tokenize the card information. The returned `token` will be used in Step 2.

#### Request Body

| Parameter               | Type   | Required | Constraints                   | Description                                       |
| ----------------------- | ------ | -------- | ----------------------------- | ------------------------------------------------- |
| app\_id                 | string | Required | Max length: 32                | The merchant application ID assigned by Pagsmile. |
| format                  | string | Required | Fixed value: `JSON`           | Request format.                                   |
| version                 | string | Required | Fixed value: `2.0`            | API version.                                      |
| timestamp               | string | Required | Format: `yyyy-MM-dd HH:mm:ss` | Request timestamp.                                |
| card                    | object | Required | -                             | Card information.                                 |
| card.card\_no           | string | Required | -                             | Card number.                                      |
| card.issuer             | string | Required | Example: `visa`               | Card issuer.                                      |
| card.holder             | object | Required | -                             | Cardholder information.                           |
| card.holder.name        | string | Required | -                             | Cardholder name.                                  |
| card.cvv                | string | Required | -                             | Card CVV.                                         |
| card.valid\_thru\_year  | string | Required | Format: `yyyy`                | Card expiration year.                             |
| card.valid\_thru\_month | string | Required | Format: `MM`                  | Card expiration month.                            |

#### Request Sample

```json
{
  "app_id": "163***05",
  "format": "JSON",
  "version": "2.0",
  "timestamp": "2026-06-15 14:18:10",
  "card": {
    "card_no": "48***8",
    "issuer": "visa",
    "holder": {
      "name": "user name"
    },
    "cvv": "123",
    "valid_thru_year": "2039",
    "valid_thru_month": "12"
  }
}
```

#### Response Sample

```json
{
  "code": "10000",
  "msg": "Success",
  "token": "psct_cc7***a83"
}
```

### Step 2: Submit Payin with Token

<mark style="color:green;">POST</mark> `https://gateway-test.pagsmile.com/trade/pay`

Use the `token` returned in Step 1 to submit the payin.

#### Request Body

| Parameter                | Type   | Required | Constraints                     | Description                                       |
| ------------------------ | ------ | -------- | ------------------------------- | ------------------------------------------------- |
| app\_id                  | string | Required | Max length: 32                  | The merchant application ID assigned by Pagsmile. |
| timestamp                | string | Required | Format: `yyyy-MM-dd HH:mm:ss`   | Request timestamp.                                |
| out\_trade\_no           | string | Required | Max length: 64                  | Merchant order number. Must be unique.            |
| method                   | string | Required | Fixed value: `CreditCard`       | Payment method.                                   |
| order\_amount            | string | Required | Supports up to 2 decimal places | Payment amount.                                   |
| order\_currency          | string | Required | Fixed value: `COP`              | Payment currency.                                 |
| subject                  | string | Required | Max length: 128                 | Payment subject or order title.                   |
| content                  | string | Required | Max length: 255                 | Payment content or order description.             |
| trade\_type              | string | Required | Fixed value: `API`              | Trade type.                                       |
| notify\_url              | string | Required | Valid URL                       | The URL to receive payment notifications.         |
| return\_url              | string | Required | Valid URL                       | The URL to redirect the customer after payment.   |
| buyer\_id                | string | Required | Max length: 64                  | Merchant-side customer ID.                        |
| timeout\_express         | string | Optional | -                               | Payment expiration time.                          |
| token                    | string | Required | -                               | The card token returned by the Card Tokenize API. |
| issuer                   | string | Required | Example: `visa`                 | Card issuer.                                      |
| customer                 | object | Required | -                               | Customer information.                             |
| customer.identify        | object | Required | -                               | Customer identification information.              |
| customer.identify.type   | string | Required | Example: `CC`                   | Customer identification type.                     |
| customer.identify.number | string | Required | -                               | Customer identification number.                   |
| customer.email           | string | Required | Valid email; max length: 64     | Customer email address.                           |

#### Request Sample

```json
{
  "app_id": "163***305",
  "timestamp": "2026-07-14 13:04:25",
  "out_trade_no": "out_tra***500",
  "method": "CreditCard",
  "order_amount": "1100",
  "order_currency": "COP",
  "subject": "descriptor-PAGSMIL*Hype games",
  "content": "trade pay conent",
  "trade_type": "API",
  "notify_url": "https://www.xcloudgame.com/",
  "return_url": "https://www.xcloudgame.com/",
  "buyer_id": "20260714001",
  "timeout_express": "1c",
  "token": "psct_dd***3",
  "issuer": "visa",
  "customer": {
    "identify": {
      "type": "CC",
      "number": "27***22"
    },
    "email": "TEST@gmail.com"
  }
}
```

#### Response Sample

```json
{
  "code": "10000",
  "msg": "Success",
  "sub_code": "200",
  "sub_msg": "",
  "prepay_id": "Qjd***665e9ac",
  "trade_no": "2026****97",
  "out_trade_no": "out_tr***500",
  "web_url": "",
  "trade_status": "PROCESSING",
  "check_url": "https://checkout.y.uno/payment?session=58***59e&3ds=true"
}
```

{% hint style="info" %}
If `check_url` is returned, redirect the customer to the `check_url` to complete the required authentication process.
{% endhint %}


# PSE

How to use PSE to submit a payin in Colombia.

{% hint style="warning" %}
This page was updated on 2024/11/13
{% endhint %}

## Payin by PSE

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by PSE in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                    |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                   |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                           |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                       |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: PSE                                                                                               |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#colombia">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: COP                                                                                               |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                   |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                           |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout. **Doesn't work on provider's page.**                   |
| bank<mark style="color:red;">\*</mark>                     | string | Use [API](https://docs.pagsmile.com/payin/tools/supported-bank-list-query) to get bank id.                     |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- NIT, CC or CE -</p>                                                      |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- NIT: 10 digits, CC: 6<del>10 digits, CE: 5</del>12 characters -</p>       |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                   |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone. Start with "57"                                                                                  |
| address.line1<mark style="color:red;">\*</mark>            | string |                                                                                                                |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354005",
    * "method": "PSE",
    * "order_amount": "3000",
    * "order_currency": "COP",
    * "subject": "trade pay test",
      "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "bank":"1040",
    * "customer": {
    *     "identify": {
    *         "type": "NIT",
    *         "number": "1234123121"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "57468****068"
      },
    * "address":{
    *     "line1": "test address line1"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Transfiya

How to use Transfiya to submit a payin in Colombia.

## Payin by Transfiya

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Transfiya in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                                    |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                   |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                           |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                                       |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Transfiya                                                                                         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#colombia">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: COP                                                                                               |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                             |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                   |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                           |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout. **Doesn't work on provider's page.**                   |
| customer.name<mark style="color:red;">\*</mark>   | string | User's name                                                                                                    |
| customer.email<mark style="color:red;">\*</mark>  | string | User's email                                                                                                   |
| customer.phone<mark style="color:red;">\*</mark>  | string | User's phone. **Must start with "57"**. A text message will be sent to this phone number.                      |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "trade_status": "PROCESSING",
    "prepay_id": ""
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**User payment tips:**

* The user needs to activate Transfiya in the bank app first.
* When the transaction is created, the user will receive a text message indicating that a payment has been accepted through Transfiya. If the user has not received the message, check directly in the app of the bank where the user has Transfiya active.
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354005",
    * "method": "Transfiya",
    * "order_amount": "3000",
    * "order_currency": "COP",
    * "subject": "trade pay test",
      "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "57468****068" //The phone number must include "57" to receive the text message.
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}

## How to Activate Transfiya in Colombia

Although each bank has its own specific process, here’s a general step-by-step guide that most banks follow:

1. Download or update your bank’s app

Make sure you have your bank’s mobile application installed and updated.

2. Log in to the banking app

Use your credentials (username and password) to access the app.

3. Look for the Transfiya option

This option is usually found in the “Transfers,” “Payments,” or “Special Services” sections.

4. Link your mobile number

• Select the option to register or activate Transfiya.

• Enter your mobile phone number (it must be the one registered with the bank).

• Some banks may require you to confirm the link using a code sent via SMS.

\_\_\_\_\_

In this link, you can find step-by-step instructions on how to send and receive money through Transfiya.

<https://heyzine.com/flip-book/1a15ffd4bc.html#page/1>


# Efecty

How to use Efecty to submit a payin in Colombia.

## Payin by Efecty

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Efecty in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                    |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                   |
| customer.phone                                             | string | User's phone. Start with "57"                                                                                  |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                   |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- NIT: 10 digits, CC: 6\~10 digits -</p>                                 |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Efecty                                                                                            |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                           |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                       |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- NIT or CC -</p>                                                          |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                    |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                   |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#colombia">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: COP                                                                                               |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                           |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                             |
| address.zip\_code                                          | string | <p>zip code</p><p>- 6 digits -</p>                                                                             |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                           |
| address.street                                             | string | street                                                                                                         |
| address.street\_number                                     | string | street number                                                                                                  |
| address.city                                               | string | city                                                                                                           |
| address.state                                              | string | state                                                                                                          |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout. **Doesn't work on provider's page.**                   |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354004",
    "web_url": "",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
This page was updated on 2023/3/21
{% endhint %}

{% hint style="info" %}
**User payment tips**

* Providing a locator could help the user to find a store faster. Can link it to <https://www.efecty.com.co/web/puntos-de-atencion>
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354004",
    * "method": "Efecty",
    * "order_amount": "3000",
    * "order_currency": "COP",
    * "subject": "trade pay test",
      "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "NIT",
    *         "number": "1234123121"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

![User payment page](https://4142198059-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgOGd5QxlX-U1mkQpVU%2Fuploads%2FX2EjJ9CYQVmoql5jxljV%2Fimage.png?alt=media\&token=f6d8b05e-094e-4557-9c46-47fad1596a79)

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Bancolombia

How to use Bancolombia to submit a payin in Colombia.

## Payin by Bancolombia

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Bancolombia in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                    |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                   |
| customer.phone                                             | string | User's phone. Start with "57"                                                                                  |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                   |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- NIT: 10 digits, CC: 6\~10 digits -</p>                                 |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Bancolombia                                                                                       |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                           |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                       |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- NIT or CC -</p>                                                          |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                    |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                   |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#colombia">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: COP                                                                                               |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                           |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                             |
| address.zip\_code                                          | string | <p>zip code</p><p>- 6 digits -</p>                                                                             |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                           |
| address.street                                             | string | street                                                                                                         |
| address.street\_number                                     | string | street number                                                                                                  |
| address.city                                               | string | city                                                                                                           |
| address.state                                              | string | state                                                                                                          |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout. **Doesn't work on provider's page.**                   |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354004",
    "web_url": "",
    "pay_url": "https://checkoutv2.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING",
    "reference":"90974588243",
    "partner_code":"54245"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* Providing a locator could help the user to find a store faster. Can link it to <https://www.bancolombia.com/puntos-de-atencion/buscar-en-mapa>
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354004",
    * "method": "Bancolombia",
    * "order_amount": "5000",
    * "order_currency": "COP",
    * "subject": "trade pay test",
      "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "NIT",
    *         "number": "1234123121"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Daviplata

How to use Bancolombia to submit a payin in Colombia.

## Payin by Daviplata

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Bancolombia in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                            |
| ---------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>Created app's ID at dashboard.<br>Max. 32 chars.</p>                                                |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: `Daviplata`.                                                                              |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: `COP`.                                                                                    |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>Payment amount.<br>Range: <code>1,500.00</code> - <code>10,000,000.00</code> .<br>Only integer.</p> |
| subject<mark style="color:red;">\*</mark>                  | string | <p>Payment reason or item title.<br>Max. 128 chars.</p>                                                |
| content<mark style="color:red;">\*</mark>                  | string | <p>Payment reason detail or item detail.<br>Max. 255 chars.</p>                                        |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>Format: <code>yyyy-MM-dd HH:mm:ss</code>.<br>Max. 19 chars.</p>                                     |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to.                                                              |
| buyer\_id<mark style="color:red;">\*</mark>                | string | Merchant user's ID.                                                                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- NIT or CC -</p>                                                  |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>-NIT: 10 digits,</p><p>CC: 6\~10 digits -</p>                       |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                           |

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

```
{
    "code":"10000",
    "msg":"Success",
    "prepay_id":"cC8***63B9",
    "trade_no":"2026***238",
    "out_trade_no":"out_trade_no_12***75",
    "web_url":"",
    "pay_url":"https://daviplata.wompi.co/es/sad***1jyI",
    "trade_status":"PROCESSING"
}

```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway.pagsmile.com/trade/pay' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "out_trade_no_123***875",
    "method": "Daviplata",
    "order_currency": "COP",
    "order_amount": "1500",
    "subject": "trade pay test",
    "content": "trade pay test content",
    "timestamp": "2021-08-04 18:50:42",
    "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    "buyer_id": "buyer_0101_0001",
    "customer": {
        "identify": {
            "type": "CC",
            "number": "11***93"
        },
        "email": "test@mail.com"
    }
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Wallet

How to use Wallet to submit a payin in Colombia.

## Payin by Wallet

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Wallet in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                          |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                         |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Wallet                                                                                                  |
| channel<mark style="color:red;">\*</mark>                  | string | <p>Wallet type<br>- TPaga, Dale, Daviplata, Movii, Nequi, Rappipay -</p>                                             |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: COP                                                                                                     |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#colombia">here</a> for limits -</p>       |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                 |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                                 |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                      |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                             |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                         |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                                   |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                          |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                         |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone. Start with "57"                                                                                        |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- NIT or CC -</p>                                                                |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- NIT: 10 digits, CC: 6\~10 digits -</p>                                       |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                                 |
| address.zip\_code                                          | string | <p>zip code<br>- 6 digits -</p>                                                                                      |
| address.street<mark style="color:red;">\*</mark>           | string | <p>street<br>- Required for Dale, Daviplata, Movii, Nequi, Rappipay;<br><strong>Not</strong> require for TPaga -</p> |
| address.street\_number                                     | string | street number                                                                                                        |
| address.city                                               | string | city                                                                                                                 |
| address.state                                              | string | state                                                                                                                |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                               |

{% tabs %}
{% tab title="200 submit successfully" %}
{% tabs %}
{% tab title="TPaga" %}

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "QVUvcG00ZDl6MFVsWkZsTk1IwRDlTZEdnVThOUGxyeHVnZkROND0=-D161Bae8",
    "trade_no": "22022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "trade_status": "PROCESSING",
    "wallet_url": "https://w.tpaga.co/eyJtIjp7Im8iOiJQUiJ9LCJkIjp7InMiOiJQYWdzbWlsZSIsInBydCI6InByLTJlZmYyMzI4NjgxNDNkNjA5OGVlZGJjNGY1YWQ3NjNmMzMxNjdkZmJiYWNkYTc3ZDUxZTgyMzY4ODg4NWRlZTM0ZDViYzM0NyJ9fQ==" //Generate a QR code of this link to allow users scan to pay
}
```

{% endtab %}

{% tab title="Dale" %}

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "QVUvcG00ZDl6MFVsWkZsTk1IwRDlTZEdnVThOUGxyeHVnZkROND0=-D161Bae8",
    "trade_no": "22022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "trade_status": "PROCESSING",
    "wallet_url": "https://registro.pse.com.co/PSENF/index.html?enc="
}
```

{% endtab %}

{% tab title="Daviplata" %}

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "QVUvcG00ZDl6MFVsWkZsTk1IwRDlTZEdnVThOUGxyeHVnZkROND0=-D161Bae8",
    "trade_no": "22022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "trade_status": "PROCESSING",
    "wallet_url": "https://registro.pse.com.co/PSENF/index.html?enc="
}
```

{% endtab %}

{% tab title="Movii" %}

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "QVUvcG00ZDl6MFVsWkZsTk1IwRDlTZEdnVThOUGxyeHVnZkROND0=-D161Bae8",
    "trade_no": "22022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "trade_status": "PROCESSING",
    "wallet_url": "https://registro.pse.com.co/PSENF/index.html?enc="
}
```

{% endtab %}

{% tab title="Nequi" %}

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "QVUvcG00ZDl6MFVsWkZsTk1IwRDlTZEdnVThOUGxyeHVnZkROND0=-D161Bae8",
    "trade_no": "22022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "trade_status": "PROCESSING",
    "wallet_url": "https://registro.pse.com.co/PSENF/index.html?enc="
}
```

{% endtab %}

{% tab title="Rappipay" %}

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id": "QVUvcG00ZDl6MFVsWkZsTk1IwRDlTZEdnVThOUGxyeHVnZkROND0=-D161Bae8",
    "trade_no": "22022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "trade_status": "PROCESSING",
    "wallet_url": "https://registro.pse.com.co/PSENF/index.html?enc="
}
```

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

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354004",
    * "method": "Wallet",
    * "channel": "TPaga",
    * "order_amount": "12",
    * "order_currency": "COP",
    * "subject": "trade pay test",
      "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer": {
    *     "identify": {
    *         "type": "NIT",
    *         "number": "1234123121"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "57468****068"
       },
    *  "address": {
    *	  "street": "test address wer" //Required for ClaroPay, Dale, Daviplata, Movii, Nequi, Rappipay; Not require for TPaga
       }
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Gana

How to use Gana to submit a payin in Colombia.

## Payin by Gana

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Gana in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                    |
| ------------------------------------------------- | ------ | ------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                   |
| customer.phone                                    | string | User's phone. Start with "57"                                                  |
| customer.email<mark style="color:red;">\*</mark>  | string | User's email                                                                   |
| customer.identify.number                          | string | <p>User's identification number</p><p>- NIT: 10 digits, CC: 6\~10 digits -</p> |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Gana                                                              |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>           |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                       |
| customer.identify.type                            | string | <p>User's identification type</p><p>- NIT or CC -</p>                          |
| customer.name                                     | string | User's name                                                                    |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                   |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 1,000\~3,000,000 COP -</p>                              |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: COP                                                               |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>           |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                             |
| address.zip\_code                                 | string | <p>zip code</p><p>- 6 digits -</p>                                             |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                           |
| address.street                                    | string | street                                                                         |
| address.street\_number                            | string | street number                                                                  |
| address.city                                      | string | city                                                                           |
| address.state                                     | string | state                                                                          |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout                         |

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id":"eG1HTm5PQm10TnBiWk5nd2MycjdNZXlZS282OWN0OEpmNXBXN2V1aTFzOD0=-48aB24cB",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354004",
    "web_url": "",
    "pay_url": "https://checkoutv2.pagsmile.com/checkout?prepay_id=eG1HTm5PQm10TnBiWk5nd2MycjdNZXlZS282OWN0OEpmNXBXN2V1aTFzOD0=-48aB24cB",
    "trade_status": "PROCESSING",
    "partner_code":"260",
    "reference":"35972550"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

Users need to use the **partner\_code** and **reference** to make payment at local store.
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354004",
    * "method": "Gana",
    * "order_amount": "3000",
    * "order_currency": "COP",
    * "subject": "trade pay test",
      "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "NIT",
    *         "number": "1234123121"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# SuRed

How to use SuRed to submit a payin in Colombia.

{% hint style="danger" %}
SuRed is no longer available since July 25th
{% endhint %}

## Payin by SuRed

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by SuRed in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                                    |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                   |
| customer.phone                                             | string | User's phone. Start with "57"                                                                                  |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                                   |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- NIT: 10 digits, CC: 6\~10 digits -</p>                                 |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: SuRed                                                                                             |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                           |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                                       |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- NIT or CC -</p>                                                          |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                                    |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                   |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method#colombia">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: COP                                                                                               |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                           |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                                             |
| address.zip\_code                                          | string | <p>zip code</p><p>- 6 digits -</p>                                                                             |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                                           |
| address.street                                             | string | street                                                                                                         |
| address.street\_number                                     | string | street number                                                                                                  |
| address.city                                               | string | city                                                                                                           |
| address.state                                              | string | state                                                                                                          |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                                         |

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id":"eG1HTm5PQm10TnBiWk5nd2MycjdNZXlZS282OWN0OEpmNXBXN2V1aTFzOD0=-48aB24cB",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354004",
    "web_url": "",
    "pay_url": "https://checkoutv2.pagsmile.com/checkout?prepay_id=eG1HTm5PQm10TnBiWk5nd2MycjdNZXlZS282OWN0OEpmNXBXN2V1aTFzOD0=-48aB24cB",
    "trade_status": "PROCESSING",
    "partner_code":"PAYVALIDA",
    "reference":"35972550"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

Users need to use the **partner\_code** and **reference** to make payment at local store.
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354004",
    * "method": "SuRed",
    * "order_amount": "3000",
    * "order_currency": "COP",
    * "subject": "trade pay test",
      "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "timeout_express":"1c",
    * "customer" : {
    *     "identify": {
    *         "type": "NIT",
    *         "number": "1234123121"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Baloto

How to use Baloto to submit a payin in Colombia.

{% hint style="danger" %}
Baloto no longer supported
{% endhint %}

## Payin by Baloto

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Baloto in Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                          |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone                                                         |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                         |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- 9 digits -</p>                  |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Baloto                                                  |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                             |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- NIT or CC -</p>                |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                          |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 5,000\~1,000,000 COP -</p>                    |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: COP                                                     |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                   |
| address.zip\_code<mark style="color:red;">\*</mark>        | string | <p>zip code</p><p>- 6 digits -</p>                                   |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |
| address.street                                             | string | <p>street</p><p>- Required if zip\_code not provide -</p>            |
| address.street\_number                                     | string | <p>street number</p><p>- Required if zip\_code not provide -</p>     |
| address.city                                               | string | <p>city</p><p>- Required if zip\_code not provide -</p>              |
| address.state                                              | string | <p>state<br>- Required if zip\_code not provide -</p>                |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id":"QVUvcG00ZDl6MFVsWkZsTk1IwRDlTZEdnVThOUGxyeHVnZkROND0=-D161Bae8",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354005",
    "web_url": "",
    "pay_url": "https://checkout-testv2.pagsmile.com/checkout?prepay_id=QVUvcG0k1IUWVRVkxwRDlTZEdnVThOUGxyeHVnZkROND0=-D161Bae8",
    "trade_status": "PROCESSING",
    "reference":"85367736"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354005",
    "method": "Baloto",
    "order_amount": "5100",
    "order_currency": "COP",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"1c",
    "customer" : {
        "identify": {
            "type": "NIT",
            "number": "502844147"
        },
        "name": "Test User Name",
        "email": "test@pagsmile.com",
        "phone": "3007654321"
    },
    "address" : {
        "zip_code": "300760",
    }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Costa Rica

Costa Rica methods for API direct payment


# Credit Card

How to use CreditCard to submit a payin in Costa Rica.

## Payin by CreditCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by CreditCard in Costa Rica.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CreditCard</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- 500 ~ 1,000,000 -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CRC</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>token<mark style="color:red;">*</mark></td><td>string</td><td>Get from <a href="/reference/payin/tools/tokenize">here</a></td></tr><tr><td>customer.name<mark style="color:red;">*</mark></td><td>string</td><td>User's name</td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "out***300",
    "trade_status": "PROCESSING",
    "trade_no": "20240***34",
    "prepay_id": "UloyV0l3NFFyW***DTT0=-645a8F4c"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "CRC",
    * "method": "CreditCard",
    * "order_amount": "2000",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023",
    * "version": "2.0",
    * "token": "psc****d1f4",
    * "customer": {
    *     "name": "Test User Name"
      }
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Credit Card Pre Auth

How to use CreditCard Pre Auth in Costa Rica.

## Payin by CreditCard Pre Auth

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pre-authorization`

This endpoint allows you to submit CreditCard Pre Auth in Costa Rica.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- 500 ~ 1,000,000 -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CRC</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>token<mark style="color:red;">*</mark></td><td>string</td><td>Get from <a href="/reference/payin/tools/tokenize">here</a></td></tr><tr><td>customer.name<mark style="color:red;">*</mark></td><td>string</td><td>User's name</td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "sub_code": "200",
    "sub_msg": "OK",
    "out_trade_no": "out***300",
    "trade_no": "20240***34",
    "prepay_id": "UloyV0l3NFFyW***DTT0=-645a8F4c"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pre-authorization' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "CRC",
    * "order_amount": "2000",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "trade_type": "API",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023",
    * "version": "2.0",
    * "token": "psc****d1f4",
    * "customer": {
    *     "name": "Test User Name"
      }
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Capture

How to capture an authorization.

## Capture Authorization

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/capture`

This endpoint allows you to capture an authorization.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                             | Type   | Description                                                          |
| ------------------------------------------------ | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>        | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| timestamp<mark style="color:red;">\*</mark>      | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| version                                          | string | fixed value: 2.0                                                     |
| amount<mark style="color:red;">\*</mark>         | string | 500 \~ 1,000,000                                                     |
| currency<mark style="color:red;">\*</mark>       | string | Fixed value: CRC                                                     |
| out\_trade\_no<mark style="color:red;">\*</mark> | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |

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

```json
{
    "msg": "Success",
    "code": "10000"
}
```

{% endtab %}

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

```json
{
    "code":"40002",
    "msg":"Business Failed",
    "sub_code":"invalid-signature",
    "sub_msg":"invalid signature"
}
```

{% endtab %}
{% endtabs %}

### Example

```
curl --location --request POST 'https://security-test.pagsmile.com/trade/capture' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "1617***052",
    "timestamp": "2022-08-11 10:26:03",
    "version": "2.0",
    "amount": "2000",
    "currency": "CRC",
    "out_trade_no": "out_18***1300"
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Void

How to void an authorization.

{% hint style="info" %}
An authorization can be voided before it is captured if the payment is no longer needed.
{% endhint %}

## Void Authorization

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/void`

This endpoint allows you to void an authorization.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                             | Type   | Description                                                                                                                 |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>        | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                |
| timestamp<mark style="color:red;">\*</mark>      | string | <p>yyyy-MM-dd HH<span data-gb-custom-inline data-tag="emoji" data-code="1f1f2-1f1f2">🇲🇲</span>ss<br>- Max. 19 chars -</p> |
| version                                          | string | fixed value: 2.0                                                                                                            |
| out\_trade\_no<mark style="color:red;">\*</mark> | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                        |

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

```json
{
    "msg": "Success",
    "code": "10000"
}
```

{% endtab %}

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

```json
{
    "msg": "Business Failed",
    "code": "40002"
}
```

{% endtab %}
{% endtabs %}

### Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/void' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "1617****052",
    "timestamp": "2022-08-11 16:17:36",
    "version": "2.0",
    "out_trade_no": "836***93"
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Cash

How to use Cash to submit a payin in Costa Rica.

## Payin by Cash

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Cash in Costa Rica.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| customer.phone                                    | string | User's phone                                                         |
| customer.email<mark style="color:red;">\*</mark>  | string | User's email                                                         |
| customer.identify.number                          | string | <p>User's identification number</p><p>- 9 digits -</p>               |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Cash                                                    |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| customer.identify.type                            | string | <p>User's identification type</p><p>- CDI -</p>                      |
| customer.name<mark style="color:red;">\*</mark>   | string | User's name                                                          |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 600\~1700000 CRC -</p>                        |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: CRC                                                     |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| address.zip\_code                                 | string | <p>zip code<br>- 5 digits -</p>                                      |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |
| address.street                                    | string | <p>street</p><p>- Required if zip\_code not provide -</p>            |
| address.street\_number                            | string | <p>street number</p><p>- Required if zip\_code not provide -</p>     |
| address.city                                      | string | <p>city</p><p>- Required if zip\_code not provide -</p>              |
| address.state                                     | string | <p>state<br>- Required if zip\_code not provide -</p>                |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010106532400030",
    "out_trade_no": "202201010354009",
    "web_url": "",
    "pay_url":"https://checkout-test.pagsmile.com/checkout?prepay_id=QXN****lWT0=-eBD41c98",
    "trade_status": "PROCESSING",
    "reference": "732987"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354009",
    "method": "Cash",
    "order_amount": "12.01",
    "order_currency": "CRC",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"1c",
    "customer" : {
        "identify": {
            "type": "CDI",
            "number": "502844147"
        },
        "name": "Test User Name",
        "email": "test@pagsmile.com",
    }
    }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# BNCR

How to use BNCR to submit a payin in Costa Rica.

## Payin by BNCR

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by BNCR in Costa Rica.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| customer.phone<mark style="color:red;">\*</mark>  | string | User's phone                                                         |
| customer.email<mark style="color:red;">\*</mark>  | string | User's email                                                         |
| customer.identify.number                          | string | <p>User's identification number<br>- 9 digits -</p>                  |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: BNCR                                                    |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| customer.identify.type                            | string | <p>User's identification type</p><p>- CDI -</p>                      |
| customer.name<mark style="color:red;">\*</mark>   | string | User's name                                                          |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 1000\~600,000 CRC<br>(only integer) -</p>     |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: CRC                                                     |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| address.zip\_code                                 | string | <p>zip code<br>- 5 digits -</p>                                      |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                 |
| address.street                                    | string | <p>street</p><p>- Required if zip\_code not provide -</p>            |
| address.street\_number                            | string | <p>street number</p><p>- Required if zip\_code not provide -</p>     |
| address.city                                      | string | <p>city</p><p>- Required if zip\_code not provide -</p>              |
| address.state                                     | string | <p>state<br>- Required if zip\_code not provide -</p>                |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010106532400030",
    "out_trade_no": "202201010354009",
    "web_url": "",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING",
    "reference": "90985633144",
    "partner_code":"" //The partner_code could be different
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User payment tips**

* A BNCR order can be paid through e-banking or at Branches and Agencies.
* The maximum amount per transaction through **BNCR e-banking** is **CRC ₡ 600,000.00**. The maximum amount per transaction at BNCR at **Branches** and **Agencies** is **CRC ₡ 190,000.00**
  {% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354009",
    "method": "BNCR",
    "order_amount": "1000",
    "order_currency": "CRC",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"1c",
    "customer" : {
        "identify": {
            "type": "CDI",
            "number": "502844147"
        },
        "name": "Test User Name",
        "email": "test@pagsmile.com",
        "phone": "50687898788"
    },
    "address" : {
        "zip_code": "01130",
    }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# SINPEMovil

How to use SINPEMovil to submit a payin in Costa Rica.

## Payin by SINPEMovil

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by SINPEMovil in Costa Rica.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                     |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                    |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone                                                                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- Persona física nacional,<br>Persona física residente,</p> |
| <p><br>Entidad estatal,</p>                                |        |                                                                                                 |
| <p><br>Persona jurídica,</p>                               |        |                                                                                                 |
| <p><br>Institución autónoma,</p>                           |        |                                                                                                 |
| <p><br>Diplomático,</p>                                    |        |                                                                                                 |
| <p><br>Extranjero -</p>                                    |        |                                                                                                 |
| customer.identify.number<mark style="color:red;">\*</mark> | string | User's identification number                                                                    |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: SINPEMovil                                                                         |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                            |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                     |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                 |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- Unkown -</p>                                                             |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: CRC                                                                                |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                    |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                            |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                        |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                          |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010106532400030",
    "out_trade_no": "202201010354009",
    "trade_status": "PROCESSING",
    "reference": "8494-4884"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354009",
    "method": "SINPEMovil",
    "order_amount": "300",
    "order_currency": "CRC",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"1c",
    "customer" : {
        "identify": {
            "type": "Persona física nacional",
            "number": "0204585317"
        },
        "phone": "50687898788"
    }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Bank Transfer

How to use BankTransfer to submit a payin in Costa Rica.

## Payin by BankTransfer

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by BankTransfer in Costa Rica.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                      |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                     |
| customer.phone<mark style="color:red;">\*</mark>           | string | User's phone                                                                     |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                     |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- 9 digits -</p>                              |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: BankTransfer                                                        |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>             |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                         |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- ID -</p>                                   |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                      |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                  |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                     |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 500\~1700000 CRC -</p>                                    |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: CRC                                                                 |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>             |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                               |
| address.zip\_code<mark style="color:red;">\*</mark>        | string | <p>zip code<br>- 5 digits -</p>                                                  |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                             |
| address.street                                             | string | <p>street</p><p>- Required if zip\_code not provide -</p>                        |
| address.street\_number                                     | string | <p>street number</p><p>- Required if zip\_code not provide -</p>                 |
| address.city                                               | string | <p>city</p><p>- Required if zip\_code not provide -</p>                          |
| address.state                                              | string | <p>state<br>- Required if zip\_code not provide -</p>                            |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                           |
| language\_code<mark style="color:red;">\*</mark>           | String | Use [API](/reference/payin/tools/supported-bank-list-query) to get language code |
| bank<mark style="color:red;">\*</mark>                     | String | Use [API](/reference/payin/tools/supported-bank-list-query) to get bank code     |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010106532400030",
    "out_trade_no": "202201010354009",
    "web_url": "",
    "trade_status": "PROCESSING",
    "reference": "732987"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354009",
    "method": "BankTransfer",
    "order_amount": "12.01",
    "order_currency": "CRC",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"1c",
    "bank":"1021",
    "language_code":"ES",
    "customer" : {
        "identify": {
            "type": "ID",
            "number": "567554554"
        },
        "name": "Test User Name",
        "email": "test@pagsmile.com",
        "phone": "50687898788"
    },
    "address" : {
    "zip_code": "01130",
    }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Czech Republic

Poland methods for API direct payment


# PayU

How to use PayU to submit a payin in Czech Republic.

## Payin by PayU

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by PayU in Czech Republic.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                       |
| ------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                      |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: PayU                                                                                 |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                              |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                          |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                   |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                      |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- Check <a href="/reference/payin/data/payment-method#europe">here </a>-</p> |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: CZK                                                                                  |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                              |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                |
| website\_url                                      | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                              |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout                                            |
| customer.name<mark style="color:red;">\*</mark>   | string | User's name                                                                                       |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354006",
    "prepay_id":"WlM3MHlxUFZ4N1kwNUN******************aU1dTdVV1Nk1SYTQ0dz0=-B05D6083",
    "pay_url": "https://checkout-testv2.pagsmile.com/checkout?prepay_id=",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354006",
    "method": "PayU",
    "order_amount": "300",
    "order_currency": "CZK",
    "subject": "trade pay test",
    "content": "trade pay test content",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "customer": {
        "name": "test user name"
    }
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Ecuador

Ecuador methods for API direct payment


# Credit Card

How to use CreditCard to submit a payin in Ecuador.

## Payin by CreditCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by CreditCard in Ecuador.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CreditCard</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- 1~2,500 USD -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: USD</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>trade_type<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: API</td></tr><tr><td>customer.name<mark style="color:red;">*</mark></td><td>string</td><td>User's name</td></tr><tr><td>customer.email<mark style="color:red;">*</mark></td><td>string</td><td>User's email</td></tr><tr><td>customer.phone<mark style="color:red;">*</mark></td><td>string</td><td>User's phone</td></tr><tr><td>customer.identify.type<mark style="color:red;">*</mark></td><td>string</td><td>User's identification type</td></tr><tr><td>customer.identify.number<mark style="color:red;">*</mark></td><td>string</td><td>User's identification number</td></tr><tr><td>billing.address.country<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address country</td></tr><tr><td>billing.address.state<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address state</td></tr><tr><td>billing.address.city<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address city</td></tr><tr><td>billing.address.street<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address street</td></tr><tr><td>billing.address.street_number<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address street number</td></tr><tr><td>billing.address.postal_code<mark style="color:red;">*</mark></td><td>string</td><td>User's billing address postal code</td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "out***300",
    "trade_no": "20240***34",
    "web_url": "https://checkout.pagsmile.com/?prepay_id=a2d4***5caq345B",
    "prepay_id": "UloyV0l3NFFyW***DTT0=-645a8F4c"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Step 1:** Get the "prepay\_id" from the API response. Each transaction should create a unique prepay\_id.

**Step 2:** Follow the step [here](/reference/payin/tools/pagsmile-javascript#step-1-include-pagsmile-script) to add the Pagsmile JavaScript library.

**Step 3:** Follow the step [here ](/reference/payin/tools/pagsmile-javascript#step-3-handle-payment-form-submission)to submit the payment form.
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "USD",
    * "method": "CreditCard",
    * "order_amount": "10",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "trade_type": "API",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023",
    * "version": "2.0",
    * "customer" : {
    *     "name": "Test name",
    *     "email": "Test name@gmail.com",
    *     "phone": "+593*******34",
    *	  "identify":{
    *         "type":"RUC",
    *         "number":"6757686785674"
          }
      },
    * "billing": {
    *     "address": {
    *         "country":"Ecuador",
    *         "state":"billingstate",
    *         "city":"billingcity",
    *         "street":"billingstreetqqq",
    *         "street_number":"22222",
    *         "postal_code":"****"
        }
    }
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Bank Transfer

How to use BankTransfer to submit a payin in Ecuador.

## Payin by BankTransfer

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by BankTransfer in Ecuador.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                     |
| ---------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                    |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: BankTransfer                                                                       |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                            |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                        |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CI, RUC, PAS -</p>                                        |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number<br>- CI: 10 digits, RUC: 13 digits, PAS: 9\~10 characters -</p> |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                     |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                    |
| customer.phone                                             | string | User's phone                                                                                    |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                 |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                    |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 2 - 5,000 USD -</p>                                                      |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: USD                                                                                |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                            |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                              |
| bank                                                       | string | <p>User's bank<br>- One of bpacifico, internacional, pichincha -</p>                            |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                            |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                          |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010106532400030",
    "out_trade_no": "202201010354008",
    "web_url": "",
    "trade_status": "PROCESSING",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id="
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example of identify

| Identify Type | Description       | Format                                   |
| ------------- | ----------------- | ---------------------------------------- |
| CI            | Identity Document | 10 digits                                |
| PAS           | Passport          | 9\~10 characters (only for Banktransfer) |
| RUC           | Tax id Number     | 13 digits                                |

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354007",
    * "method": "BankTransfer",
    * "order_amount": "12.01",
    * "order_currency": "USD",
    * "subject": "trade pay test",
      "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "bank": "pichincha",
    * "customer": {
    *     "identify": {
    *         "type": "CI",
    *         "number": "5028231489"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com"
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Cash

How to use Cash to submit a payin in Ecuador.

## Payin by Cash

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Cash in Ecuador.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                                    |
| ---------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                   |
| customer.phone                                             | string | User's phone                                                                                   |
| customer.email<mark style="color:red;">\*</mark>           | string | User's email                                                                                   |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Cash                                                                              |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                           |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                                       |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- CI, RUC or PP -</p>                                      |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- CI: 10 digits, RUC: 13 digits, PP: 13 characters -</p> |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                   |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 1\~300 USD -</p>                                                        |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: USD                                                                               |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                           |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                                             |
| bank                                                       | string | <p>User's bank<br>- One of bemovil, wu, minegocioefectivo -</p>                                |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                                           |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                                         |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010106532400030",
    "out_trade_no": "202201010354008",
    "web_url": "",
    "trade_status": "PROCESSING",
    "pay_url":"https://checkout.pagsmile.com/checkout?prepay_id="
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example of identify

| Identify Type | Description       | Format                        |
| ------------- | ----------------- | ----------------------------- |
| CI            | Identity Document | 10 digits                     |
| PP            | Passport          | 13 characters (only for Cash) |
| RUC           | Tax id Number     | 13 digits                     |

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354007",
    * "method": "Cash",
    * "order_amount": "12.01",
    * "order_currency": "USD",
    * "subject": "trade pay test",
      "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
      "bank": "bemovil",
    * "customer": {
    *     "identify": {
    *         "type": "CI",
    *         "number": "5028231489"
          },
    *     "name": "Test User Name",
    *     "email": "test@pagsmile.com""
      }
      }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Egypt

Egypt methods for API direct payment


# Credit Card

How to use CreditCard to submit a payin in Egypt.

## Payin by CreditCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by CreditCard in Egypt.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CreditCard</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- 0.01~ USD -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: USD</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>trade_type<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: API</td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "out***300",
    "trade_no": "20240***34",
    "prepay_id": "UloyV0l3NFFyW***DTT0=-645a8F4c"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Step 1:** Get the "prepay\_id" from the API response. Each transaction should create a unique prepay\_id.

**Step 2:** Follow the step [here](/reference/payin/tools/pagsmile-javascript#step-1-include-pagsmile-script) to add the Pagsmile JavaScript library.

**Step 3:** Follow the step [here ](/reference/payin/tools/pagsmile-javascript#step-3-handle-payment-form-submission)to submit the payment form.
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1649***56",
    * "out_trade_no": "out***3300",
    * "order_currency": "USD",
    * "method": "CreditCard",
    * "order_amount": "1",
    * "subject": "pagsmile test ",
      "content": "pagsmile test ",
    * "trade_type": "API",
    * "timestamp": "2024-07-04 18:50:42",
    * "notify_url": "http://demo.gemini-tiger.cn/callback/success",
    * "buyer_id": "buyer52023",
    * "version": "2.0"
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Cash

How to use Cash to submit a payin in Egypt.

## Payin by Cash

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Cash in Egypt.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| customer.name<mark style="color:red;">\*</mark>   | string | User's name                                                          |
| customer.email<mark style="color:red;">\*</mark>  | string | User's email                                                         |
| customer.phone<mark style="color:red;">\*</mark>  | string | User's phone                                                         |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Cash                                                    |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- 10 \~ 100,000 -</p>                           |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: EGP                                                     |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900084",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "reference":"93****24",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "Cash",
    * "order_amount": "20",
    * "order_currency": "EGP",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
    * "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "name": "test Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "201177613643",
      }    
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# QRCode

How to use ORCode to submit a payin in Egypt.

### **Payin by QRCode**

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by QRCode in Egypt.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                                                                               |
| ------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                                              |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: QRCode                                                                                                                                       |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                                                      |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                                                                                  |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                                                           |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                                              |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                                                                      |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>The maximum limit is 60,000 EGP per day and 200,000 EGP per month.</p><p>The actual payment amount may also be subject to the user's wallet limit.</p> |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: EGP                                                                                                                                          |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                                                                        |
| customer.phone<mark style="color:red;">\*</mark>  | string | User's phone                                                                                                                                              |

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

```
{
        "code":"10000",
        "msg":"Success",
        "prepay_id":"b296YWw1c****-eeeB2c0c",
        "trade_no":"2026****4803",
        "out_trade_no":"out_no_11343***333",
        "web_url":"",
        "trade_status":"PROCESSING",
        "qr_code":"0002010102****16630494F6"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

### Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
  "app_id": "162************38",
  "out_trade_no": "out_no_113***33",
  "order_currency": "EGP",
  "method": "QRCode",
  "order_amount": "123",
  "subject": "pagsmile test",
  "content": "pagsmile test",
  "timestamp": "2024-07-04 18:50:42",
  "notify_url": "http://demo.gemini-tiger.cn/callback/success",
  "buyer_id": "buyer123",
  "customer": {
    "phone": "20109****01"
  }
}'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Fawry

How to use Fawry to submit a payin in Egypt.

## Payin by Fawry

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Fawry in Egypt.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                                                   |
| ------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                                                  |
| customer.phone<mark style="color:red;">\*</mark>  | string | User's phone                                                                                                                  |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Fawry                                                                                                            |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                                          |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                                                      |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                                               |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                                                  |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- check <a href="https://docs.pagsmile.com/payin/data/payment-method#colombia">here</a> for limits -</p> |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: EGP                                                                                                              |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                                          |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                                            |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout                                                                        |
| region                                            | string | <p>Required if using Global App<br>- Fixed value: EGY -</p>                                                                   |

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

```
{
    "code": "10000",
    "msg": "Success",
    "prepay_id":"ZDNWb****62a6F",
    "trade_no": "2022010110293900084",
    "out_trade_no": "202201010354003",
    "pay_url":"https://checkout.pagsmile.com/result?prepay_id=Z****a62a6F",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "Fawry",
    * "order_amount": "20",
    * "order_currency": "EGP",
    * "subject": "trade pay test",
    * "content": "trade pay test content",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "phone": "20***15",
      }    
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# MeezaQR

How to use MeezaQR to submit a payin in Egypt.

## Payin by MeezaQR

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by MeezaQR in Egypt.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: MeezaQR                                                 |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- Unknown -</p>                                 |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: EGP                                                     |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900084",
    "out_trade_no": "202201010354003",
    "qr_code_img": "iVBORw0KGgoA ***  kJggg==",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**User Payment Tips**

The user must complete the payment within 7 minutes after receiving the QR code.
{% endhint %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "MeezaQR",
    * "order_amount": "20",
    * "order_currency": "EGP",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
    * "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01"
      }    
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Kiosk

How to use Kiosk to submit a payin in Egypt.

## Payin by Kiosk

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Kiosk in Egypt.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                          |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>         |
| customer.name<mark style="color:red;">\*</mark>   | string | User's name                                                          |
| customer.email<mark style="color:red;">\*</mark>  | string | User's email                                                         |
| customer.phone<mark style="color:red;">\*</mark>  | string | User's phone                                                         |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Kiosk                                                   |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p> |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                             |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                      |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>         |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- No limit -</p>                                |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: EGP                                                     |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p> |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                   |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout               |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900084",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "reference":"93****24",
    "trade_status": "PROCESSING"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "Kiosk",
    * "order_amount": "20",
    * "order_currency": "EGP",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
    * "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "name": "test Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "201177613643",
      }    
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Wallet

How to use Wallet to submit a payin in Egypt.

## Payin by Wallet

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Wallet in Egypt.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                              | Type   | Description                                                                                           |
| ------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>         | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                                          |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: Wallet                                                                                   |
| channel<mark style="color:red;">\*</mark>         | string | Fixed value: ~~FawryPay, OrangeCash, VodafoneCash, WePay or EtisalatCash~~                            |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>                                  |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: EGP                                                                                      |
| order\_amount<mark style="color:red;">\*</mark>   | string | <p>payment amount<br>- check <a href="/reference/payin/data/payment-method">here</a> for limits -</p> |
| subject<mark style="color:red;">\*</mark>         | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                                          |
| content                                           | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>                                  |
| timestamp<mark style="color:red;">\*</mark>       | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                                       |
| notify\_url<mark style="color:red;">\*</mark>     | string | Where Pagsmile will send notification to                                                              |
| return\_url                                       | string | Redirect to Merchant's url when user finished checkout                                                |
| buyer\_id<mark style="color:red;">\*</mark>       | string | merchant user's id                                                                                    |
| customer.name<mark style="color:red;">\*</mark>   | string | User's name                                                                                           |
| customer.phone<mark style="color:red;">\*</mark>  | string | User's phone                                                                                          |
| customer.email<mark style="color:red;">\*</mark>  | string | User's email                                                                                          |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900084",
    "out_trade_no": "202201010354003",
    "web_url": "",
    "qr_code_img":"data:image/PNG;base64,iVBORw0KGgoAAAANSUh****rkJggg==", //Only for FawryPay
    "wallet_url": "https://accept.solutions.com/api/acceptance/wallet_other/wallet_template?token=ZXlKa***Wc=", //For OrangeCash, VodafoneCash, WePay and EtisalatCash
    "reference":"93****24",
    "trade_status": "PROCESSING",
    "pay_url": "https://accept.paymobsolutions.com/api/acceptance/wallet_other/wallet_template?token=ZXlKaGJHY2***XdJcWc="
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "162************38",
    * "out_trade_no": "202201010354003",
    * "method": "Wallet",
    * "channel": "FawryPay",
    * "order_amount": "20",
    * "order_currency": "EGP",
    * "subject": "trade pay test",
    * "content": "trade pay test conent",
    * "notify_url": "http://merchant/callback/success",
      "return_url": "https://www.merchant.com",
    * "buyer_id": "buyer_0101_0001",
    * "timestamp": "2022-01-01 03:54:01",
    * "customer": {
    *     "name": "test Name",
    *     "email": "test@pagsmile.com",
    *     "phone": "201177613643",
      }    
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# El Salvador

El Salvador methods for API direct payment


# Cash

How to use Cash to submit a payin in El Salvador.

## Payin by Cash

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

This endpoint allows you to submit a payin by Cash in El Salvador.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\_*id:$security\_*&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                                      |
| ---------------------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>created app's id at dashboard</p><p>- Max. 32 chars -</p>                     |
| customer.phone                                             | string | User's phone                                                                     |
| customer.email                                             | string | User's email                                                                     |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>User's identification number</p><p>- 9 digits -</p>                           |
| method<mark style="color:red;">\*</mark>                   | string | Fixed value: Cash                                                                |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID given by the merchant in their system<br>- Max. 64 chars -</p>             |
| notify\_url<mark style="color:red;">\*</mark>              | string | Where Pagsmile will send notification to                                         |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>User's identification type</p><p>- DUI -</p>                                  |
| customer.name<mark style="color:red;">\*</mark>            | string | User's name                                                                      |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                                  |
| subject<mark style="color:red;">\*</mark>                  | string | <p>payment reason or item title</p><p>- Max. 128 chars -</p>                     |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>payment amount<br>- 1\~500 USD -</p>                                          |
| order\_currency<mark style="color:red;">\*</mark>          | string | Fixed value: USD                                                                 |
| content                                                    | string | <p>payment reason detail or item detail</p><p>- Max. 255 chars -</p>             |
| buyer\_id<mark style="color:red;">\*</mark>                | string | merchant user's id                                                               |
| address.zip\_code<mark style="color:red;">\*</mark>        | string | <p>zip code<br>- 4 digits -</p>                                                  |
| website\_url                                               | string | <p>merchant website URL</p><p>- Max. 128 chars -</p>                             |
| address.street                                             | string | <p>street</p><p>- Required if zip\_code not provide -</p>                        |
| address.street\_number                                     | string | <p>street number</p><p>- Required if zip\_code not provide -</p>                 |
| address.city                                               | string | <p>city</p><p>- Required if zip\_code not provide -</p>                          |
| address.state                                              | string | <p>state<br>- Required if zip\_code not provide -</p>                            |
| return\_url                                                | string | Redirect to Merchant's url when user finished checkout                           |
| language\_code<mark style="color:red;">\*</mark>           | String | Use [API](/reference/payin/tools/supported-bank-list-query) to get language code |
| bank<mark style="color:red;">\*</mark>                     | String | Use [API](/reference/payin/tools/supported-bank-list-query) to get bank code     |

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

```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010106532400030",
    "out_trade_no": "202201010354011",
    "web_url": "",
    "trade_status": "PROCESSING",
    "reference": "732987"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

## Example

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354011",
    "method": "Cash",
    "order_amount": "12.01",
    "order_currency": "USD",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"1c",
    "bank":"8300",
    "language_code":"ES",
    "customer" : {
        "identify": {
            "type": "DUI",
            "number": "567554554"
        },
        "name": "Test User Name",
        "email": "test@pagsmile.com",
        "phone": "65558577"
    },
    "address" : {
    "zip_code": "1510",
    }'
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}


# Europe

Europe methods for API direct payment


# Credit Card

How to use CreditCard to submit a payin in Europe.

## Payin by CreditCard

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

This endpoint allows you to submit a payin by CreditCard in Europe.

#### Headers

<table><thead><tr><th width="253">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Content-Type<mark style="color:red;">*</mark></td><td>string</td><td>application/json; chartset=UTF-8</td></tr><tr><td>Authorization<mark style="color:red;">*</mark></td><td>string</td><td>Basic Base($app_<em>id:$security_</em>key)</td></tr></tbody></table>

#### Request Body

<table><thead><tr><th width="277">Name</th><th width="145">Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>string</td><td><p>created app's id at dashboard</p><p>- Max. 32 chars -</p></td></tr><tr><td>method<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: CreditCard</td></tr><tr><td>out_trade_no<mark style="color:red;">*</mark></td><td>string</td><td>ID given by the merchant in their system<br>- Max. 64 chars -</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>timestamp<mark style="color:red;">*</mark></td><td>string</td><td>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</td></tr><tr><td>subject<mark style="color:red;">*</mark></td><td>string</td><td><p>payment reason or item title</p><p>- Max. 128 chars -</p></td></tr><tr><td>order_amount<mark style="color:red;">*</mark></td><td>string</td><td>payment amount<br>- 0.01~ EUR -</td></tr><tr><td>order_currency<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: EUR</td></tr><tr><td>content</td><td>string</td><td><p>payment reason detail or item detail</p><p>- Max. 255 chars -</p></td></tr><tr><td>buyer_id<mark style="color:red;">*</mark></td><td>string</td><td>merchant user's id</td></tr><tr><td>version<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: 2.0</td></tr><tr><td>trade_type<mark style="color:red;">*</mark></td><td>string</td><td>Fixed value: WEB</td></tr><tr><td>timeout_express</td><td>string</td><td><p>m(minutes), h(hours), d(days), c(always end in current day).</p><p>Used to control the expiration time of <strong>submitting</strong> an order (from initial to processing). (90m in default, max 15d)</p></td></tr><tr><td>customer.email<mark style="color:red;">*</mark></td><td>string</td><td>User's email</td></tr></tbody></table>

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

```
{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "out***300",
    "trade_no": "20240***34",
    "web_url": "https://checkout.pagsmile.com/?prepay_id=UloyV0l3NFFyW***45a8F4c",
    "prepay_id": "UloyV0l3NFFyW***DTT0=-645a8F4c"
}
```

{% endtab %}

{% tab title="400 duplicate out\_trade\_no" %}

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Step 1:** Get the "prepay\_id" from the API response. Each transaction should create a unique prepay\_id.

**Step 2:** Follow the step [here](/reference/payin/tools/pagsmile-javascript#step-1-include-pagsmile-script) to add the Pagsmile JavaScript library.

**Step 3:** Follow the step [here ](/reference/payin/tools/pagsmile-javascript#step-3-handle-payment-form-submission)to submit the payment form.
{% endhint %}

## Example

```
{
  "app_id": "1649***56",
  "out_trade_no": "out***3300",
  "order_currency": "EUR",
  "method": "CreditCard",
  "order_amount": "1",
  "subject": "pagsmile test",
  "content": "pagsmile test",
  "trade_type": "WEB",
  "timeout_express": "15d",
  "timestamp": "2024-07-04 18:50:42",
  "notify_url": "http://demo.gemini-tiger.cn/callback/success",
  "buyer_id": "buyer52023",
  "version": "2.0",
  "customer": {
    "email": "username@gmail.com"
  }
}
```

{% hint style="info" %}
Note: **162\*\*\*\*\*\*\*\*\*\*\*\*38** is pagsmile's test app id for sandbox, and **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** is authorization token associated with the test app id.
{% endhint %}

{% hint style="danger" %}
Please use your own **app\_id** and generate your own **authorization token** when testing.
{% endhint %}




---

[Next Page](/llms-full.txt/1)

