QR code payment refers to the “scan” payment method in the Alipay Wallet. The user can open the wallet, scan the QR code generated on the merchant side, and complete the payment in different use cases. The payment method fits the offline payment in store and face-to-face payment scenarios, etc.
Use case:
The cashier sends the order information to Alipay with this interface, and displays the user with the returned QR code from Alipay. The user can scan the QR code and complete the payment.
Parameter | Type | Mandatory | Length | Description | Sample |
---|---|---|---|---|---|
app_id | String | Y | 32 | An app id assigned to the developer by Alipay | 2014072300007148 |
method | String | Y | 128 | api name | alipay.trade.precreate |
charset | String | Y | 10 | The char set for request use, like utf-8, gbk, gb2312, etc. | utf-8 |
sign_type | String | Y | 10 | The type of signature algorithm used by the merchant to generate the signature string. Currently RSA and RSA2 are supported. | RSA2 |
sign | String | Y | 256 | Signature string | |
timestamp | String | Y | 19 | The sending time of the request, formatting in “yyyy-MM-dd HH:mm:ss” | 2014-07-24 03:07:50 |
version | String | Y | 3 | The version of this API, hard coded as 1.0 for now. | 1.0 |
app_auth_token | String | N | 40 | Please refer to the section “application authorization” |
Parameter | Type | Mandatory | Length | Description | Sample |
---|---|---|---|---|---|
out_trade_no | String | Y | 64 | The unique transaction id from the partner. This is used for idempotence check. | 20150320010101001 |
seller_id | String | N | 28 | If null, it will default to the value of the partner_id. | 2088102146225135 |
total_amount | String | N | 9 | Total amount. The unit is 1 CNY. The number should be in the form of 0 or 2 digits after the decimal point. If we pass in “discountable_amount” and “undiscountable_amount” in the mean time, this parameter can be skipped If we pass in “total_amount”, “discountable_amount” and “undiscountable_amount” in the same time, then we must have total_amount = discountable_amount + undiscountable_amount |
88.88 |
discountable_amount | String | N | 9 | The amount that will be discountable. The unit is 1 CNY. The number should be in the form of 0 or 2 digits after the decimal point. If we pass in “discountable_amount” and “total_amount” in the mean time, the parameter can be skipped. The default value will be: total_amount - discountable_amount |
8.88 |
undiscountable_amount | String | N | 9 | The amount that will not be discountable. The unit is 1 CNY. The number should be in the form of 0 or 2 digits after the decimal point. If we pass in “undiscountable_amount” and “total_amount” in the mean time, the parameter can be skipped. The default value will be: total_amount - undiscountable_amount |
80.00 |
subject | String | Y | 256 | Subject | Iphone6 16G |
body | String | N | 128 | The detailed description of the order. | Iphone6 16G |
goods_detail | GoodsDetail[] | N | The item details of the order. It is a JSON string represents an array of product items. For more details, please refer to “Item details”. | [{“goods_id”:“apple-01”,“goods_name”:“ipad”,“goods_category”:“7788230”,“price”:“2000.00”,“quantity”:“1”}] | |
└goods_id | String | Y | 32 | goods id | apple-01 |
└alipay_goods_id | String | N* | 32 | goods id defined by Alipay | 20010001 |
└goods_name | String | Y | 256 | goods name | ipad |
└quantity | number | Y | 10 | goods quantity | 1 |
└price | Price | Y | 9 | goods unit price for Yuan | 2000 |
└goods_category | String | N* | 24 | goods category | 34543238 |
└body | String | N* | 1000 | The description of goods | discounted phone |
operator_id | String | N | 28 | Operator id | Yx_001 |
store_id | String | N | 32 | Store id | NJ_001 |
terminal_id | String | N | 32 | Terminal id | NJ_T_001 |
extend_params | String | N | Extended parameter,it contains “sys_service_provider_id”. Please fill in this field with the system provider’s PID for fee calculation purpose. | {“sys_service_provider_id”:“ 2088511833207846”} | |
└ sys_service_provider_id | String | N* | 64 | Isp id, this parameter is used for return commission data extraction. Please fill in isp’s pid | 2088511833207846 |
timeout_express | String | N | 6 | The time span that the payment is allowed to be completed. The value is from 1 min (1m) to 15 days (15d). m-minute,h-hour,d-day,1c-current day. When the value is set to 1c. The order will be closed at 0 am next day. The value of the number must be integer. We can set the value to 90m instead of 1.5 hour. |
90m |
royalty_info | String | N | 2000 | The description of fee split. Please refer to session “fee split” for details. | {“royalty_type”:“ROYALTY”,“royalty_detail_infos”:[{“serial_no”:“1”,“trans_out”:“2088101126765726”,“trans_in”:“2088101126708402”,“amount”:“0.10”,“desc”:“分账测试1”},{“serial_no”:“2”,“trans_out”:“2088101126765726”,“trans_in”:“2088101126707869”,“amount”:“0.10”,“desc”:“分账测试2”}]} |
└royalty_type | String | N | 150 | The type of the fee split with the merchant. We support only ROYALTY type for now. | ROYALTY |
royalty_detail_infos | String | Y | 2500 | The details of the fee split. It can be with multiple instructions in JSON forma. For more details, please refer the following table. | [{“serial_no”:“1”,“trans_out”:“2088101126765726”,“trans_in”:“2088101126708402”,“amount”:“0.10”,“desc”:“分账测试1”},{“serial_no”:“2”,“trans_out”:“2088101126765726”,“trans_in”:“2088101126707869”,“amount”:“0.10”,“desc”:“分账测试2”}] |
└serial_no | Number | N* | 9 | Fee split’s serial number,which means the order of fee split actions, must be positive. | 1 |
└trans_in_type | String | N* | 24 | The type of account which receives fee split. User_id: the unique id that matches Alipay account bandindex: the bank id after fee split to the bank account. Now only one bank id split is allowed. storeid:the corresponding bank card id for the split store. The default is userid. |
userid |
└batch_no | String | Y | 32 | The split batch number. Currently need to use together with bankindex account. | 123 |
└out_relation_id | String | N* | 64 | The external connected account for the merchants split which is used to connect each split information. The merchants need to secure the uniqueness. If it is empty, the default will be set as “the uniqe order number from the merchant plus the split serial numbernumber.” | 20131124001 |
└trans_out_type | String | Y | 24 | The account type of the account needs to split.Currently only userid is supported. The default is set as userid. | userid |
└trans_out | String | Y | 16 | If the trans out account type is userid, this parameters is the Alipay account needs to split corresponding to the unique Alipay userid, starts with 2088(numbers only). | 2088101126765726 |
└trans_in | String | Y | 28 | If the trans in account type is userid, this parameters is the Alipay account needs to accept split fee corresponding to the unique Alipay userid,starts with 2088(numbers only). If the tran in account type is bankindex, this parameters will be the 28-digit bank id. If the trans in account type is storeid, this parameters will be the merchant’s store id. |
2088101126708402 |
└amount | Number | Y | 9 | The split amount in Yuan | 0.1 |
└desc | String | N* | 1000 | The description of split info | 分账测试1 |
Remarks:
If the store_id that passed in by the merchant does not match with the store_id previously input, then we could not verify and redeem the store’s marketing campaigns and coupons.
Sample:
method=alipay.trade.precreate, app_id=2014072300007148, charset=utf-8, sign_type=RSA2, sign=MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAL4HgSt9hfOpv9MSwgUvfpgOH7WkC7WrTr84m29b0VfnZtK+9jv/YPXYr+22DrxfWJkdPiXJvSjifxPudlqjX21l6/8k79i/4HRCz8DBcdw5jqROfpoq0l3vYfPVqJGwSqaPhtM1Bb4hAD2yLlN2ukfCbshSntUEFd4ozocLolW/AgMBAAECgYBVHTNj8WMQElYTCnHQtMc1AA5/4yxDgKlSyN4F8NBBWSoa9uF/WhFpzFZwWH0dLm+WlRyC/Gs3ZsuYd9SXIFna9mv49+cEfObSzJhvW5DXOVCi+c4Ap3cTsXZiAj8DMsoCb9OjRHNl/BqzN0kl0Wm1diZvXl9YgSRqbzpXzoj4oQJBAOYLSk87XFYodvwr4aL3KFjZZZhHj1Jpp/q61SNgB03aXqZu9m+hk1X4mTGn4rhA7Cl2ZuL+OoxxnJFDw0cbMRcCQQDTeGgx0VUC+O3zAtzMmocjE7WuesRC3IjhU30of4GGjQzIXvKOQCCuUF2DHvIkrB/k2E75n8+TI9matbLS11mZAkEAtSek7/oF/89Dy9dei2/o9PbVu3J22eZcIuVoHMBtYBCbwqLVLBloJiZrtR/JOWHe19Pmt9COGLULH5XmPKOcJwJAUZnP0xFs1XXLFA/Rtd4XMXDklYxn+UjyRMibrintiEcbXKJOxJd4ROtb+kHRvFbzA7J4XxjM14Fo8asVcwiIWQJAVco+9qQzZ7JZzFzk0KTWhQlfbcRByLX25XIPbIes2lmY2uM895yrY/8kbGx2JgD/VGITWwth+uuutXUQ9K6HIw==, timestamp=2014-07-24 03:07:50, biz_content={ "out_trade_no": "201503022001", "total_amount": "88.88", "discount_amount":"8.88", "unDiscount_amount": "80", "subject": "当面付二维码支付", "goods_detail": [ { "goods_id": "apple-01", "goods_name": "ipad", "goods_category": "7788230", "price": "88.88", "quantity": "1" } ], "operator_id": "op001", "store_id": "pudong001", "terminal_id": "t_001", "timeout_express": "90m" }"
Parameter | Type | Mandatory | Description | Sample |
---|---|---|---|---|
royalty_type | String(150) | N | The type of the fee split with the merchant. We support only ROYALTY type for now. | ROYALTY |
royalty_detail_infos | String | Y | The details of the fee split. It can be with multiple instructions in JSON forma. For more details, please refer the following table. | [{“serial_no”:“1”,“trans_out”:“2088101126765726”,“trans_in”:“2088101126708402”,“amount”:“0.10”,“desc”:“分账测试1”},{“serial_no”:“2”,“trans_out”:“2088101126765726”,“trans_in”:“2088101126707869”,“amount”:“0.10”,“desc”:“分账测试2”}] |
serial_no | String | Y | The serial number. It defines the order of the fee split,and must be a positive number. | 1 |
out_relation_id | String | N | The unique id for the fee split passed in by the merchant. It is used to identify the information of every fee split. The merchant must guarantee the uniqueness of the id inside the merchant system.If it is empty, the default value would be “out_trade_no + serial_no”. | 20131124001 |
trans_out_type | String | N | The account type of account with the fee split. Currently we have support only “userId”, which means the unique id of the Alipay account in the format of 16 digit number starting with “2088”. The default will be “userId”. | userId |
trans_out | String | N | The account, which receives the fee split. If the type is “userId”, this item will be the unique id of the Alipay account in the format of 16 digit number starting with “2088”. The default would be the Alipay account of the terminal / store/ merchant which receives the fee which is the terminal. |
2088101126765726 |
trans_in_type | String | N | The account, which provides the fee. userId—— The userId of the Alipay account number;bankIndex——The bank Index number. For now we support only one bank index number.storeId—— The store id, from whose bank card will be charged for the fee. The default is userId. |
userId |
trans_in | String | Y | The detailed account information, which provides the fee. If the type is userId, it will be the unique id of the Alipay account in the format of 16 digit number starting with “2088”. If the type is bankIndex, it will be the bank Index number of the 28 character (digit) which the merchant provides Alipay in the contract. If the type is storeId, it will be the store id. |
2088101126708402 |
batch_no | String | N | The batch number. It is used when the trans_in_type is “bankIndex”. | 123 |
amount | String | Y | The total amount which will be charge with the fee, in CNY. | 0.10 |
desc | String | N | Description. | 分账测试1 |