Skip to main content

Pay with WEB QR Code (Desktop Website Browser) - Alipay HK

Accept Alipay HK on your website by presenting your QR code to the shopper. AlipayHK PC2Mobile payment solution allows customers to scan the payment QR code on the merchant website on a PC browser, but complete the payment with a mobile device. After integrating the AlipayHK PC2Mobile payment service, both the Alipay and AlipayHK wallet are supported. You should present both the Alipay payment button and the AlipayHK payment button on your website for the buyers to complete the payment.

With the AlipayHK PC2Mobile payment solution, you can:

  • Offer consumers a convenient, safe, and reliable payment experience.
  • Deduct payment amount from the consumer's account in real-time in HKD and settle the payment to you in HKD.

Step 0. Authentication

How to obtain access token Authentication Reference

Step 1. Initialize a Payment Intent

POST /mch-api/v1/pa/payment_intents/create

  • Example Request
{
"amount": "1",
"currency": "HKD",
"merchant_order_id": "P9297895081903",
"payment_method": {
"type": "alipayhk",
"alipayhk": {
"flow": "web_qrcode",
"payment_method": "ALIPAYCN"
}
},
"description": "Online Payment",
"notify_url": "https://put_your_site_here/example_url"
}
  • Request
REQUEST BODYDetailsTypeRequiredExample
amountPayment amount. This is the order amount you would like to charge your customerstring(32)required
currencyAmount currency (alipay hk only support HKD)string(32)requiredHKD
merchant_order_idThe order ID created in merchant's order system that corresponds to this PaymentIntent. Maximum length is 32.string(32)required
descriptionThe description of the orderstringrequired
notify_urlThe URL that is used to receive the payment result notification from CBTISstringoptional
payment_methodobjectrequired
- typeSpecific this payment channel (alipayhk)stringrequiredaplus
- alipayhkobjectrequired
-- flowSpecific the payment flowstringrequiredcashier
-- payment_methodThe wallet you want to payment with. The complete list of valid values: ALIPAYCN or ALIPAYHKstringrequiredALIPAYCN
  • Example Response
{
"code": 0,
"data": {
"order_id": "C991289984923795789123",
"merchant_order_id": "P9297895081903",
"amount": "1",
"currency": "HKD",
"create_time": "2023-08-31T04:44:05.928696203+08:00",
"next_action": {
"type": "redirect",
"url": "https://a.payment.link/code"
},
"status": "PENDING"
},
"message": "ok",
"rid": "3647575c0e1049439e484a231864da2c"
}

You should redirect the shopper to the Alipay Plus cashier page with the next_action.url returned in the Payment response.

Step 2. Get payment notify

Once you fill in the notify_url field when creating an order, after the user completes the payment, our system will prompt you with information about the user's completed payment.

How to verify our notify message Webhook Verify Reference

  • Example Webhook
{
"notify_type": "payment_success",
"data": {
"order_id": "C991289984923795789123",
"merchant_order_id": "P9297895081903"
}
}

Step 3. Retrieve a payment

Retrieve a Refund by ID.

POST /mch-api/v1/pa/payment_intents/query

  • Example Request
{
"order_id": "P991289984923795789123",
"merchant_order_id": "P9297895081903"
}
  • Request
REQUEST BODYDetailsTypeRequiredExample
order_idPlatform order id from payment request.string(32)conditional (required if merchant_order_id is empty)
merchant_order_idMerchant order id from your creation of payment.string(32)conditional (required if order_id is empty)
  • Example Response
{
"code": 0,
"data": {
"order_id": "C991289984923795789123",
"merchant_order_id": "P9297895081903",
"amount": "50",
"currency": "TWD",
"status": "SUCCEEDED",
"create_time": "2023-08-31T04:44:05.928696203+08:00",
"pay_time": "2023-08-31T04:44:05.928696203+08:00"
},
"message": "ok",
"rid": "3647575c0e1049439e484a231864da2c"
}
  • Explain of status
STATUS CODEDetails
PENDINGThe Payment is pending the final result from the provider. No further action is required.
SUCCEEDEDThe Payment has succeeded. The payment transaction is complete.
CANCELLEDPayment canceled or timeout, user has not completed the payment and the order has been closed.