# 9Pay

# **Learn about 9Pay, a digital wallet popular with customers from Vietnam.**

With over millions of users, 9Pay is a leading digital wallet in Vietnam, catering to the diverse payment needs of individuals. It is an all-in-one app that offers a range of convenient features for everyday usage.

## Features 

| Processing currencies      | VND                                                          |
| -------------------------- | ------------------------------------------------------------ |
| Settlement currencies      | USD                                                          |
| Minimum transaction amount | **Local debit card** minimum: 10,000 VND<br />**International card**  minimum: 10,000 VND<br />**9Pay E- wallet** minimum: 5,000 VND<br />**Bank transfer** minimum: 10,000 VND |
| Maximum transaction amount | **Local debit card** maximum: 200,000,000 VND<br />**International card** maximum : 200,000,000 VND<br />**9Pay E- wallet** maximum: 100,000,000 VND<br />**Bank transfer** maximum: no limit |
| Refunds                    | ✅                                                            |
| Partial Refunds            | ✅                                                            |
| Multiple partial refund    | ✅                                                            |
| Chargeback                 | ✅                                                            |

## Subproducts

| **Product**            | **Description**                                              |
| ---------------------- | ------------------------------------------------------------ |
| **9Pay E- wallet**     | After selecting 9Pay as a payment method on merchant checkout, customers will be redirected to 9pay payment page. Then selecting 9Pay E-wallet, a QR code appears. The shopper then opens the 9Pay app on their mobile phone and scans the barcode displayed on the browser page to complete the payment. |
| **Local debit card**   | After selecting 9Pay as a payment method on merchant checkout, customers will be redirected to 9pay payment page. Then selecting local debit card and local bank name, customers fill in the card information completing payment. |
| **International card** | After selecting 9Pay as a payment method on merchant checkout, customers will be redirected to 9pay payment page. Selecting international card as payment method. Filling in the card details, payment will be completed. |
| **Bank transfer**      | After selecting 9Pay as a payment method on merchant checkout, customers will be redirected to 9pay payment page. Selecting Bank transfer, customers can complete the payment by bank transfer. |

# **Integration Method**

**Payment method enumeration values:** **`9pay`**

**There are two integration methods for 9Pay**

1. Direct API
2. Checkout 

## **Direct** **API** 

### Payment flow

1. For direct API integration, after creating payment intent by OpenAPI, customers will be redirected to 9Pay  login page. Customers select the payment method


![Untitled.png](https://api.apifox.cn/api/v1/projects/1296482/resources/390552/image-preview)

2. For example, customers select 9Pay e-wallet. Then customers scans the QR code completing payment.


![Untitled1.png](https://api.apifox.cn/api/v1/projects/1296482/resources/390553/image-preview)

3. After that, customers will be redirected to the page you designated.

### **How to integration**

For direct API integration, you can create a PaymentIntent and get url in only one step. The following is the demo of creating payment intent:

[**Create a PaymentIntent**](api-42631218)

A PaymentIntent is an object that represents your intent to collect payment from your customer and tracks the lifecycle of the payment process. Create a PaymentIntent on your server and specify the amount to collect and a supported currency. If you have an existing Payment Intents integration, add 9pay to the list of payment method types.

***Request***

```JSON
{
    "amount":10000,
    "currency":"VND",
    "confirm":true,
    "payment_method_data" : {
        "type":"9pay"
    },
    "return_url":"https://swooshtransfer.com/"
}
```

***Response***

```JSON
{
    "id": "pi_1668947502776188928",
    "object": "payment_intent",
    "created": 1686743067000,
    "livemode": false,
    "currency": "VND",
    "amount": 10000,
    "status": "requires_action",
    "client_secret": "pi_1668947502776188928_secret_5eKUVX8MFLiS0nSMEG35YWDJ",
    "next_action": {
        "type": "9pay_handle_redirect",
        "9pay_handle_redirect": {
            "url": "https://sand-payment.9pay.vn/portal?baseEncode=eyJhbW91bnQiOiIxMDAwMCIsImN1cnJlbmN5IjoiVk5EIiwiZGVzY3JpcHRpb24iOiJkZXNjcmlwdGlvbiIsImludm9pY2Vfbm8iOiJjaF8xNjY4OTQ3NTAyOTAyMDE4MDQ4IiwibWVyY2hhbnRLZXkiOiJQVEpwOXUiLCJyZXR1cm5fdXJsIjoiaHR0cHM6Ly9hcGl0ZXN0Lndvb3NocGF5LmNvbS92MS9yZWNlaXZlcy9jMTEvcnVybCIsInRpbWUiOiIxNjg2NzQzMDY2In0=&signature=jhZPpXG1XQDVwnexSSnr0WQap2HpLx0NqeeY2NDj3kQ="
        }
    },
    "payment_method_types": [
        "9pay"
    ],
    "confirmation_method": "automatic",
    "return_url": "https://swooshtransfer.com/",
    "payment_method": "pm_1668947502629388288",
    "capture_method": "automatic"
}
```

## **Checkout**

### Payment flow

1. Customer selects 9Pay from the list of payment methods available and clicks on the Pay botton


![9078ac1b-6da0-4dd7-8641-03e2206015b3.png](https://api.apifox.cn/api/v1/projects/1296482/resources/390554/image-preview)

1. Customers will be redirected to 9Pay  login page

![Untitled.png](https://api.apifox.cn/api/v1/projects/1296482/resources/390552/image-preview)

1. For example, customers select 9Pay e-wallet. Then customers scans the QR code completing payment.

![Untitled1.png](https://api.apifox.cn/api/v1/projects/1296482/resources/390553/image-preview)

1. After that, customers will be redirected to the page you designated.

### [Create a Session](api-42654181)

***Request***

```JSON
{
    "cancel_url": "https://swooshtransfer.com/",
    "mode": "payment",
    "success_url": "https://swooshtransfer.com/",
    "payment_method_types": [
        "9pay"
    ],
    "line_items": [
        {
            "price_data": {
                "currency": "VND",
                "product": null,
                "unit_amount": 10000,
                "active": true,
                "metadata": {
                    "key1": "value1",
                    "key2": "value2"
                },
                "nickname": "apple",
                "product_data": {
                    "id": null,
                    "name": "apple",
                    "active": true,
                    "description": "very delicious",
                    "metadata": {
                        "key1": "value1",
                        "key2": "value2"
                    },
                    "url": "www.baidu.com"
                },
                "billing_scheme": "testscheme",
                "lookup_key": "test_lookup_key"
            },
            "quantity": 1
        }
    ]
}
```

***Response***

```JSON
{
    "id": "cs_1668947425479360512",
    "object": "checkout.session",
    "created": 1686743048000,
    "livemode": false,
    "currency": "VND",
    "customer": "",
    "mode": "payment",
    "status": "open",
    "url": "https://checkouttest.wooshpay.com/pay/cs_test_1668947425479360512?key=pk_test_NTE2Njg1MDgwNDUzOTY4MDc2ODAxOm9Oa3pjN043U2dYWE84VVhGZmF4cThvTTE2ODY2MzgyOTYzMjU",
    "cancel_url": "https://swooshtransfer.com/",
    "line_items": {
        "object": "list",
        "data": [
            {
                "id": "li_1668947425508720640",
                "object": "item",
                "currency": "VND",
                "description": "apple",
                "price": {
                    "id": "price_1668947425533886464",
                    "object": "price",
                    "created": 1686743048000,
                    "livemode": false,
                    "active": true,
                    "currency": "VND",
                    "metadata": {
                        "key1": "value1",
                        "key2": "value2"
                    },
                    "nickname": "apple",
                    "product": {
                        "id": "prod_1668947425546469376",
                        "object": "product",
                        "created": 1686743048000,
                        "livemode": false,
                        "active": true,
                        "description": "very delicious",
                        "metadata": {
                            "key1": "value1",
                            "key2": "value2"
                        },
                        "name": "apple",
                        "url": "www.baidu.com",
                        "updated": 1686743048000
                    },
                    "type": "one_time",
                    "unit_amount": 10000,
                    "billing_scheme": "per_unit",
                    "lookup_key": "test_lookup_key"
                },
                "quantity": 1,
                "amount_subtotal": 10000,
                "amount_total": 10000
            }
        ]
    },
    "payment_intent": "pi_1668947425710047232",
    "payment_method_types": [
        "9pay"
    ],
    "payment_status": "unpaid",
    "success_url": "https://swooshtransfer.com/",
    "amount_subtotal": 10000,
    "amount_total": 10000,
    "billing_address_collection": "auto",
    "expires_at": 1686829448437,
    "payment_link": "",
    "client_secret": "pi_1668947425710047232_secret_beZrT7mccYT27tC9ju0RbvlJ"
}
```

# **Next step**

You can add more features to your integration as needed

## [Create a Webhook](doc-2517709)

Listen to events on your WooshPay account so your integration can automatically trigger reactions. Create a webhook that mainly focuses on enabled_events and url.

## [Create a Refund](api-51369554)

Create a refund to repay funds to your customer. You can also perform partial refunds, but not every payment method supports them. A partial refund is when you refund only part of the original transaction amount.
