Common API
About 957 wordsAbout 3 min
1. Account Inquiry
Brief Description:
- Query the balance of the account corresponding to the current business.
URL:
The currency is a path parameter, which should be replaced by the currency you want to query, for example, for USD: /usd/account/ledger
.
Currencies use the international standard code, three-letter uppercase code, refer to: Wikipedia-ISO_4217
/{currency}/account/ledger
Parameters:
Parameter | Required | Type | Description |
---|---|---|---|
appId | Yes | Long | Business ID (obtained from the backend, must pass the corresponding business ID based on the currency in the URL) |
sign | Yes | String | Signature |
Response Data:
Parameter | Type | Description |
---|---|---|
bal | String | Account balance |
availableBal | String | Available amount |
frzBal | String | Frozen amount |
unSettleBal | String | Amount awaiting settlement |
sign | String | Signature |
2. Asynchronous Notification
Brief Description:
- When the customer’s collection is successful or failed, we will push the order status. If the first notification fails, it will retry every 5 minutes, up to 5 times.
URL: Your provided URL
, Please configure it in HaiPay's backend or pass it in the request parameters.
Strongly Recommended
To ensure the extensibility and compatibility of the interface, please follow the parameter reception method outlined below:
- Do not declare a specific POJO object to receive callback parameters.
- Must use a generic data structure (like JSONObject, Map, etc.) to parse parameters.
- This design ensures that if we later extend the callback fields, it will not affect your signature verification logic.
Reason: Keeping a loosely coupled design can prevent signature verification failures due to the addition or removal of fields.
Collection Callback Parameters:
Parameter | Type | Description |
---|---|---|
appId | Long | Business ID |
currency | String | Currency |
orderId | String | Merchant order ID |
orderNo | String | Platform order ID |
amount | String | Amount collected this time |
fee | String | Fee amount |
status | Integer | Status (2: Success, 3: Failure, 4: Partial Collection, 5: Excess Collection). Status 4 and 5 only exist for Cryptocurrency |
payTime | String | Payment success time (when status=2, 4, 5) (Local time), format: yyyy-MM-dd HH:mm:ss |
errorMsg | String | Payment failure reason (when status=3) |
originalCurrency | String | Original order currency, may be empty, only present when currency conversion is involved |
originalAmount | String | Original order amount, may be empty, only present when currency conversion is involved |
inBankCode | String | Payment method used by the user, refer to each region’s documentation, may be empty |
bankNo | String | Receiving account, may be empty |
description | String | Payment note, may be empty |
sign | String | Signature, |
Payout Callback Parameters:
Parameter | Type | Description |
---|---|---|
appId | Long | Business ID |
currency | String | Currency |
orderId | String | Merchant order ID |
orderNo | String | Platform order ID |
amount | String | Amount collected this time |
fee | String | Fee amount |
status | Integer | Status (2: Success, 3: Failure) |
payTime | String | Payment success time (when status=2), format: yyyy-MM-dd HH:mm:ss |
errorMsg | String | Payment failure reason (when status=3) |
hash | String | Transaction hash (present when using cryptocurrency, e.g., USDT) |
sign | String | Signature, |
Collection Link Order Callback Parameters:
Parameter | Type | Description |
---|---|---|
appId | Long | Business ID |
currency | String | Currency |
orderId | String | Merchant order ID |
orderNo | String | Platform order ID |
amount | String | Amount collected this time |
fee | String | Fee amount |
status | Integer | Status (2: Success, 3: Failure, 4: Partial Collection, 5: Excess Collection) |
payTime | String | Payment success time (when status=2, 4, 5), format: yyyy-MM-dd HH:mm:ss |
errorMsg | String | Payment failure reason (when status=3) |
originalCurrency | String | Original order currency, may be empty, only present when currency conversion is involved |
originalAmount | String | Original order amount, may be empty, only present when currency conversion is involved |
inBankCode | String | Payment method used by the user, refer to each region’s documentation, may be empty |
bankNo | String | Receiving account, may be empty |
description | String | Payment note, may be empty |
createTime | String | Order creation time (Local time), format: yyyy-MM-dd HH:mm:ss |
linkNo | String | Collection link number |
linkName | String | Collection link name |
agentId | Long | Agent ID (empty if there’s no agent) |
String | Payer's email (from the collection link page, random email if not filled) | |
name | String | Payer's nickname (from the collection link page) |
subject | String | Note (filled in the collection link page, randomly generated if not filled) |
sign | String | Signature, |
Note:
After receiving the callback notification, please return SUCCESS (in uppercase) in the response body without surrounding quotation marks. Otherwise, the notification will continue for 5 more times.
3. Statement File Link Retrieval
Description:
- The file format is the same as the one exported from the merchant backend. The data for the day will be generated the next day after 1:00 PM.
URL:
/common/document/download
Parameters:
Parameter | Required | Type | Description |
---|---|---|---|
appId | Yes | Long | Business ID (obtained from the backend) |
type | Yes | Long | Type: 15 for payout orders, 20 for collection orders, 40 for fund flow data |
date | Yes | String | Date, format: yyyyMMdd |
sign | Yes | String | Signature |
Response Data:
Parameter | Type | Description |
---|---|---|
appId | Long | Business ID (obtained from the backend) |
type | Long | Type: 15 for payout orders, 20 for collection orders, 40 for fund flow data |
date | String | Date, format: yyyyMMdd |
fileUrl | String | File download URL |
expired | String | Expiry time, 1 hour |
sign | String | Signature |
4. Payout Order Voucher
URL:
/common/voucher
Parameters:
Parameter | Required | Type | Description |
---|---|---|---|
appId | Yes | Long | Business ID (obtained from the backend) |
orderNo | Yes | Long | Platform order ID |
sign | Yes | String | Signature |
Response Data:
- The base64 encoded image of the voucher.