Skip to main content

Overview​

Alipay direct integration supports only the following payment methods: PC QR code payment, Mini Program payment, and in-app payment. Merchants should set the methods parameter based on the payment scenario and handle the API response accordingly.

For all Alipay payment scenarios, see the Alipay integration guide.

Flowchart​

Request​

The merchant’s server submits the required parameters using direct integration:

ScenarioDescriptionPayment (methods)[/docs/payment/parameter#request-parameters] value
PC QR Code PaymentOpens in a desktop browser. The merchant generates a QR code for the user to scan and pay.
  • QR code generation is supported only for HK wallets. For CN wallets, use Hosted Checkout.
Alipay_Web
cURL -X POST 'https://test-secure.oceanpayment.com/gateway/directservice/pay'
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'account=995149' \
-d 'terminal=99514901' \
-d 'signValue=6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' \
-d 'backUrl=https://www.abc.com/back.php' \
-d 'noticeUrl=https://www.abc.com/notice.php' \
-d 'order_number=NO12345678' \
-d 'order_currency=HKD' \
-d 'order_amount=0.01' \
-d 'methods=Alipay_Web' \
-d 'order_notes=' \
-d 'billing_firstName=test' \
-d 'billing_lastName=test' \
-d 'billing_email=test@gmail.com' \
-d 'billing_phone=13800138000' \
-d 'billing_country=HK' \
-d 'billing_state=HK' \
-d 'billing_city=Washington D.C.' \
-d 'billing_address=705A big Road' \
-d 'billing_zip=529012' \
-d 'billing_ip=127.0.0.1' \
-d 'productNum=1' \
-d 'productName=Red Dress' \
-d 'productSku=#001' \
-d 'productPrice=0.01' \

Response​

See the full list of response parameters.

<?xml version="1.0" encoding="UTF-8"?>
<response>
<notice_type>transaction</notice_type>
<push_dateTime>2026-11-12 07:25:57</push_dateTime>
<account>995149</account>
<terminal>99514901</terminal>
<signValue>41FE077BA389DB90DEF5EEC70AB2C401D7027D6940F1203700FBAE3CB116BB42</signValue>
<methods>Alipay_Web</methods>
<order_number>NO12345678</order_number>
<card_country></card_country>
<order_currency>HKD</order_currency>
<order_amount>0.01</order_amount>
<order_notes></order_notes>
<card_number></card_number>
<card_type></card_type>
<payment_country>HK</payment_country>
<payment_id>231219095247018026021</payment_id>
<payment_authType>0</payment_authType>
<payment_status>-1</payment_status>
<payment_details>80700:Transaction was not finished</payment_details>
<payment_solutions></payment_solutions>
<payment_risk></payment_risk>
<payment_amount></payment_amount>
<payment_exchangeRate></payment_exchangeRate>
<pay_barCode>https://mapi-hk.alipay.com/gateway.do?secondary_merchant_industry=5309&payment_inst=ALIPAYHK&_input_charset=UTF-8&subject=TEST&sign=51ddde190361185f9958089f040b18d3¬ify_url=https%3A%2F%2Fsecure.oceanpayment.com%3A443%2Fgateway%2FnoticeBank%2F33030%2F1&body=OCEANPAYMENT+CO+LIMITED&product_code=NEW_WAP_OVERSEAS_SELLER&qr_pay_mode=4&qrcode_width=200&secondary_merchant_id=202694&out_trade_no=240227163114106010589&partner=2088331369492145&service=create_forex_trade&total_fee=1.0&secondary_merchant_name=OCEANPAYMENT+CO+LIMITED&return_url=https%3A%2F%2Fsecure.oceanpayment.com%3A443%2Fgateway%2FreceiveBank%3Fbank_code%3D33030¤cy=HKD&sign_type=MD5</pay_barCode>
<pay_userId></pay_userId>
<payment_transactionNetworkId></payment_transactionNetworkId>
<payment_transactionLinkId></payment_transactionLinkId>
</response>
  1. Order status: When payment_status = -1, the order is pending. The merchant should retrieve the Alipay QR code parameter pay_barCode and generate a QR code on the payment page for the user to scan.
  2. Place the pay_barCode value in an iframe on your payment page to display the page returned by Alipay with the QR code.
<iframe
src="https://mapi-hk.alipay.com/gateway.do?secondary_merchant_industry=5309&payment_inst=ALIPAYHK&_input_charset=UTF-8&subject=TEST&sign=51ddde190361185f9958089f040b18d3¬ify_url=https%3A%2F%2Fsecure.oceanpayment.com%3A443%2Fgateway%2FnoticeBank%2F33030%2F1&body=OCEANPAYMENT+CO+LIMITED&product_code=NEW_WAP_OVERSEAS_SELLER&qr_pay_mode=4&qrcode_width=200&secondary_merchant_id=202694&out_trade_no=240227163114106010589&partner=2088331369492145&service=create_forex_trade&total_fee=1.0&secondary_merchant_name=OCEANPAYMENT+CO+LIMITED&return_url=https%3A%2F%2Fsecure.oceanpayment.com%3A443%2Fgateway%2FreceiveBank%3Fbank_code%3D33030¤cy=HKD&sign_type=MD5"
width="100%"
height="400"
frameborder="0">
</iframe>

Payment Status​

See Payment Status for details.

Asynchronous Notification​

You also need to receive the transaction’s asynchronous notification via noticeUrl.

Signature​

See Signature Generation and Verification for details.