Appearance
1、Repayment
1.1、Repayment interface
URL: https://${domain}/api/pay/order
Please replace ${domain} with your actual service domain name.
Type:POST
Content-Type:application/json
Description: This API is used to initiate a payment request, including parameters such as merchant information, order details, user information, and callback address.
Body-parameters:
Parameter | Type | limit | Required | Description |
---|---|---|---|---|
mchNo | string | 32 | true | Merchant number |
appId | string | 32 | true | Application ID |
mchOrderNo | string | 32 | true | Merchant order number |
amount | Long | 20 | true | Payment amount (unit: cents, minimum value 1000) |
subject | string | 256 | false | Product name |
body | string | 512 | false | Product description |
notifyUrl | string | 256 | true | Payment result callback address |
successUrl | string | 256 | true | Payment successful jump page |
failUrl | String | 256 | true | Payment failure jump page |
cancelUrl | string | 256 | true | Payment cancellation jump page |
expiredTime | Int | 11 | true | Payment validity period (seconds) |
userName | string | 256 | true | User name |
userEmail | string | 256 | true | User email |
userPhone | string | 32 | true | User mobile phone number |
userAddress | string | 256 | false | User address |
sign | string | 256 | true | sign |
reqTime | Int | 11 | true | Request timestamp (seconds) |
Request-example:
js
{
"mchNo": "M1735112701",
"appId": "676bb7fefb715596544e2210",
"mchOrderNo": "PAYIN_TEST_0003",
"amount": 1000,
"subject": "test", // Product name
"body": "test", // Product description
"notifyUrl": "http://domain.com/notify",
"successUrl": "http://domain.com",
"failUrl": "http://domain.com",
"cancelUrl": "http://domain.com",
"expiredTime": 600, // Payment validity period (seconds)
"userName": "test",
"userEmail": "test@gmail.com",
"userPhone": "0123456789",
"userAddress": "test", // User address
"sign": "81091A7D02A78F97E44645C60170D1E6",
"reqTime": 1739413509 // Request timestamp (seconds)
}
TIP
• All string type fields need to ensure that they do not exceed the specified maximum length.
•The amount field represents the payment amount, the unit is "cent", and the minimum value is 1000 (i.e. 10 yuan).
•The sign field needs to be generated according to a specific signature algorithm to ensure data security and integrity.
•Use HTTPS protocol to send requests to ensure the security of data transmission.
This document can help developers understand and correctly use the API interface to send payment requests. If there are more details or special circumstances that need to be explained, please provide further relevant information.
1.2、Payment result
response format:Content-Type:application/json
Description: This API response is used to notify the result of the payment request, including payment status, order information, signature and other parameters.
Response-fields:
Parameter | Type | Description |
---|---|---|
code | Int | Call result: 0 indicates success, other values indicate failure |
data | Object | Contains specific data information |
msg | string | Result description |
sign | string | Signature, used to verify the integrity and authenticity of data |
data object field:
Parameter | Type | Description |
---|---|---|
codeImgUrl | string | Payment address (QR code image URL) |
mchOrderNo | string | Merchant order number |
orderState | Int | Payment status: 0-Order generated, 1-Payment in progress, 2-Payment successful, 3-Payment failed, 4-Cancelled, 5-Refunded, 6-Order closed |
payOrderId | string | Merchant order number |
Response-example:
js
{
"code": 0, // Call result: 0 Success, other values indicate failure
"data": {
"codeImgUrl": "https://www.moneyspace.net/gbprimepay/qr?transactionId=MSTRF180000003838890", // Payment URL
"mchOrderNo": "PAYIN_TEST_0003",
"orderState": 1, // Payment status: 0-Order generated, 1-Payment in progress, 2-Payment successful, 3-Payment failed, 4-Cancelled, 5-Refunded, 6-Order closed
"payOrderId": "P1889871204554084354" // Merchant order ID
},
"msg": "SUCCESS", // Result description
"sign": "5C74AEE2C069A66690501E6AB8FD0B9C" // Signature
}
Field details
Field details
•code:
•type: Int
•describe: Status code indicating the result of the call.
0 indicates success, other values indicate different error codes.
•data:
•type: Object
•describe: Contains specific business data.
•codeImgUrl: The URL of the payment QR code. Users can complete payment by scanning the QR code.
•mchOrderNo: Merchant-defined order number.
•orderState: The payment status of the current order. The specific status values are as shown in the table above.
•payOrderId: The unique order number generated by the payment system.
•msg:
•type: String
•describe: A text description of the result, usually "SUCCESS" on success, and specific error information on failure.
•sign:
•type: String
•describe: A signature of the data used to verify the authenticity and integrity of the response. The receiver needs to perform signature verification on the returned data based on the same signature algorithm.
Payment results
•After receiving the response, be sure to validate the sign field to ensure the data has not been tampered with.
•Determine the payment status of the current order based on the value of orderState, and take corresponding business logic processing.
•Use HTTPS protocol to ensure the security of data transmission.
This document can help developers understand and correctly handle API interface responses. If there are more details or special circumstances that need to be explained, please provide further relevant information.