# AlipayHK for Payment Setup API
To accept AlipayHK payments, you must:
1. Create a payment setup.
2. Confirm the payment.
3. Redirect the customer to AlipayHK.
---
## Create a payment setup
Call the [Create a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/createAPaymentSetup) endpoint.
> **Information**
>
> Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md).
**Production**
`POST` `https://{prefix}.api.checkout.com/payments/setups`
**Sandbox**
`POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups`
### Request example
```json
{
"amount": 1000,
"currency": "HKD",
"settings": {
"success_url": "https://example.com/payments/success",
"failure_url": "https://example.com/payments/failure"
}
}
```
In the request body, provide the following:
| Field | Description |
| --- | --- |
| `amount`
`number` | The payment amount, in the [minor currency unit](https://www.checkout.com/docs/payments/accept-payments/format-the-amount-value).
Minimum: 1
**Required** |
| `currency`
`string` | Three-letter ISO 4217 [currency code](https://www.checkout.com/docs/developer-resources/codes/currency-codes.md).
Supported value: `HKD`
**Required** |
| `settings.failure_url`
`string` | The URL to redirect the customer to if the payment fails.
Format: URI
Max length: 1024
**Required** |
| `settings.success_url`
`string` | The URL to redirect the customer to if the payment is successful.
Format: URI
Max length: 1024
**Required** |
| `customer.email.address`
`string` | The customer's email address.
Format: email
Max length: 255 |
| `customer.name`
`string` | The customer's name.
Min length: 1 |
| `description`
`string` | A description of the payment.
Max length: 100 |
| `order.items`
`array` | The list of items in the order.
Min items: 1 |
| `order.items[].name`
`string` | The name of the item.
Min length: 1 |
| `order.items[].quantity`
`number` | The quantity of the item.
Minimum: 1 |
| `order.items[].reference`
`string` | A reference for the item.
Min length: 1 |
| `order.items[].unit_price`
`number` | The price per unit of the item, in the [minor currency unit](https://www.checkout.com/docs/payments/accept-payments/format-the-amount-value).
Minimum: 1 |
| `reference`
`string` | A reference you can use to identify the payment.
Max length: 80 |
### Response example
```json
{
"id": "set_rcmepwrchqab2wsergcafvijfy",
"processing_channel_id": "pc_wzjki6hw5puepb5fnvqlizj2e4",
"amount": 1000,
"currency": "HKD",
"payment_type": "Regular",
"reference": "ORD-5023-4E89",
"description": "AlipayHK payment",
"payment_methods": {
"alipay_hk": {
"status": "ready",
"flags": []
}
},
"available_payment_methods": [
"alipay_hk"
],
"settings": {
"success_url": "https://example.com/payments/success",
"failure_url": "https://example.com/payments/failure"
}
}
```
The response returns a `payment_methods` object, which contains the payment methods enabled on your account.
When all required fields are present, the `payment_methods.alipay_hk` object shows a `ready` [status](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-using-the-payment-setup-api.md#Payment_method_status).
---
## Confirm the payment
Confirm the payment by calling the [Confirm a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/confirmAPaymentSetup) endpoint and provide:
- The payment setup `id` as the `{id}` path parameter.
- `alipay_hk` as the `{payment_method_name}` path parameter.
### Request example
**Production**
`POST` `https://{prefix}.api.checkout.com/payments/setups/{id}/confirm/alipay_hk`
**Sandbox**
`POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups/{id}/confirm/alipay_hk`
### Response example
```json
{
"id": "pay_bsrduhejxiuerlh32hb5n6dvae",
"status": "Pending",
"reference": "ORD-5023-4E89",
"customer": {
"id": "cus_2g4ehcpm6phexgkzahlwxvbgne",
"email": "hannah.bret@example.com",
"name": "Hannah Bret"
},
"_links": {
"self": {
"href": "https://{prefix}.api.checkout.com/payments/pay_bsrduhejxiuerlh32hb5n6dvae"
},
"redirect": {
"href": "https://psp.ac.alipay.com/page/simulation-wallet/acwallet/alipayconnectcode.html?code=281666040099gDeR9hatc6IPfQ0bstyv3kOD&pspName=ALIPAY_HK&loadMode=2"
}
}
}
```
---
## Redirect the customer
Redirect the customer to the `redirect.href` URL from the response. The customer completes the payment on the AlipayHK page and is then redirected back to your `settings.success_url` or `settings.failure_url`.
When accepting payments with AlipayHK, you must display the Alipay+ and AlipayHK logos on your payment interface. To ensure that the logos match Alipay's requirements, refer to their [Brand display guidelines for online payments](https://docs.alipayplus.com/alipayplus/alipayplus/ux_cashier_acq_older_edition/brand_online_acq#quwEA) and [Brand display guidelines for cashier payments](https://docs.alipayplus.com/alipayplus/alipayplus/brand_guidelines/brand_cashier_acq).