Skip to content

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:

ParameterTypelimitRequiredDescription
mchNostring32trueMerchant number
appIdstring32trueApplication ID
mchOrderNostring32trueMerchant order number
amountLong20truePayment amount (unit: cents, minimum value 1000)
subjectstring256falseProduct name
bodystring512falseProduct description
notifyUrlstring256truePayment result callback address
successUrlstring256truePayment successful jump page
failUrlString256truePayment failure jump page
cancelUrlstring256truePayment cancellation jump page
expiredTimeInt11truePayment validity period (seconds)
userNamestring256trueUser name
userEmailstring256trueUser email
userPhonestring32trueUser mobile phone number
userAddressstring256falseUser address
signstring256truesign
reqTimeInt11trueRequest 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:

ParameterTypeDescription
codeIntCall result: 0 indicates success, other values ​​indicate failure
dataObjectContains specific data information
msgstringResult description
signstringSignature, used to verify the integrity and authenticity of data

data object field:

ParameterTypeDescription
codeImgUrlstringPayment address (QR code image URL)
mchOrderNostringMerchant order number
orderStateIntPayment status: 0-Order generated, 1-Payment in progress, 2-Payment successful, 3-Payment failed, 4-Cancelled, 5-Refunded, 6-Order closed
payOrderIdstringMerchant 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.