> For the complete documentation index, see [llms.txt](https://docs.pagsmile.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pagsmile.com/reference/payin/submit-a-payin/vietnam/banktransfer.md).

# Bank Transfer

How to use BankTransfer to submit a payin in Vietnam.

### 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 Vietnam.

**Headers**

| Name                                            | Type   | Description                                                        |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | Fixed value: `application/json; charset=UTF-8`.                    |
| Authorization<mark style="color:red;">\*</mark> | string | Basic authentication generated from `Base64(app_id:security_key)`. |

**Request Body**

| Name                                              | Type   | Description                                                                    |
| ------------------------------------------------- | ------ | ------------------------------------------------------------------------------ |
| app\_id<mark style="color:red;">\*</mark>         | string | App ID created in the dashboard. Maximum length: 32 characters.                |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: `BankTransfer`.                                                   |
| out\_trade\_no<mark style="color:red;">\*</mark>  | string | Unique transaction ID assigned by the merchant. Maximum length: 64 characters. |
| notify\_url<mark style="color:red;">\*</mark>     | string | URL that receives the asynchronous payment result notification.                |
| timestamp<mark style="color:red;">\*</mark>       | string | Request time in `yyyy-MM-dd HH:mm:ss` format. Maximum length: 19 characters.   |
| subject<mark style="color:red;">\*</mark>         | string | Payment reason or item title. Maximum length: 128 characters.                  |
| order\_amount<mark style="color:red;">\*</mark>   | string | Payment amount. From `10,000` to `299,999,999 VND`; integers only.             |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: `VND`.                                                            |
| content                                           | string | Payment reason details or item details. Maximum length: 255 characters.        |
| buyer\_id<mark style="color:red;">\*</mark>       | string | Unique customer ID assigned by the merchant.                                   |
| website\_url                                      | string | Merchant website URL. Maximum length: 128 characters.                          |
| return\_url                                       | string | URL to which the customer is redirected after completing checkout.             |

**Responses**

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

```json
{
  "code": "10000",
  "msg": "Success",
  "prepay_id": "MmZLS1pTN1Ji**wND0=-83DB2ecB",
  "trade_no": "2026***0706079",
  "out_trade_no": "out_trade_no_1270***458",
  "web_url": "",
  "pay_url": "https://checkout.pagsmile.com/checkout?prepay_id=MmZLS***2ecB",
  "trade_status": "PROCESSING",
  "beneficiary": {
    "bank_id": "BIDV",
    "bank_name": "BIDV",
    "number": "96***5216",
    "name": "HLO PAGSMILE"
  }
}
```

{% hint style="info" %}
The `beneficiary` object is optional and may be omitted from the response. When returned, it contains the beneficiary bank account information assigned to the transaction.
{% endhint %}
{% endtab %}

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

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

{% endtab %}
{% endtabs %}

### Example

```bash
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_455***958",
    "method": "BankTransfer",
    "order_amount": "30000",
    "order_currency": "VND",
    "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" %}
`162************38` is Pagsmile's test App ID for the sandbox environment, and the value shown in the `Authorization` header is the token associated with that test App ID.
{% endhint %}

{% hint style="danger" %}
Use your own `app_id` and generate your own authorization token when testing.
{% endhint %}
