Sale
- Description: Create sale payment, supports WeChat Pay and Alipay payment method
- Path:
/direct/sale
- Method:
POST
- Request Header:
Content-Type: application/json
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
merchantId | string | Required | Merchant identifier |
amount | number | Required | The payment amount |
merchantReference | string | Required | A reference for you to identify this payment, must be unique |
paymentType | string | Required | Payment type. Value can be ALIPAY , ALIPAYHK , WECHAT |
paymentTerminal | string | Required | Payment terminal type. Value can be SDK : mobile SDK, WAP : mobile browser, PCWEB : PC browser |
notifyUrl | string | Optional | An API URL in merchant's backend to receive notification |
referer | string | Optional | The website URL where customers are visiting it from |
userAgent | string | Optional | The characteristic string of the browser application, common format: User-Agent: Mozilla/5.0 (<system-information>) <platform> (<platform-details>) <extensions> |
postLink | string | Optional | The URL posted the payment request |
merchantSite | string | Optional | Merchant's own website URL |
lineItems | array | Required | |
lineItems[index].quantity | number | Required | Number of items, must be an integer, must be an integer |
lineItems[index].priceData | object | Required | Price data object with details |
lineItems[index].priceData.unitAmount | number | Required | Unit amount of the item |
lineItems[index].priceData.name | string | Required | Name of the item |
Example request:
{
"request": "{\"amount\":50,\"lineItems\":[{\"priceData\":{\"name\":\"Book\",\"unitAmount\":50},\"quantity\":1}],\"merchantId\":3,\"notifyUrl\":\"https://www.bbmsl.com/notify\",\"merchantReference\":\"merRef1659080945498\",\"paymentTerminal\":\"SDK\",\"paymentType\":\"ALIPAY\"}",
"signature": "CA3mzG8GHIfzKKr3Csc3RfYtVdnQGX19NtdWiXkXTexnJQiLtK2JvmjmOVA7pcHWAxSwRD7XMjIbVgD+Ckq8XWYzS8+VDXHJeT5lacKBIZoVtYIjonydDJGye2IdDlztjNjSxwnG9HtB8gBSYtZuP+umw60b7+2Z5Fq01mbZCs3bone72jbVS/mv+/d+HreNcUIWXGny3CNsKdG6CPH94yBu7uSPwFBpC2Jf/JrfIDfvPMr9rBW6zB/sJPxXU4W+WgfFQWa2tdG0Pwbh5OSNZaCMbX32Z8sHtTtZ8tEa6NY0oPYTvbNPLA3LU3vzm1tqGWWYYs/j7YnueSjLPhW0mw=="
}
Response Parameters
Parameter | Type | Required | Description |
---|---|---|---|
responseCode | string | Required | Payment Gateway response code |
message | string | Required | Payment Gateway response message |
wechatOrder | object | Optional | |
wechatOrder.appId | string | Optional | This identifier is issued after vendors apply for official account supporting WeChat payment |
wechatOrder.partnerId | string | Optional | Specifies vendor ID assigned by WeChat Payment. It is the sub mch_id when calling the unified order API |
wechatOrder.packageValue | string | Optional | WeChat package value |
wechatOrder.nonceStr | string | Optional | Random string to ensure unpredictability for signatures |
wechatOrder.timeStamp | string | Optional | Specifies the current time |
wechatOrder.sign | string | Optional | Specifies a signature |
alipayData | string | Optional | Alipay response data |
checkoutUrl | string | Optional | URL for generating payment QRCode or redirecting to payment webpage |
Example Response:
caution
The response varies under different paymentTerminal
values.
- SDK
- WAP
- PCWEB
{
"responseCode": "0000",
"wechatOrder": {
"appId": "",
"partnerId": "1480991002",
"packageValue": "Sign=WXPay",
"nonceStr": "924c76ed8f824c31a10d304b33827102",
"timeStamp": "1659081085",
"sign": "GY+eF0u3FTIlEGOsoivnNcd1YrzslMo+UKO9n0NR8TiXRznXm4inICnG+/pm1CHWKBaAKfHWaeLlZkT8sJS398j6EWYNzjEWrsmZhxueCbzTi4avffMUFro006JbFheRzp8MXvpV+48S4lgY08r3+fENVufE3NRx1WeiEPnew3hb/a8WG7qP8BbWwv3KQQFJZp/sbCMxna9x2vyLTFIsB89ZYj7XEMeNlQMoOZ2/hME7QEb1zEqWZ8U1lbCi9N+GAda2pNOLswK2pmK0qJ6jwvtSuL7s9mN//TdpjPYsEJ/Vlt7kGmMg4RnbZnD6Z5EjKYXz7LccaxoyF00X3Mf52w=="
}
}
{
"responseCode": "0000",
"alipayData": "secondary_merchant_industry=\"5814\"&subject=\"Service\"&_input_charset=\"utf-8\"&it_b_pay=\"30m\"&body=\"Product\"¬ify_url=\"https://payapi.sit.bbposmsl.com/direct/notify/alipay\"&product_code=\"NEW_WAP_OVERSEAS_SELLER\"&secondary_merchant_id=\"BBMSL3\"&payment_type=\"1\"&out_trade_no=\"7540S1659080945730\"&partner=\"2088031571746053\"&service=\"mobile.securitypay.pay\"&total_fee=\"50\"&secondary_merchant_name=\"Demo\"&return_url=\"30m\"¤cy=\"HKD\"&seller_id=\"2088031571746053\"&forex_biz=\"FP\"&sign=\"U5lKKrj%2F4aCxdkjJWjkuTASaxVi%2F3A0ZNUt7phTJAzbXRaWxVVKEsHfBlM4w8wpf2%2BXdVfiv%2FvEas3SzhHaoiA6KHkSIEf1OqiOyENITGCGfS8HMqMexljS3%2FftmuAljBafiORlw34dA97dt3%2BC0bdT7PJrLTozjkRATGJUAhgyvxfWgAOsZkry%2Fo%2B9EGj3bmc1sB36jteRhXxq6Yot0ZyBd8TG5cG5Gw07vszeq0Qa8Z7kUlkTV0ROAiyGCYlaNSsEZ3byZPgT0YIrbn5JAwfsZmpVkoLEAo9MkyxGWYB%2F1uo6XsRhWD9e%2Bt1iBvuvDaWp5paHdknw%2BEBORIE0faw%3D%3D\"&sign_type=\"RSA2\""
}
{
"responseCode": "0000",
"checkoutUrl": "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx291555079702924193b6765b55f3540000&package=137028709"
}
{
"responseCode": "0000",
"checkoutUrl": "https://intlmapi.alipay.com/gateway.do?_input_charset=UTF-8&body=Product¤cy=HKD¬ify_url=https%3A%2F%2Fpayapi.sit.bbposmsl.com%2Fdirect%2Fnotify%2Falipay&out_trade_no=7543S1659081319145&partner=2088031571746053&payment_inst=ALIPAYCN&product_code=NEW_WAP_OVERSEAS_SELLER&return_url=https%3A%2F%2Fcheckout.sit.bbmsl.com%2Fresult%3ForderId%3D7543&secondary_merchant_id=BBMSL3&secondary_merchant_industry=5814&secondary_merchant_name=Demo&service=create_forex_trade_wap&subject=service&total_fee=50&sign_type=RSA2&sign=ImLy97J8Yg4TX5h9Nl7RwQdkMh87IsBxOM%2By3rp%2BafoWw5qinGgcRAf60ErqEQ9bOTZDMIdyTzjkq6eMh3JeeY9zSlXhfJoQSo7JRXt0TSla4OR3FPoOEepmCxuzsw7rem9QZg5qR0nLO7T%2BYs0hJ9T2iW82c4IeGm%2B%2F%2BGicXzQcmIzlix00pRHwV8Pq7M8U5e37ZmDTaiEoICAtRBCXMS%2F86mopk7kGW%2B%2FkOFqlVo%2BcSDCkGwZYidDZFlb%2BQJJ3KTXGoN3Vf%2FNpECESF28hBSIA3lOw6zQe3M1ZRHJ1mxFKfdUDaIIBUwStorqXnElqE66KqqsKcoiA5%2BlIAr8VAw%3D%3D"
}
{
"responseCode": "0000",
"checkoutUrl": "weixin://wxpay/bizpayurl?pr=Br9W6l8zz"
}
{
"responseCode": "0000",
"checkoutUrl": "https://intlmapi.alipay.com/gateway.do?_input_charset=UTF-8&body=Product¤cy=HKD¬ify_url=https%3A%2F%2Fpayapi.sit.bbposmsl.com%2Fdirect%2Fnotify%2Falipay&out_trade_no=7544S1659081347428&partner=2088031571746053&payment_inst=ALIPAYCN&product_code=NEW_WAP_OVERSEAS_SELLER&qr_pay_mode=4&qrcode_width=200&return_url=https%3A%2F%2Fcheckout.sit.bbmsl.com%2Fresult%3ForderId%3D7544&secondary_merchant_id=BBMSL3&secondary_merchant_industry=5814&secondary_merchant_name=Demo&service=create_forex_trade&subject=service&total_fee=50&sign_type=RSA2&sign=KUi%2FC%2Fd9JOM%2F8twAZIcYmDAOJqWkOSv7XUktu2Jg0mf7RXAb%2BsULkD%2FwuSwTHEC3NYdBoswSLz%2BAcQzva%2FW%2BRx7Ft%2FZocD9MXSPXPDRZ%2Bo54NPl9pkgnT9eB%2BxrPqBWcd4iOvhSl4zPZ4SS43l341h98qz%2Bk0hYtLrVPARqNj3gAAo5C5Lj9dpZ2zQREtkYodj6xR5%2FXjmimyxMsmkYw9p9TezCaAdcBMnq0%2B6Gvn%2FPl5RjGtMOn2N49e7oqehkN1YueTkNVnV5t5KlNVf63KjUo%2F960K6%2Brh4g13V0nEwWm0Q3Q9yzFNC%2FOMy1h%2FowFxzDA0BNhX34DUVJBzKpARQ%3D%3D"
}