# Zalopay

## **Features**

| Processing currencies | VND  |
| --------------------- | ---- |
| Settlement currencies | USD  |
| Refunds               | ❌    |

# **Integration Method**

**Payment method enumeration values:** **`zalopay`**

**There is integration method for ShopeePay**

1. Direct API
2. Checkout

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

### **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 **`zalopay`** to the list of payment method types.

***Request*** 

```JSON
{
    "amount":200,
    "currency":"VND",
    "confirm":true,
    "payment_method_data" : {
        "type":"zalopay",
        "billing_details":{
            "name":"buyer name",
            "email":"test@gmail.com"
        }
    },
    "return_url":"https://your.website"
}
```

***Response***

```JSON
{
    "id": "pi_1906980953264226304",
    "object": "payment_intent",
    "created": 1743494664000,
    "livemode": false,
    "currency": "VND",
    "amount": 100000000,
    "status": "requires_action",
    "client_secret": "pi_1906980953264226304_secret_w9ltuoDvny1sYDo4iVUHlDqM",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": {
            "url": "https://XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        }
    },
    "payment_method_types": [
        "zalopay"
    ],
    "confirmation_method": "automatic",
    "return_url": "https://your.website",
    "payment_method": "pm_1906980953150980096",
    "capture_method": "automatic"
}
```

## **Checkout**

### Payment flow

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


![032eea1b-3fde-4616-b5e0-c0c4a33da118.png](https://api.apifox.com/api/v1/projects/1296482/resources/571651/image-preview)

1. Scan QR and approve the payment 


![ec209c6f-f9ea-4402-a71b-6b8b738a2777.png](https://api.apifox.com/api/v1/projects/1296482/resources/571652/image-preview)

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

***Request*** 

```JSON
{
    "mode": "payment",
    "success_url": "https://yourwebsite.com",
    "payment_method_types": ["zalopay"],
    "line_items": [
        {
            "price_data": {
                "currency": "VND",
                "unit_amount": 100000,
                "product_data": {
                    "name": "Kettle"
                },
                "billing_scheme": "testscheme",
                "lookup_key": "test_lookup_key"
            },
            "quantity": 1
        }
    ]
}
```

***Response***

```JSON
{
    "id": "cs_1965016342608216064",
    "object": "checkout.session",
    "created": 1757331379000,
    "livemode": true,
    "acctId": "516684936777874841601",
    "currency": "VND",
    "customer": "",
    "mode": "payment",
    "status": "open",
    "url": "https://checkout.wooshpay.com/XXXXXXXXXXXXXXXX",
    "allowPromotionCodes": false,
    "line_items": {
        "object": "list",
        "data": [
            {
                "id": "li_1965016342624993280",
                "object": "item",
                "currency": "VND",
                "description": "Kettle",
                "price": {
                    "id": "price_1965016342637576192",
                    "object": "price",
                    "created": 1757331379000,
                    "livemode": true,
                    "active": true,
                    "currency": "VND",
                    "product": {
                        "id": "prod_1965016342654353408",
                        "object": "product",
                        "created": 1757331379000,
                        "livemode": true,
                        "active": true,
                        "name": "Kettle",
                        "updated": 1757331379000
                    },
                    "type": "one_time",
                    "unit_amount": 100000,
                    "billing_scheme": "per_unit",
                    "lookup_key": "test_lookup_key"
                },
                "quantity": 1,
                "amount_subtotal": 100000,
                "amount_total": 100000
            }
        ]
    },
    "payment_intent": "pi_1965016342822125568",
    "payment_method_types": [
        "zalopay"
    ],
    "local_payment_method_types": [],
    "payment_status": "unpaid",
    "success_url": "https://yourwebsite.com"
}
```

# **Next step**

You can add more features to your integration as needed

## Webhook

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.

## Refund

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.
