OnlinePay API
  1. API Reference
OnlinePay API
  • Introduction
  • How to start
  • Country Code
  • Currency Code
  • Error Code
  • API Reference
    • Credit Card
      POST
    • Alipay
      POST
    • Union Pay
      POST
    • WeChat
      POST
    • Cryptocurrency Payment
      POST
    • OnlinePay CheckOut
      POST
    • notifyUrl
      POST
    • Refund
      POST
    • Query
      POST
    • QueryOrderList
      POST
  1. API Reference

Union Pay

POST
https://pay.online.ai/payment
Note: OnlinePay background will obtain the referer of Http Header to verify the website source. The website source must be configured in the OnlinePay merchant background to pass the detection. If you do not access the interface through a browser, you need to actively add a referer

Request

Header Params
paymentType
string 
required
Fixed value: UNIONPAY
Body Params application/json
merNo
integer 
required
Merchant Number, Unique identifier assigned to the merchant by the onlinepay payment platform when registering with onlinepay
merOrderNo
string 
required
Merchant Order Number, Each order must be unique, and each merchant order number can only be submitted once within 1 second
currencyCode
string 
required
Please refer to Currency Code
sourceAmount
string 
required
Total amount of the order, keep two decimals
returnUrl
string 
required
Jump address after payment is completed,
<= 512 characters
notifyUrl
string 
optional
When the payment is completed, the payment result will be sent to notifyUrl
<= 512 characters
sign
string 
required
signature, MD5(merNo+merOrderNo+currencyCode+sourceAmount+PrivateKey)
ipAddress
string 
required
Cardholder IP address
version
string 
required
V3.0.0
userId
string 
required
Payment user ID
email
string 
required
Payment user Email
<= 100 characters
Example
{
    "merNo": 111111,
    "merOrderNo": "222222",
    "currencyCode": "CNY",
    "sourceAmount": "100.05",
    "returnUrl": "https://example.com",
    "notifyUrl": "https://example.com/notify",
    "sign": "9D6FDF4880B00B002B1F2AB61AE9A721",
    "ipAddress": "116.235.134.86",
    "version": "V3.0.0",
    "userId": "111",
    "email": "example@gmail.com"
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://pay.online.ai/payment' \
--header 'paymentType;' \
--header 'Content-Type: application/json' \
--data-raw '{
    "merNo": 111111,
    "merOrderNo": "222222",
    "currencyCode": "CNY",
    "sourceAmount": "100.05",
    "returnUrl": "https://example.com",
    "notifyUrl": "https://example.com/notify",
    "sign": "9D6FDF4880B00B002B1F2AB61AE9A721",
    "ipAddress": "116.235.134.86",
    "version": "V3.0.0",
    "userId": "111",
    "email": "example@gmail.com"
}'

Responses

🟢200Success
application/json
Body
code
string 
required
If the value is 0000, it will return success, other please refer to Error Code
message
string 
required
Interface returns description
data
object 
optional
Request response data
tradeNo
string 
required
The flow number generated after each order payment (unique marker)
payCode
string 
required
Payment status code(Where: 1 means payment failure, 0 means payment success, 2 means pending)
payUrl
string 
required
If the paycode is 2, redirect to this address
merOrderNo
string 
required
Corresponds to the [OrderNo] parameter of the order submission parameter
Examples
{
    "code": "00000",
    "message": "SUCCESS",
    "data": {
        "payCode": 0,
        "tradeNo": "333333",
        "merOrderNo": "222222",
        "payUrl": "http://abc.com/notify"
    }
}
Modified at 2023-04-28 03:25:25
Previous
Alipay
Next
WeChat
Built with