Docs
Docs
  • 简体中文
  • English
Docs
  • 简体中文
  • English
  • Docs

    • Common Conventions
    • Collection / Payin
    • Payout / Remittance
    • Account Balance
    • Transaction Query
    • Async Notification (Collection / Payout)
    • Signature
    • Account (Acct)
    • Special Instructions

Collection / Payin

Create Collection Order

Endpoint

https://{$api_host}/api/pay

Request Parameters

FieldKeyRequiredSignedTypeExampleDescription
Merchant IDmeridYesYesstring10086Merchant ID assigned by the platform.
Merchant Order No.tnoYesYesstringtno1234578910jqkMerchant order number (max 32 chars, alphanumeric).
AmountamtYesYesstring126.35Total amount (2 decimals).
ChannelchnlYesYesstringCHNL_CODEChannel code. It differs per merchant. Select in Merchant Console (type dp).
Client IPclient_ipNoYesstring127.0.0.1Client IP address used to initiate the payment. Helps improve success rate by region.
Notify URLnotify_urlYesYesstringhttps://www.baidu.comAsync callback URL (retry at 5s/10s/30s/180s/600s on success).
Return URLreturn_urlNoYesstringhttps://www.baidu.comRedirect URL after completion.
ExtraextraNoYesstringExtra parameters required by some channels, and extra data returned by some channels on success.
Payer AccountacctNoYesobjectSee Account (Acct). Currently channels prefixed with ph_ do not require this field.
SignaturesignYesNostringc380be5...Signature. See Signature.

!! Important:

  • Non-required fields must be removed from the signature string when empty.
  • URL fields must be URL-encoded before signing.
  • Amount keeps 2 decimals. Note that .00 may be omitted; pay special attention during signing.
  • If acct is provided, it must be flattened during signing. See Signature.
  • acct fields are shown in the “acct examples”. If you are unsure, you can ignore it for now.
  • Even if a channel does not require acct, if you provide it, it will still be included in signature verification.

Request Example

{
  "merid": "10086",
  "tno": "sn1234578910jqk",
  "amt": "50.00",
  "chnl": "cscn_cspb",
  "client_ip": "127.0.0.1",
  "return_url": "https://www.baidu.com",
  "notify_url": "https://www.baidu.com",
  "extra": "",
  "sign": "9a9cba23f9075ff01b2ed2050f52f42d"
}

Response Parameters

FieldKeyTypeExampleDescription
Platform Order No.snstringsn12345678Platform order number.
Merchant Order No.tnostringtno1234578910jqkMerchant order number.
Amountamtstring1200.20Order amount. Formatted string. Convert type when needed.
Feefeestring12.20Fee amount. Formatted string. Convert type when needed.
Create Timectmstring2008-08-08 08:08:08Order creation time.
Expire Timeetmstring2008-08-08 12:17:12Expiry time. May not exist.
Datadatastringbase64 or arrayFor QR images etc, returns base64.
Redirect / Cashier URLurlstringurlFor redirect/cashier flows, returns the URL.
Receiver Accountacctobjectreturned by some channels
Response Example
{
  "data": {
    "sn": "sn12345678",
    "tno": "tno1234578910jqk",
    "amt": "100.00",
    "ctm": "2008-08-08 08:08:08",
    "etm": "2008-08-08 12:17:12",
    "url": "http://abc.com/payment/pay/A20191107055050B07115.html",
    "acct": {
      "name": "Zhang San",
      "acct": "1234567890"
    }
  }
}

Response Notes

  • For redirect flows, only the cashier URL is returned and acct is not included.
  • For cashier flows, the response may include both url and acct. Some channels return acct for building your own cashier page; you need to display it.

Collection Query

Endpoint
https://{$api_host}/api/pay/query
Request Parameters
FieldKeyRequiredTypeExampleDescription
Merchant IDmeridYesstring10086Merchant ID assigned by the platform (not the login account).
Platform Order No.snYesstringsn1234578910jqkPlatform order number (not your business order number).
Merchant Order No.tnoYesstringtno1234578910jqkMerchant order number.
SignaturesignYesstringc380bec2bfd727a4.....Signature. See the signature algorithm.

!! Important:

  • Platform order number and merchant order number must be provided. At least one must be provided.
  • Merchant order number can only query the last 3 days of data.

Request Example

{
  "merid": "10086",
  "sn": "sn1234578910jqk",
  "sign": "9a9cba2119075ff01b2ed2050f52f42d"
}
Response Parameters
FieldKeyTypeExampleDescription
Merchant IDmeridstring10086Merchant ID assigned by the platform (not the login account).
Platform Order No.snstringsn12345678Platform order number.
Merchant Order No.tnostringtno1234578910jqkMerchant order number.
Create Timectmstring2008-08-08 08:08:08Order creation time.
Amountamtfloat1260.35Order amount.
Feefeefloat12.35Order fee.
Statusstsstringsuccesssuccess indicates paid successfully.
Signaturesignstring1d48ac07237fa..Used to verify data integrity.

Success Response Example

{
  "data": {
    "merid": "10086",
    "sn": "sn123456",
    "tno": "tno12345678910jqk",
    "amt": "1000.00",
    "fee": "12.35",
    "ctm": "2000-10-10 08:08:08",
    "sts": "submit",
    "acct": {
      "name": "Zhang San",
      "acct": "1234567890"
    }
  }
}

Collection Order Status

StatusDescription
submitSubmitted
payingPaying
failFailed
successSuccess
closeClosed
Prev
Common Conventions
Next
Payout / Remittance