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:
- PC QR Code Payment
- Mini Program
- APP
| Scenario | Description | Payment (methods)[/docs/payment/parameter#request-parameters] value |
|---|---|---|
| PC QR Code Payment | Opens in a desktop browser. The merchant generates a QR code for the user to scan and pay.
| 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' \
| Scenario | Description | Payment (methods)[/docs/payment/parameter#request-parameters] value |
|---|---|---|
| Mini Program | Opens in a WeChat Mini Program to complete the payment. | Alipay_Wap |
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_Wap' \
-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' \
| Scenario | Description | Payment (methods)[/docs/payment/parameter#request-parameters] value |
|---|---|---|
| APP | Opens in the app to complete the payment. | Alipay_APP |
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_APP' \
-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.
- PC QR Code Payment
- Mini Program
- APP
<?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>
- Order status: When
payment_status=-1, the order is pending. The merchant should retrieve the Alipay QR code parameterpay_barCodeand generate a QR code on the payment page for the user to scan. - Place the
pay_barCodevalue 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>
<?xml version="1.0" encoding="UTF-8"?>
<response>
<notice_type>transaction</notice_type>
<push_dateTime>2026-11-12 16:18:07</push_dateTime>
<response_type>1</response_type>
<account>995149</account>
<terminal>99514901</terminal>
<signValue>37439C92DCB47DE826AE32A7388B038F017D8709DB4D2750658C9AF937F0FFB4</signValue>
<methods>Alipay_Wap</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>231219095247018026022</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>260715211946554054007</pay_barCode>
<pay_userId></pay_userId>
<payment_transactionNetworkId></payment_transactionNetworkId>
<payment_transactionLinkId></payment_transactionLinkId>
</response>
- Order status: After the merchant submits a payment request, the synchronous response returns
payment_status=-1, indicating that the payment is pending. Once the user completes the payment, the system returns the payment result in real time. - Payment parameter:
pay_barCodecontains thetradeNOparameter required to call Alipay Mini Program’smy.crossPaymethod. For details, see the Alipay official documentation.
- Mini Program Payment Invocation Example
const pay_barCode = '260715211946554054007';
my.crossPay({
tradeNO: pay_barCode,
success(res) {
console.log(res);
my.alert({
content: JSON.stringify(res)
});
},
fail(err) {
console.log(err);
my.alert({
content: JSON.stringify(err)
});
}
});
<?xml version="1.0" encoding="UTF-8"?>
<response>
<notice_type>transaction</notice_type>
<push_dateTime>2026-11-12 16:18:07</push_dateTime>
<response_type>1</response_type>
<account>995149</account>
<terminal>99514901</terminal>
<signValue>37439C92DCB47DE826AE32A7388B038F017D8709DB4D2750658C9AF937F0FFB4</signValue>
<methods>Alipay_APP</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>231219095247018026022</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></pay_barCode>
<pay_userId></pay_userId>
<payment_transactionNetworkId></payment_transactionNetworkId>
<payment_transactionLinkId></payment_transactionLinkId>
<payment_bankInfo>cGFydG5lcj0iMTI1ODYyNDg5NjI1MjE3IiZzZWxsZXJfaWQ9IjEyNTg2MjQ4OTYyNTIxNyImb3V0X3RyYWRlX25vPSIyNjExMTMwOTM4MTE1MDg5MDMwMjciJnN1YmplY3Q9IlRFU1QiJmJvZHk9IlRFU1QiJnRvdGFsX2ZlZT0iMC4xIiZub3RpZnlfdXJsPSJodHRwczovL3NlY3VyZS5vY2VhbnBheW1lbnQuY29tOjQ0My9nYXRld2F5L25vdGljZUJhbmsvODAwNzcvMSImc2VydmljZT0ibW9iaWxlLnNlY3VyaXR5cGF5LnBheSImcGF5bWVudF90eXBlPSIxIiZfaW5wdXRfY2hhcnNldD0iVVRGLTgiJml0X2JfcGF5PSIzMG0iJnJldHVybl91cmw9Imh0dHBzOi8vc2VjdXJlLm9jZWFucGF5bWVudC5jb206NDQzL2dhdGV3YXkvcmVjZWl2ZUJhbms/YmFua19jb2RlPTgwMDc3IiZwYXltZW50X2luc3Q9IkFMSVBBWUhLIiZjdXJyZW5jeT0iSEtEIiZwcm9kdWN0X2NvZGU9Ik5FV19XQVBfT1ZFUlNFQVNfU0VMTEVSIiZmb3JleF9iaXo9IkZQIiZzZWNvbmRhcnlfbWVyY2hhbnRfaW5kdXN0cnk9IjcyOTgiJnNlY29uZGFyeV9tZXJjaGFudF9uYW1lPSJISyImc2Vjb25kYXJ5X21lcmNoYW50X2lkPSIyNTg0NzEzNjg1MjMiJnNpZ249ImxHMUh1OE9VYTFHMnJGU292amR2b21wd3V0OEZlbW9uWkRUb1VyaTlpSlpMZ2I5dzNJV0NWU05ET0o2RWFrMjZWQVAlMkZSRVFCMmo1dnZyTEFWVSUyRlpjb21jS3Y1ZjlmSmV6TUZkY21kQnIlMkJ0NGFpbXpzRmJCcUp1bVN2WXN6WVptQnk0M3lTRWd5dFliQXk0eGlRJTJGbGd2ZlQ5bU1pNTZjZlFmZVElMkYwdmN1RzglM0QiJnNpZ25fdHlwZT0iUlNBIg==</payment_bankInfo>
</response>
- Order status: After the merchant submits a payment request, the synchronous response returns
payment_status=-1, indicating that the payment is pending. Once the user completes the payment, the system returns the payment result in real time. - Payment response:
payment_bankInfois a Base64-encoded string. The merchant must decode it and pass the complete order parameters to the WeChat Pay app payment SDK. For details, see the WeChat Pay official documentation.
Base64 is an encoding, not encryption. Transmit the parameters over HTTPS, and avoid logging the full payment_bankInfo value or the decoded payment parameters. Follow the parameter definitions returned by Oceanpayment for the field order.
- Use the Alipay Android SDK already integrated into the project. Call
payV2on a non-UI thread.
//java
#import <AlipaySDK/AlipaySDK.h>
NSString *encoded = payBarCode; // Base64 string returned by Oceanpayment
NSData *decodedData = [[NSData alloc]
initWithBase64EncodedString:encoded
options:NSDataBase64DecodingIgnoreUnknownCharacters];
NSString *orderInfo = [[NSString alloc]
initWithData:decodedData
encoding:NSUTF8StringEncoding];
if (orderInfo == nil) {
// Base64 decoding or UTF-8 conversion failed
return;
}
[[AlipaySDK defaultService] payOrder:orderInfo
fromScheme:@"yourAppScheme"
callback:^(NSDictionary *resultDic) {
// Update the page status based on the callback;
// the final payment status should still be confirmed by the merchant server.
}];
- Use the Alipay iOS SDK already integrated into the project. Decode the value first, then call
payOrder. ReplaceappSchemewith the scheme configured for the merchant’s app:
//objective-c
#import <AlipaySDK/AlipaySDK.h>
NSString *encoded = payBarCode; // Base64 string returned by Oceanpayment
NSData *decodedData = [[NSData alloc]
initWithBase64EncodedString:encoded
options:NSDataBase64DecodingIgnoreUnknownCharacters];
NSString *orderInfo = [[NSString alloc]
initWithData:decodedData
encoding:NSUTF8StringEncoding];
if (orderInfo == nil) {
// Base64 decoding or UTF-8 conversion failed
return;
}
[[AlipaySDK defaultService] payOrder:orderInfo
fromScheme:@"yourAppScheme"
callback:^(NSDictionary *resultDic) {
// Update the page status based on the callback;
// the final payment status should still be confirmed by the merchant server.
}];
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.