alipay.acquire.precreate
Call this interface to place a pre-order without the payer identity information. Alipay returns a payment URL in the response. Payers can access the payment URL by using Alipay wallet to confirm the order and make the payment.
Request
Service address
Environment | HTTPS request URL |
Production environment | |
Test environment |
Request parameters
Parameter | Description |
service String | Interface name
|
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, GBK, and GB2312 are supported.
|
sign_type String | Sign type. RSA, RSA2 and MD5 are supported. Use uppercase.
|
sign String | Sign value
|
notify_url URL(200) | The URL for receiving asynchronous notifications after the payment is completed.
|
timestamp String | The time when the merchant server sends the request. The value is accurate to the millisecond.
|
terminal_timestamp String | The time when the terminal sends the request. The value is accurate to the millisecond.
|
out_trade_no String(64) | Unique order ID in Alipay’s merchant website
|
subject String(256)
| Brief description of the transaction. Special characters are not supported. Note: The value of this field will be displayed to customers.
|
product_code String(32) | Product code of the Alipay product that you use. The value is OVERSEAS_MBARCODE_PAY for oversea in-store payments.
|
total_fee Number(11,2) | Total amount of a transaction in trans_currency. The amount the user actually pays is converted to amount in CNY or HKD from the value of this parameter.
|
seller_id String(28) | Unique Alipay user ID corresponding to Seller’s Alipay account , which has 16 digits and begins with 2088. If both sell_id and seller-email are null, the default value of this parameter is the value of merchant.
|
seller_email String(100) | Seller’s Alipay account, can be an email address or phone number If seller_id is not null, the value of seller_id shall be the seller’s ID and this parameter can be neglected.
|
body String(400) | Detailed description about the goods. Special characters are not supported.
|
show_url String(400) | The hyperlink for showing goods on the webpage of the checkout counter.
|
currency String(8) | The settlement currency that the merchant specifies in the contract. Only HKD is supported.
|
trans_currency String(8) | The pricing currency. Use the same value for this parameter and the currency parameter. Contact Alipay technical support if you have to use different values. Use upper case.
|
price Number(9,2) | Unit price of the goods in the order. If this parameter is transmitted in the request, the condition of total_fee=price×quantity must be met.
|
quantity String(100) | Quantity of the goods in the order. If this parameter is transmitted at request, the condition of total_fee=price×quantity must be met.
|
goods_detail String | Details about the goods, which is in the format of JSON. The maximum number of goods for this field is 50. For more information, see goods_detail.
|
extend_params String(128) | This field is used for transmitting specific business information of the merchant. This parameter is valid only if the merchant and Alipay agree to transmit this parameter and reach an agreement on the implication of this parameter. For example, store ID and other information under the circumstance that payment can be made through sound wave. The format is JSON. For more information, see extend_params.
|
it_b_pay String(200) | Specifies the time period in which the user can complete the payment from the moment when the user scans the QR code. The trade is closed automatically once the time is up. The value of this field is 3m by default. The value of this field is in the range of 1m - 15d. Notes: 1、The following abbreviations are used to present units of time: m: minute h: hour d: day c: current day (Whenever the trade is created, it will be closed at 0:00). 2、Decimal point of the numerical value of this parameter is rejected, for example, 1.5h need to be transformed to 90m.
|
passback_parameters String(256) | If this parameter was sent to Alipay by the request, Alipay will return this parameter by the asynchronous notification with the extra_common_param parameter.
|
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.
|
qr_code_it_b_pay String(200) | Specifies the time period in which the user can complete the payment from the moment when the QR code was created. The trade is closed automatically once the time is up.The value of this field is in the range of 1m - 2h. If this parameter is specified, the Notes: 1、The following abbreviations are used to present units of time: m: minute h: hour 2、Decimal point of the numerical value of this parameter is rejected, for example, 1.5h need to be transformed to 90m.
|
goods_detail
Parameter | Description |
goodsId String | Goods ID
|
goodsName String | Goods name
|
goodsCategory String | Goods category
|
showUrl String | Hyperlink for the show of goods on the webpage of checkout counter.
|
quantity String | The quantity of goods
|
body String | Detailed description about the goods. Special characters are not supported.
|
price String | Unit price of the goods in the order
|
extend_params
Parameter | Description |
secondary_merchant_id String(32) | The unique ID assigned by the partner to identify a secondary merchant. The ID can contain letters, numbers, and underscores.
|
secondary_merchant_name String(32) | Registration legal name of the secondary merchant, shown in the Alipay Wallet and the reconciliation file to identify a secondary merchant.
|
secondary_merchant_industry String(4) | Industry classification identifier of the secondary merchant, which is assigned by Alipay. For more information about the MCC code, see MCC list.
|
store_id String(32) | The unique ID that is assigned by the partner to identify a store of a merchant, which can contain letters, numbers, and underscores.
|
store_name String(32) | Store name, which is used to be shown in the customer’s Alipay wallet and the reconciliation file
|
terminal_id String(10) | Terminal ID
|
sys_service_provider_id String(32) | System service provider ID, which is used to identify the payment system provider.
|
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_time Date | 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_time Date | 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
Parameter | Description |
Basic parameter | |
is_success String | 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.
|
sign String | Sign value
|
error String | Error code that is returned when the request is failed to describe the request failure reason. For more information, see the Error Code section in this document.
|
Result code | |
result_code String(32) | Processing result of the request, with a value of SUCCESS to indicate the process is successful, FAIL to indicate the process is failed, or UNKNOWN to indicate an unknown result. For more details, see Business Response Code.
|
out_trade_no String(64) | Unique order ID in order system in 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.
|
voucher_type String(10) | Voucher type, and the value is qrcode.
|
qr_code String(128) | Value of the QR code
|
big_pic_url String | URL for the QR code in the big size
|
pic_url String | URL for the QR code in the normal size
|
small_pic_url String | URL for the QR code in the small size
|
detail_error_code String(48) | Detailed error code, which describes the reason for not receiving a result_code of ORDER_SUCCESS_PAY_SUCCESS. If the response code of result_code is ORDER_SUCCESS_PAY_SUCCESS, this parameter is not returned.
|
detail_error_des String(64) | Explanation of the detailed error code. If result_code is ORDER_SUCCESS_PAY_SUCCESS, this parameter is not returned.
|
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(64) | Unique order ID in order system in 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) | Trade number of the trade in the Alipay system, with a length in the range 16 - 64 bits.
|
trade_status String | Alipay transaction status. See Trade status for details.
|
gmt_create Date | The time when the transaction is created. Format: yyyy-MM-dd HH:mm:ss. Use GMT+8.
|
gmt_payment Date | The time when the transaction is paid by the buyer. Format: yyyy-MM-dd HH:mm:ss. Use GMT+8.
|
seller_email String(100) | Alipay account of the seller, with a format of email address or phone number
|
buyer_email String(100) | Buyer’s Alipay account, which can be an email address or phone number.
|
seller_id String(30) | Unique Alipay user ID corresponding to seller’s Alipay account, which contains 16 digits and begins with 2088.
|
buyer_id String(30) | Unique Alipay user ID corresponding to buyer’s Alipay account, which contains 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) | The transaction amount in CNY.
|
trans_amount Number | Total pricing of the order, in the pricing currency trans_currency. It will be null if the trans_currency is CNY
|
currency String(8) | The settlement currency
|
trans_currency String(8) | Pricing currency for the transaction
|
forex_rate String | The exchange rate between the settlement currency and CNY
|
body String(400) | 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 | Refunded amount returned in the refund notification. The unit is Yuan.
|
out_biz_no String(64) | Merchant’s business ID, which is the serial number of the refund request in the refund notification for most cases. Example:HZRF001 |
extra_common_param String(256) | This parameter is returned with the value of passback_parameters in the corresponding request.
|
payment_inst String(6) | This parameter 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 redeened in the settlement currency will be returned. Otherwise, no return.
|
Error codes
Business errors
Error code | Description |
SUCCESS | The order succeeds. |
FAIL | The order is failed. |
CONTEXT_INCONSISTENT | Trade information has been altered. |
TRADE_HAS_SUCCESS | The payment of trade has been made. |
TRADE_HAS_CLOSE | The trade has been closed. |
TRADE_HAS_FINISHED | The trade has been finished. |
REASON_ILLEGAL_STATUS | The trade status is illegal. |
EXIST_FORBIDDEN_WORD | Banned words are included in the order information. |
ACCESS_FORBIDDEN | No right to use the product |
SELLER_NOT_EXIST | The seller does not exist. |
SELLER_BEEN_BLOCKED | The seller's account has been frozen. |
INVALID_PARAMETER | Parameter is invalid. |
BEYOND_PER_RECEIPT_RESTRICTION | The receivable amount of the seller is more than the monthly restriction of the amount. |
TOTAL_FEE_EXCEED | Order amount exceeds the limit. |
USER_LOGONID_DUP | The user’s logon ID is duplicated with the others. |
CURRENCY_NOT_SUPPORT | This currency is not supported. |
Access errors
Error code | Description |
ILLEGAL_SIGN | Illegal signature |
ILLEGAL_DYN_MD5_KEY | Dynamic key information is incorrect. |
ILLEGAL_ENCRYPT | Encryption is incorrect. |
ILLEGAL_ARGUMENT | Parameter is incorrect. |
ILLEGAL_SERVICE | Service parameter is incorrect. |
ILLEGAL_USER | User ID is incorrect. |
ILLEGAL_PARTNER | Partner ID is incorrect. |
ILLEGAL_EXTERFACE | Interface configuration is incorrect. |
ILLEGAL_PARTNER_EXTERFACE | Partner's interface information is incorrect. |
ILLEGAL_SECURITY_PROFILE | Matching private key configuration has not been found. |
ILLEGAL_AGENT | Agency ID is incorrect. |
ILLEGAL_SIGN_TYPE | Signature type is incorrect. |
ILLEGAL_CHARSET | Character set is illegal. |
HAS_NO_PRIVILEGE | No right to visit |
INVALID_CHARACTER_SET | The character set is invalid. |
System errors
Error code | Description |
SYSTEM_ERROR | Alipay system error |
SESSION_TIMEOUT | Session timeout |
ILLEGAL_TARGET_SERVICE | Wrong target_service |
ILLEGAL_ACCESS_SWITCH_SYSTEM | The merchant is not allowed to visit the system of this type. |
EXTERFACE_IS_CLOSED | The interface has been closed. |
Trade Status
Name | Description |
WAIT_BUYER_PAY | The trade has been established and is waiting for the buyer to make the payment. |
TRADE_CLOSED | The trade is closed because the payment has not been completed within a specified time, or because the payment has been fully returned when the trade completes. |
TRADE_SUCCESS | The trade succeeds and is operable, such as multi-level royalty distribution, or refund. |
TRADE_FINISHED | The trade succeeds and is completed. The trade is not operable then. |
Samples
Request
https://intlmapi.alipay.com/gateway.do?service=alipay.acquire.precreate&partner=208xxxxxxxxx5500&_input_charset=UTF-8&sign_type=MD5&product_code=OVERSEAS_MBARCODE_PAY¤cy=HKD&trans_currency=HKD×tamp=2019-09-10%2014%3A43%3A12&out_trade_no=out_trade_no_20190904_163941&subject=Mika's%20coffee%20shop&total_fee=0.01&seller_id=208xxxxxxxxx5500&extend_params=%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=65265ef0ef736ca1a8af7050f5bcc773
Response
Synchronous response
Request succeeds, and the business processing succeeds:
<alipay>
<is_success>T</is_success>
<request>
<param name="extend_params">
{"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="_input_charset">UTF-8</param>
<param name="subject">Mika's coffee shop</param>
<param name="sign">02325e1e5b22f74e0ddf6c7e548c9208</param>
<param name="notify_url">http://www.mikascoffee.com/notify</param>
<param name="product_code">OVERSEAS_MBARCODE_PAY</param>
<param name="trans_currency">HKD</param>
<param name="out_trade_no">out_trade_no_20190910_163922</param>
<param name="partner">2088021966645500</param>
<param name="service">alipay.acquire.precreate</param>
<param name="total_fee">0.01</param>
<param name="currency">HKD</param>
<param name="sign_type">MD5</param>
<param name="seller_id">2088021966645500</param>
<param name="timestamp">2019-09-10 14:43:12</param>
</request>
<response>
<alipay>
<big_pic_url>
https://mobilecodec.alipay.com/show.htm?code=xax02442cpglvupvlqd40044&picSize=L
</big_pic_url>
<out_trade_no>out_trade_no_20190910_163922</out_trade_no>
<pic_url>
https://mobilecodec.alipay.com/show.htm?code=xax02442cpglvupvlqd40044&picSize=M
</pic_url>
<qr_code>https://qr.alipay.com/xax02442cpglvupvlqd40044</qr_code>
<result_code>SUCCESS</result_code>
<small_pic_url>
https://mobilecodec.alipay.com/show.htm?code=xax02442cpglvupvlqd40044&picSize=S
</small_pic_url>
<voucher_type>qrcode</voucher_type>
</alipay>
</response>
<sign>1cec379a82a04adce2a04ca6362a7174</sign>
<sign_type>MD5</sign_type>
</alipay>
Request succeeds, but the business processing fails:
<?xml version="1.0" encoding="utf-8"?>
<alipay>
<is_success>T</is_success>
<request>
<param name="body">face-to-face-payment</param>
<param name="subject">iphone</param>
<param name="sign_type">MD5</param>
<param name="out_trade_no">99003911198989</param>
<param name="total_fee">10</param>
<param name="partner">2088101106499364</param>
<param name="quantity">10</param>
<param name="sign">a1cb41a4019351965d4418c9cb933f0f</param>
<param name="_input_charset">UTF-8</param>
<param name="price">1</param>
<param name="it_b_pay">1d</param>
<param name="product_code">OVERSEAS_MBARCODE_PAY</param>
<param name="service">alipay.acquire.precreate</param>
<param name="seller_id">2088101106499364</param>
</request>
<response>
<alipay>
<result_code>FAIL</result_code>
<detail_error_code>INVALID_PARAMETER</detail_error_code>
<detail_error_des>request paramter invalid</detail_error_des>
</alipay>
</response>
<sign>ea489fc31da63253bab52ed77fb45eb7</sign>
<sign_type>MD5</sign_type>
</alipay>
Request fails or the data accessed is incorrect:
<?xml version="1.0" encoding="utf-8"?>
<alipay>
<is_success>F</is_success>
<error>ILLEGAL_SIGN</error>
</alipay>
Asynchronous response
http://www.mikascoffee.com/notify
trade_no=201xxxxxxxxxxxxxxxxxxxxx7312
subject=Mika's coffee shop
paytools_pay_amount=[{"BANKCARD":"0.01"}]
buyer_email=852-****4034
gmt_create=2019-09-11 19:09:10
notify_type=trade_status_sync
quantity=1
out_trade_no=out_trade_no_20190910_163926
seller_id=208xxxxxxxxx5500
notify_time=2019-09-11 19:09:21
trade_status=TRADE_SUCCESS
total_fee=0.01
gmt_payment=2019-09-11 19:09:21
seller_email=$$$
price=0.01
buyer_id=208xxxxxxxxx4270
notify_id=201xxxxxxxxxxxxxxxxxxxxxxxxxxx8666
sign_type=MD5
sign=$$$