alipay.acquire.overseas.spot.pay
Call this interface to issue a payment request. After receiving the payment request, Alipay validates the request first, and then deducts money automatically from the payer account that is identified by the buyer_identity_code
field.
Request
Service address
Environment | HTTPS request URL |
Production environment | https://intlmapi.alipay.com/gateway.do |
Test environment | https://mapi.alipaydev.com/gateway.do |
Request parameters
Parameter | Description |
Basic parameter | |
service String | Interface name
|
sign String | Sign value
|
sign_type String | Sign type. RSA, RSA2 and MD5 are supported. Use uppercase.
|
partner String(16) | The partner ID that is assigned by Alipay to identify an Alipay account. The partner ID is composed of 16 digits and begins with 2088.
|
_input_charset String | The charset with which the request data is encoded. UTF-8 is supported.
|
Operation parameter | |
alipay_seller_id String | Alipay seller ID, with the same value of partner ID.
|
quantity Number | The quantity of goods
|
trans_name String(256) | The name of the transaction, which is to be shown in the transaction record’s list.
|
partner_trans_id String(64) | The unique transaction ID assigned by the partner in the partner system, can be a sale order ID or a payment order ID.
|
currency String(8) | The currency used for labelling the price of the transaction. This is also the settlement currency with which Alipay settles to the partner. Only HKD is supported.
|
trans_amount Number(11,2) | the transaction amount in the currency given above. Range: 0.01-100000000.00. Two digits after decimal point.
|
buyer_identity_code String(32) | A dynamic code with 16 - 24 digits, used to identify Alipay users. This code starts with 25, 26, 27, 28, 29, or 30, and must be read from Alipay wallet of the user in real time.
|
identity_code_type String(16) | Identity code type, and the value is barcode
|
trans_create_time String(16) | The time that the partner system creates the transaction, which is in a format of yyyyMMddHHmmss. SSS±timezone.
|
memo String(256) | Transaction notes
|
biz_product String(256) | Product name, with a value of OVERSEAS_MBARCODE_PAY
|
extend_info String(512) | Extended information, which contains extended parameters of the request and is in JSON format. For now it contains the following parameters:
Note: The following fields are required fields: secondary_merchant_id, secondary_merchant_industry, secondary_merchant_name, store_id and store_name.
|
trade_information String(6000) | When the Alipay wallet is used, you can specify this field if you want. When the AlipayHK wallet is used, you don’t need to specify this field. (The wallet type is identified by the value of the payment_inst field. ) Information about the trade industry. See trade_information for details.
|
notify_url URL(200) | The URL for receiving asynchronous notifications after the payment is completed.
|
trade_information
Parameter | Description |
business_type String | Business type. 5 types are supported: 1: Hotel 2: AIR 3: Overseas study consulting 4: Sales of goods 5: Others, including all the other business types that do not fall into the above 4 categories. For example, mobile data service recharge, airport pick up service, etc. If more than one type is involved, use the vertical bar to seperate type values.
|
hotel_name String | Hotel name that consists of numbers, letters, spaces, and special characters including ,.<>()[]/\-,. If more than one hotel name exists, separate values with vertical bar (|). Specify this field only when business_type is 1 (Hotel).
|
check_in_time Date | Check-in time. Format: yyyy-MM-dd. Timezone: GMT +8. Specify this field only when business_type is 1 (Hotel).
|
check_out_timeDate | Check-out time. Format: yyyy-MM-dd. Timezone: GMT +8. Specify this field only when business_type is 1 (Hotel).
|
flight_number String | Flight number. If flight transfer exists, separate flight numbers with vertical bar (|). Specify this field only when business_type is 2 (AIR).
|
departure_timeDate | Departure time.Format: yyyy-MM-dd HH:mmTimezone: GMT +8. If flight transfer exists, separate time values with vertical bar (|). Specify this field only when business_type is 2 (AIR).
|
admission_notice_url String | If business_type is 3 (Overseas study consulting), the URL of admission notice (image) must be specified.
|
goods_info String | Goods information that includes SKU names and corresponding quantities, in the format of SKU_name^quantity. If more than one goods exists, separate values with vertical bar (|). Specify this field only when business_type is 4 (Sales of goods).
|
total_quantity Number | Total quantities of all goods in one order. Specify this field only when business_type is 4 (Sales of goods).
|
other_business_type String | If business_type is 5 (Others), specify the business type in details.
|
Note:
Do not use the halfwidth quotation mark (") in parameter values.
Response
Synchronous response
Parameters accepted by Alipay gateway:
Parameter | Description |
is_success String(1) | Indicates whether the request succeeds or not, with a value of T for success and F for failure. Note: a successful request does not mean the business is accepted and processed successfully.
|
sign_type String | Sign type. RSA, RSA2 and MD5 are supported. Use uppercase. Note: This field is not returned if the error code is ILLEGAL_SIGN.
|
sign String(32) | Sign value. This field will not be returned if the error code is ILLEGAL_SIGN
|
result_code String(32) | Processing result of the request, with a value of SUCCESS, FAILED, or UNKNOWN. SUCCESS: the payment succeeds FAILED: the payment is failed. When the value is FAILED, merchants can show the corresponding failure result to the cashier. UNKNOWN: an unknown result. When the value is UNKNOWN, it is suggested for merchants to cancel the transaction immediately if the transaction is in the offline mode. For transactions in the offline to online mode, query the transaction status with a certain frequency until a clear status is returned, or to cancel the transaction after a certain time.
|
error String(48) | Error code that is returned when the request is not successful to describe the request failure reason. For more information, see the Error Code section in this document.
|
alipay_buyer_login_id String(64) | Alipay login ID of the buyer, which can be an email address or mobile number. The ID is partially masked for privacy.
|
alipay_buyer_user_id String(16) | The unique ID for each Alipay account, which starts with 2088.
|
partner_trans_id String(64) | Equal to the partner_trans_id given in the request
|
alipay_trans_idString(64) | The transaction ID assigned by Alipay for the partner’s payment request, which follows a mapping relation with the partner field plus the partner_trans_id field.
|
alipay_pay_timeString(16) | The time that the transaction was paid, which is in a format of yyyyMMddHHmmss.
|
currency String(8) | The currency used for labelling the price of the transaction.
|
trans_amount Number(11,2) | The transaction amount in the currency given above. Range: 0.01-100000000.00. Two digits after decimal point.
|
payment_inst String | Identifies the wallet type with a value of ALIPAYCN or ALIPAYHK.
|
m_discount_forex_amount Number(9,2) | If coupons/vouchers are used in the transaction, the discount amount redeemed in the settlement currency will be returned. Otherwise, no return.
|
Parameters rejected by Alipay gateway:
Parameter | Description |
is_success String(1) | Indicates whether the request is accepted by Alipay gateway. T: accepted F: rejected
|
sign_type String | Sign type. RSA, RSA2 and MD5 are supported. Use uppercase.
|
sign String(32) | Sign value
|
error String(48) | Error code that is returned when the request is failed to describe the request failure reason. This field is not returned when result_code is SUCCESS. For more information, see the Error Code section in this document.
|
Asynchronous response
Parameter | Description |
Basic parameter | |
notify_time Timestamp | The time when the notification is sent. The time format is yyyy-MM-dd HH:mm:ss
|
notify_type String | Notification type
|
notify_id String | Notification ID, used by the partner system to verify the notification
|
sign_type String | Sign type. RSA, RSA2 and MD5 are supported. Use uppercase.
|
sign String | Sign value
|
notify_action_type String | Notification action type. The value can be one of the following items:
|
Business parameter | |
out_trade_no String | Unique order ID in the order system in the corresponding merchant's website other than Alipay trade number. Uniqueness of this parameter in merchant's website shall be guaranteed. This is a parameter transmitted upon corresponding request, which shall be returned in its original shape.
|
subject String(256) | Brief description of the transaction.This parameter is in the first column of Alipay trade details and is important for account checking. This parameter is transmitted by the corresponding request and needs to be returned with its original value.
|
trade_no String(64) | The serial number assigned by Alipay to identify a trade in the Alipay system, with a length in the range 16 - 64 bits.
|
trade_status String | Transaction status. See Trade status for details.
|
gmt_create Date | The time when the trade transaction is created. Format: yyyy-MM-dd HH:mm:ss. Use GMT+8.
|
gmt_payment Date | The time when the payment is completed. Format: yyyy-MM-dd HH:mm:ss. Use GMT+8.
|
buyer_email String | Buyer's Alipay ID, which can be an email address or phone number.
|
seller_id String | Seller's unique Alipay user ID, consists of 16 digits and begins with 2088.
|
buyer_id String | Buyer's unique Alipay user ID, consists of 16 digits and begins with 2088.
|
price Number | Goods price. This parameter is transmitted by the corresponding request and needs to be returned with its original value.
|
quantity Number | The quantity of goods. This parameter is transmitted by the corresponding request and needs to be returned with its original value.
|
total_fee Number(11,2) | Total amount of a transaction in RMB. It is the corresponding parameter upon request, and will be returned back as it is if the currency is RMB. For a foreign currency, corresponding RMB amount will be calculated based on the exchange rate.
|
body String | Detailed description about the goods. This parameter is transmitted by the corresponding request and needs to be returned with its original value.
|
refund_fee Number | The refund amount. The unit is Yuan.
|
paytools_pay_amount String | Payment amount information of all successful payments in various channels.
|
extra_common_param String | This parameter is returned with the value of passback_parameters in the corresponding request.
|
m_discount_forex_amount Number | If coupons/vouchers are used in the transaction, the discount amount redeemed in the settlement currency will be returned. Otherwise, no return.
|
Error codes
Error code | Description |
SYSTEM_ERROR | Alipay system is not available. Try again later. Please check whether the network connection is correct, or ask the user to upgrade it to the latest version of Alipay wallet. If you are still unable to use it, try again later. If it still fails, please contact Alipay for investigation. |
ILLEGAL_SIGN | Illegal signature |
INVALID_PARAMETER | Parameter value error. Check each request parameter according to the API specification. |
ILLEGAL_ARGUMENT | Parameter name error. Check each request parameter according to the API specification. Contact Alipay technical support if this error persists |
ILLEGAL_PARTNER | Incorrect partner ID. Ensure that the value of partner parameter matches the partner value provided by Alipay. Contact Alipay technical support if this error persists |
ILLEGAL_EXTERFACE | Interface configure error. Ensure that the service parameter has the same value with the one in API specification. Contact Alipay technical support if this error persists |
ILLEGAL_PARTNER_EXTERFACE | The partner ID does not have access privilege. Contact Alipay technical support. |
ILLEGAL_SIGN_TYPE | Illegal sign type. Ensure that the value of sign_type is among MD5,RSA and RSA2. Contact Alipay technical support if this error persists. |
HAS_NO_PRIVILEGE | Has no privilege. Contact Alipay technical support. |
TRADE_BUYER_NOT_MATCH | Buyer not match. The erchant can ask the user to show or scan the last barcode which is used for the previous payment or the merchant can refresh the partner_trans_id to generate a new payment. If this error persists, contact Alipay technical support for help. |
TRADE_HAS_CLOSE | The corresponding trade is closed, and is not allowed for the current operation. The merchant can generate a new payment. |
TRADE_STATUS_ERROR | The corresponding trade status is not allowed for the current operation. The partner system needs to generate a new partner_trans_id request to Alipay. If a same error code returned, use the other payment method such as cash or the credit card. |
EXIST_FORBIDDEN_WORD | The entered context contains forbidden words according to China law. The partner needs to check the value of the trans_name parameter. |
SELLER_NOT_EXIST | The value of alipay_seller_id is not correct, therefore, the corresponding account cannot be found. The merchant needs to check if the partner ID is correct. |
BUYER_NOT_EXIST | The value of buyer_identity_code is not correct, therefore, the corresponding account cannot be found. The merchant can ask the user to use the other payment method such as cash or the credit card. |
BUYER_ENABLE_STATUS_FORBID | For Alipay CN Wallet only, the buyer account has been disabled due to security issues. 1. Users need to complete the real-name validation accordingly 2. Cannot support Hong Kong and Macau residents 3. Cannot support foreign residents 4. User can contact Alipay CS hotline for help |
BUYER_SELLER_EQUAL | The buyer account is equal to the seller account. Change the user's Alipay account. |
CLIENT_VERSION_NOT_MATCH | Client version doesn't match. Update the current Alipay wallet to the latest version. |
SOUNDWAVE_PARSER_FAIL | Incorrect barcode. 2. Cashier checks whether the scanner is handled correctly. 3. Cashier makes sure not to scan the user's barcode repeatedly. |
CONTEXT_INCONSISTENT | Trade information is inconsistent. The merchant checks whether the request data equals to the previous one. |
PRODUCT_AMOUNT_LIMIT_ERROR | Product quota is exceeded. Contact the Alipay technical support. |
BUYER_BALANCE_NOT_ENOUGH | The buyer’s Alipay account does not have enough balance for the current operation. Cashier can ask the user to top-up the balance or bind a new bank card with sufficient fund. |
TOTAL_FEE_EXCEED | For Alipay CN Wallet only, the trade amount exceeds the limitation. The user can use the other payment method such as cash or the credit card. |
BUYER_PAYMENT_AMOUNT_DAY_LIMIT_ERROR | For Alipay CN Wallet only, the total trade amount for the buyer exceeds the limitation of the user's daily maximum amount. The user can use the other payment method such as cash or the credit card. |
BUYER_PAYMENT_AMOUNT_MONTH_LIMIT_ERROR | For Alipay CN Wallet only, the total trade amount for the buyer exceeds the limitation of the user's monthly maximum amount. The user can use the other payment method such as cash or the credit card. |
ERROR_BUYER_CERTIFY_LEVEL_LIMIT | For Alipay CN Wallet only, the buyer is failed to pass PBOC’s validation. The user needs to complete the real-name validation. |
ERROR_SELLER_CERTIFY_LEVEL_LIMIT | For Alipay CN Wallet only, the seller is failed to pass PBOC’s validation. The merchant needs to supplement the business license and some other materials (small possibilities for overseas partners). |
PAYMENT_REQUEST_HAS_RISK | For Alipay CN Wallet only, the current trade contains risk detected by Alipay. The user can contact Alipay CS window for help or use the other payment method such as cash or the credit card. |
NO_PAYMENT_INSTRUMENTS_AVAILABLE | No available payment tool can be used for the current operation. Ask the user to pay again. If the issue persists, ask the user to contact Alipay technical support for help. |
BUYER_BANKCARD_BALANCE_NOT_ENOUGH | For Alipay CN Wallet only, the buyer’s bank account do not have enough balance for the current operation. Ask the user to top up the Alipay account or use another bank card to pay for the order again. |
PAYMENT_FAIL | The transaction is failed. The partner retries the payment with the same partner_trans_id. |
MOBILE_PAYMENT_SWITCH_OFF | For Alipay CN Wallet only, the buyer switches off the mobile payment function, therefore, the operation cannot be performed. The user needs to access to www.alipay.com, enter [账户管理], then [支付宝钱包设置], and activate [支付宝钱包支付]. |
USER_FACE_PAYMENT_SWITCH_OFF | For Alipay CN Wallet only, the buyer switches off the face-to-face payment function, therefore, the operation cannot be performed. Ask the user to disable [付款码] at the top right corner in the Alipay wallet, and switch it on again. |
ERROR_BALANCE_PAYMENT_DISABLE | For Alipay CN Wallet only, the buyer switches off the balance payment function, therefore, the operation cannot be performed. The user needs to access to www.alipay.com, then enter [账户管理], then [付款方式和额度], and switch on[账户支付功能]. |
EXCHANGE_AMOUNT_OR_CURRENCY_ERROR | The exchange amount or currency is not allowed for the current operatation. The merchant checks whether the amount and the currency parameter are correct. |
NOT_SUPPORT_PAYMENT_INST | The current seller PID does not support to acquire the buyer's wallet type. |
Samples
Request
https://intlmapi.alipay.com/gateway.do?service=alipay.acquire.overseas.spot.pay&sign_type=MD5&partner=2088021966645500&_input_charset=UTF-8¤cy=HKD&alipay_seller_id=2088021966645500&trans_name=IPhone%207%20Plus&partner_trans_id=partner_trans_id_2019010_000035&trans_amount=0.01&buyer_identity_code=280662309297595823&identity_code_type=barcode&biz_product=OVERSEAS_MBARCODE_PAY&extend_info=%7B%22secondary_merchant_id%22%3A%221314520%22%2C%22secondary_merchant_name%22%3A%22Mika's%20coffee%20shop%22%2C%22secondary_merchant_industry%22%3A%225499%22%2C%22store_name%22%3A%22Mika's%20coffee%20shop%22%2C%22store_id%22%3A%221993%22%7D&sign=d10760949383ca787063af1452ba23a7
Response
Synchronous response
Request succeeds, and the business processing succeeds:
<alipay>
<is_success>T</is_success>
<request>
<param name="biz_product">OVERSEAS_MBARCODE_PAY</param>
<param name="_input_charset">UTF-8</param>
<param name="identity_code_type">barcode</param>
<param name="sign">d10760949383ca787063af1452ba23a7</param>
<param name="alipay_seller_id">208xxxxxxxxx5500</param>
<param name="trans_name">IPhone 7 Plus</param>
<param name="trans_amount">0.01</param>
<param name="extend_info">
{"secondary_merchant_id":"1314520","secondary_merchant_name":"Mika's coffee shop","secondary_merchant_industry":"5499","store_name":"Mika's coffee shop","store_id":"1993"}
</param>
<param name="partner_trans_id">partner_trans_id_2019010_000035</param>
<param name="partner">208xxxxxxxxx5500</param>
<param name="service">alipay.acquire.overseas.spot.pay</param>
<param name="currency">HKD</param>
<param name="sign_type">MD5</param>
<param name="buyer_identity_code">280xxxxxxxxxxx5823</param>
</request>
<response>
<alipay>
<alipay_buyer_login_id>852-xxxx4034</alipay_buyer_login_id>
<alipay_buyer_mobile_no>852-xxxx4034</alipay_buyer_mobile_no>
<alipay_buyer_user_id>208xxxxxxxxx4270</alipay_buyer_user_id>
<alipay_pay_time>201xxxxxxx2208</alipay_pay_time>
<alipay_trans_id>201xxxxxxxxxxxxxxxxxxxxx7760</alipay_trans_id>
<currency>HKD</currency>
<partner_trans_id>partner_trans_id_2019010_000035</partner_trans_id>
<payment_inst>ALIPAYHK</payment_inst>
<result_code>SUCCESS</result_code>
<trans_amount>0.01</trans_amount>
</alipay>
</response>
<sign>f6fc975b0662080f5bad416f1f4e650d</sign>
<sign_type>MD5</sign_type>
</alipay>
Request succeeds, but the business processing is failed:
<alipay>
<is_success>T</is_success>
<request>
<param name="trans_create_time">201xxxxxxxxx0200</param>
<param name="memo">alipay internal testing</param>
<param name="identity_code_type">barcode</param>
<param name="alipay_seller_id">208xxxxxxxxx5594</param>
<param name="trans_amount">1</param>
<param name="sign_type">MD5</param>
<param name="trans_name">iphone</param>
<param name="buyer_identity_code">145xxxxxxxxxxxxx5693</param>
<param name="partner_trans_id">test04</param>
<param name="password">SJV88po0XvIptqWGM4rxP5EQ</param>
<param name="sendFormat">normal</param>
<param name="sign">c99780c20d9f97b1a8fc2eb3f1506aa2</param>
<param name="_input_charset">UTF-8</param>
<param name="title">test title</param>
<param name="biz_product">OVERSEAS_MBARCODE_PAY</param>
<param name="service">alipay.acquire.overseas.spot.pay</param>
<param name="quantity">1</param>
<param name="partner">208xxxxxxxxx5594</param>
</request>
<response>
<alipay>
<error>INVALID_PARAMETER</error>
<result_code>FAILED</result_code>
</alipay>
</response>
<sign>1708693b8fc97390087aad556a9ba733</sign>
<sign_type>MD5</sign_type>
</alipay>
Asynchronous response
https://www.mikascoffee.com/notify?
currency=USD
trade_no=2019120522001461120594234048
subject=123123
paytools_pay_amount=[{"BANKCARD":"0.07"}]
buyer_email=6******@qq.com
gmt_create=2019-12-05 15:18:44
notify_type=trade_status_sync
forex_rate=7.06910000
quantity=1
out_trade_no=partner_trans_id_20191205_151755
seller_id=2088021966388155
notify_time=2019-12-05 15:18:45
trade_status=TRADE_SUCCESS
total_fee=0.07
gmt_payment=2019-12-05 15:18:45
notify_action_type=payByAccountAction
price=0.07
buyer_id=2088812485361127
notify_id=2019120500222151845061120549216429
sign_type=MD5
sign=$$$
Offline to online scenarios
In most cases, offline to online mode will be activated in the scenarios below :
- Customer switch off the offline feature on Alipay homepage (www.alipay.com)
- Alipay’s risk system detects that the payment has a risk
- User’s balance channel is switched off or frozen
- System error (Alipay system handle payment channel error )
- When insufficient fund is detected when all the payment channel is checked by Alipay
- Transaction threshold exceeded
- Accumulated transaction threshold exceed for current day
- Accumulated transaction threshold exceed for current month