Skip to main content

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

ParameterTypeMandatoryDescription
merchantIdStringMMerchant identifier
amountNumber(9,2)MThe payment amount
merchantReferenceString(64)MA reference for you to identify this payment, must be unique
paymentTypeStringMPayment type. Value can be ALIPAY, ALIPAYHK, WECHAT
paymentTerminalStringMPayment terminal type.
Value can be SDK: mobile SDK, WAP: mobile browser, PCWEB: PC browser
notifyUrlStringOAn API URL in merchant's backend to receive notification
refererStringOThe website URL where customers are visiting it from
userAgentStringOThe characteristic string of the browser application, common format: User-Agent: Mozilla/5.0 (<system-information>) <platform> (<platform-details>) <extensions>
postLinkStringOThe URL posted the payment request
merchantSiteStringOMerchant's own website URL
lineItemsArrayM 
lineItems[index].quantityNumber(8)MNumber of items, must be an integer, must be an integer
lineItems[index].priceDataObjectMPrice data object with details
lineItems[index].priceData.unitAmountNumber(9,2)MUnit amount of the item
lineItems[index].priceData.nameStringMName 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

ParameterTypeMandatoryDescription
responseCodeStringMPayment Gateway response code
messageStringMPayment Gateway response message
wechatOrderObjectO 
wechatOrder.appIdStringOThis identifier is issued after vendors apply for official account supporting WeChat payment
wechatOrder.partnerIdStringOSpecifies vendor ID assigned by WeChat Payment. It is the sub mch_id when calling the unified order API
wechatOrder.packageValueStringOWeChat package value
wechatOrder.nonceStrStringORandom string to ensure unpredictability for signatures
wechatOrder.timeStampStringOSpecifies the current time
wechatOrder.signStringOSpecifies a signature
alipayDataStringOAlipay response data
checkoutUrlStringOURL for generating payment QRCode or redirecting to payment webpage

Example Response:

warning

The response varies under different paymentTerminal values.

Example Wechat Pay Response
{
"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=="
}
}
Example Alipay Response
{
"responseCode": "0000",
"alipayData": "secondary_merchant_industry=\"5814\"&subject=\"Service\"&_input_charset=\"utf-8\"&it_b_pay=\"30m\"&body=\"Product\"&notify_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\"&currency=\"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\""
}