### RSA Response Body Example (ChainUp Platform) Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk_v2 Provides an example of the response body structure returned by the ChainUp platform when using RSA encryption. It includes fields for status code, message, encrypted data, and signature. ```json { "code": "0", "msg": "succ", "data": "xxxxxxxxxxx", "sign": "xxxxxxxxxxx" } ``` -------------------------------- ### Signature Generation Example (Conceptual) Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk Illustrates the process of generating a signature by sorting request parameters, concatenating them with their values, and then applying an MD5 hash with a secret key. It highlights how null values are excluded from the signature string. ```plaintext // Input Parameters: { 'symbol': 'ltcbtc', 'appKey': '0816016bb06417f50327e2b557d39aaa', 'sign': 'a169740d0588141ef70b71cf11ff8bf3', 'time': '1522055680' } // Signature Algorithm: string = appKey0816016bb06417f50327e2b557d39aaasymbolltcbtctime1522055680 secretKey = xxxxxxxxxxxxxxxxx sign = MD5(string+secretKey) = MD5(appKey0816016bb06417f50327e2b557d39aaasymbolltcbtctime1522055680xxxxxxxxxxxxxxxxx) sign = 82d38bae5fc727feea4f7a96c7db0492 ``` -------------------------------- ### AK/SK Request Parameters Example (ChainUp Platform) Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk_v2 Demonstrates the initial structure of request parameters using the Access Key (AK) and Secret Key (SK) method before RSA encryption is applied on the ChainUp platform. This serves as a basis for understanding the transformation to RSA parameters. ```json { "appKey": "xxxx", "countryCode": "+86", "mobileNumber": "34334342", "password": "1234qwer", "sign": "xxxxxxxxxxxxxxxxxxxx" } ``` -------------------------------- ### RSA Request Parameters Example (ChainUp Platform) Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk_v2 Illustrates the structure of request parameters when using the RSA encryption method for the ChainUp platform. It shows the transformation from AK/SK parameters to RSA-encrypted parameters, excluding 'appKey' and 'sign' from encryption. ```json { "app_id": "xxxx", "time": 1715310032, "data": "xxxxxxxxxxx", "sign": "xxxxxxxxxxx" } ``` -------------------------------- ### GET /platform/login.html Source: https://platformdocs.chainup.com/en/api-reference/oauth/oauth_login Initiates the platform login process by redirecting the user to a login page. Requires an appKey and a redirectUrl for successful authorization. ```APIDOC ## GET /platform/login.html ### Description Initiates the platform login process. Users are redirected to a login page, and upon successful authorization, they are directed to the specified `redirectUrl`. This endpoint requires merchant-specific `appKey` and a valid `redirectUrl`. ### Method GET ### Endpoint /platform/login.html ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey. `Example: xxx_xxx` - **redirectUrl** (string) - Required - Jump to page after successful authorization login. `Example: The page to redirect to after successful authorization login should be consistent with the merchant's backend.` ### Request Example ```bash curl --request GET \ --url http://service.xxx.com/platform/login.html?appKey=xxx_xxx&redirectUrl=https://merchant.com/callback ``` ### Response #### Success Response (200) - **appKey** (string) - Merchant appKey. - **redirectUrl** (string) - Jump to page after successful authorization login. #### Response Example ```json { "appKey": "xxx_xxx", "redirectUrl": "https://merchant.com/callback" } ``` ``` -------------------------------- ### GET /platform/pay.html Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_paymentPage Retrieves payment information or initiates the payment flow for a specific order. ```APIDOC ## GET /platform/pay.html ### Description This endpoint is used to initiate the payment process for a platform order. It requires authentication via appKey and token, alongside specific user and order identifiers. ### Method GET ### Endpoint http://service.xxx.com/platform/pay.html ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey. Example: xxx_xxx - **orderNum** (string) - Required - Platform number payer openId, must be the order creator. Example: 1000000009 - **openId** (string) - Optional - Payer's openId, must be the order creator. Example: 2ae04ed9165624419bad68e9e0f3f29fbd - **userId** (string) - Optional - Payment user uid (one must exist with openid). Example: 2023203 - **token** (string) - Optional - Authorized token. Example: 2ae04ed9165624419bad68e9e0f3f29fbd ### Request Example curl --request GET \ --url "http://service.xxx.com/platform/pay.html?appKey=xxx_xxx&orderNum=1000000009" ### Response #### Success Response (200) - **data** (any[]) - The response returns an array of payment-related data. #### Response Example [] ``` -------------------------------- ### Java RSA Encryption/Decryption Demo (ChainUp Platform) Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk_v2 A placeholder for a Java code example demonstrating the encryption and decryption process using RSA as implemented on the ChainUp platform. This would typically involve using cryptographic libraries to handle key management and data transformation. ```java // Java encryption and decryption demo // Other development languages can refer to implementation ``` -------------------------------- ### GET /platform/pay.html Request (cURL) Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_paymentPage This snippet demonstrates how to make a GET request to the /platform/pay.html endpoint using cURL. It requires essential query parameters like appKey and orderNum to initiate a payment order. The response is expected in JSON format. ```cURL curl --request GET \ --url http://service.xxx.com/platform/pay.html ``` -------------------------------- ### GET Payment Page Access Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk Accesses the payment page by assembling URL parameters. This is useful for direct GET requests or for understanding the parameters needed. ```APIDOC ## GET Payment Page Access ### Description Accesses the payment page by assembling URL parameters. This method allows engineers familiar with GET requests to directly construct the payment URL. ### Method GET ### Endpoint `https://service.xxx.com/pay.html` ### Parameters #### Query Parameters - **appKey** (string) - Required - The application key. - **openId** (string) - Optional - The open ID of the user. - **token** (string) - Required - The authentication token. - **orderNum** (string) - Required - The unique order number. ### Request Example ``` https://service.xxx.com/pay.html?appKey=your_app_key&openId=user_open_id&token=user_token&orderNum=ORDER12345 ``` ### Response This endpoint redirects the user to a payment page. The actual response is the rendering of the payment interface. ``` -------------------------------- ### Get Login Page (cURL) Source: https://platformdocs.chainup.com/en/api-reference/oauth/oauth_login This snippet demonstrates how to retrieve the login page using cURL. It requires the merchant's appKey and a redirectUrl for post-login redirection. The response is a JSON object containing the appKey and redirectUrl. ```curl curl --request GET \ --url http://service.xxx.com/platform/login.html ``` -------------------------------- ### Get Order Details using cURL Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_getReferenceOrder This snippet demonstrates how to retrieve order details from the ChainUp Open API using a cURL POST request. It requires the service URL and provides a sample request body structure. ```cURL curl --request POST \ --url http://service.xxx.com/platformapi/chainup/open/opay/orderDetail ``` -------------------------------- ### POST /platformapi/chainup/open/ Source: https://platformdocs.chainup.com/en This endpoint serves as the primary entry point for the ChainUp Open Platform. Replace 'service.xxx.com' with your specific domain name to access the service. ```APIDOC ## POST /platformapi/chainup/open/ ### Description Access the ChainUp open platform services. Ensure the domain is correctly configured for your merchant account. ### Method POST ### Endpoint https://{domain}/platformapi/chainup/open/ ### Parameters #### Request Body - **appKey** (string) - Required - The unique identifier for your merchant application. - **sign** (string) - Required - The request signature generated based on the SDK version (v1: ak/sk, v2: RSA). ### Request Example { "appKey": "your_app_key", "data": "..." } ### Response #### Success Response (200) - **code** (int) - Status code (0 for success). - **msg** (string) - Response message. #### Response Example { "code": 0, "msg": "success" } ``` -------------------------------- ### POST /platformapi/chainup/open/ Source: https://platformdocs.chainup.com/en/api-reference/guides/guides Opens platform access to a specified domain name. This endpoint is used to grant access to the platform via a given domain. ```APIDOC ## POST /platformapi/chainup/open/ ### Description Opens platform access to a specified domain name. This endpoint is used to grant access to the platform via a given domain. ### Method POST ### Endpoint `https://service.xxx.com/platformapi/chainup/open/` ### Parameters #### Query Parameters - **domain** (string) - Required - The domain name to open platform access for. ### Request Example ```json { "domain": "your.domain.com" } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating that platform access has been opened. #### Response Example ```json { "message": "Platform access opened successfully for your.domain.com" } ``` ``` -------------------------------- ### POST /platformapi/chainup/open/ Source: https://platformdocs.chainup.com/ Opens platform access to a specified domain name. This endpoint is used to grant access to the platform via a domain. ```APIDOC ## POST /platformapi/chainup/open/ ### Description Opens platform access to a specified domain name. This endpoint is used to grant access to the platform via a domain. ### Method POST ### Endpoint `https://service.xxx.com/platformapi/chainup/open/` ### Parameters #### Query Parameters - **domain** (string) - Required - The domain name to open platform access for. ### Request Example ```json { "domain": "your-domain.com" } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating that platform access has been opened. #### Response Example ```json { "message": "Platform access opened successfully for your-domain.com" } ``` ``` -------------------------------- ### Interface Call Mode (RSA) Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk_v2 Explains how to call interfaces using the RSA encryption method, detailing the request and response structures and the parameter encryption process. ```APIDOC ## Interface Call Mode (RSA) ### Description This section details the unified explanation for calling interfaces using the RSA method, contrasting it with AK/SK authentication. It provides examples for creating orders and registering/logging in users. ### Request Structure (RSA) When using RSA encryption, the request parameters are structured as follows. Note that `app_id` and `sign` do not participate in the encryption process. Other parameters are encrypted to form the `data` field. ```json { "app_id": "xxxx", "time": 1715310032, "data": "xxxxxxxxxxx", "sign": "xxxxxxxxxxx" } ``` **Parameter Description**: * `app_id`: Equivalent to the `appKey` parameter in AK/SK mode. * `time`: Millisecond timestamp of the request time. * `data`: The encrypted request parameters. * `sign`: The signature of the request. ### Response Structure (RSA) The response body follows this structure: ```json { "code": "0", "msg": "succ", "data": "xxxxxxxxxxx", "sign": "xxxxxxxxxxx" } ``` **Response Specification**: * `code`: Status code. * `msg`: Status code description. * `data`: The specific response content, which needs to be decrypted using the provided algorithm. The signature of the `data` field is generated using the developer's public key and the application's private key, and must be verified. * `sign`: The signature of the response. ``` -------------------------------- ### POST /platformapi/chainup/open/auth/token Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk Exchange an authorization code for an access token and openId. ```APIDOC ## POST /platformapi/chainup/open/auth/token ### Description Exchanges the authorization code obtained via the OAuth2.0 flow for an access token and openId to access platform resources. ### Method POST ### Endpoint `http://service.xxx.com/platformapi/chainup/open/auth/token` ### Request Body - **appKey** (string) - Required - The unique identifier for the application. - **code** (string) - Required - The authorization code received after user login. - **sign** (string) - Required - The MD5 signature generated using the signature algorithm. ### Request Example { "appKey": "your_app_key", "code": "auth_code_from_redirect", "sign": "calculated_md5_signature" } ### Response #### Success Response (200) - **token** (string) - The access token for API requests. - **openId** (string) - The unique identifier for the authorized user. #### Response Example { "token": "eyJhbGciOiJIUzI1Ni...", "openId": "user_12345" } ``` -------------------------------- ### POST /platformapi/chainup/open/opay/createThirdOrder Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk Creates a payment order on the ChainUp open platform. Note: openId and userId can only exist one; if both exist, openId is preferred. ```APIDOC ## POST /platformapi/chainup/open/opay/createThirdOrder ### Description Creates a payment order on the ChainUp open platform. It supports using either `openId` or `userId`, with `openId` taking precedence if both are provided. ### Method POST ### Endpoint `http://service.xfnh.fnhcom/platformapi/chainup/open/opay/createThirdOrder` ### Parameters #### Request Body - **appKey** (string) - Required - The application key for authentication. - **openId** (string) - Optional - The open ID of the user. - **userId** (string) - Optional - The user ID. - **orderNum** (string) - Required - The unique order number. - **amount** (string) - Required - The payment amount. - **currency** (string) - Required - The currency of the payment. - **description** (string) - Optional - A description for the order. - **redirectUrl** (string) - Required - The URL to redirect to after payment completion. ### Request Example ```json { "appKey": "your_app_key", "openId": "user_open_id", "orderNum": "ORDER12345", "amount": "100.50", "currency": "USD", "redirectUrl": "https://yourdomain.com/callback" } ``` ### Response #### Success Response (200) - **code** (string) - Response code. - **msg** (string) - Response message. - **data** (object) - Order details. - **orderId** (string) - The unique ID of the created order. - **payUrl** (string) - The URL to the payment page. #### Response Example ```json { "code": "0", "msg": "Success", "data": { "orderId": "CHAINUPORDER67890", "payUrl": "http://service.xfnh.com/pay.html?appKey=xxx&openId=xxx&token=xxx&orderNum=xxx" } } ``` ``` -------------------------------- ### RSA Signature Algorithm and Key Management Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk_v2 Details on using RSA encryption for securing API requests and responses, including the roles of public and private keys and account preparation. ```APIDOC ## RSA Signature Algorithm and Key Management ### Description This section explains the role of RSA encryption in securing data transmission between Party A (third-party caller) and Party B (ChainUp service provider). It covers key generation, management, and the process of encrypting and verifying data. ### Key Roles * **Party A**: Third-party business caller. * **Party B**: Service provider of ChainUp. ### Public-Private Key Pair Usage Party A generates a public-private key pair. The public key (rsa_third_pub) is shared with Party B, while the private key is kept confidential by Party A. When Party A requests a service, Party B encrypts parameters using its public key, and Party A signs the original MD5 data with its private key. Upon receiving the request, Party B decrypts the data using its private key and verifies the signature using Party A's public key. ### Account Preparation Developers need to perform the following steps: 1. Generate an RSA public-private key pair. Submit the public key to the platform when creating an application. 2. Provide the third-party application server IP (optional). Developers must securely store: 1. The private key corresponding to the submitted public key (rsa_third_pri). 2. The unique identifier of the created application (app_id). 3. The platform's public key for the application (rsa_saas_pub). ### RSA Key Generation * **Cipher Length**: 2048 * **Key Format**: PKCS#8 * **Generation Tool**: RSA Tool Website (optional) ### Interface Rules * **Transmission Method**: HTTPS * **Signature Fields**: All required fields except the `sign` field must be included in the signature calculation. * **Response Status Code**: `0` indicates success; non-zero values indicate errors. * **Request Address**: Domain name + interface address. * **Encryption Algorithm**: Refer to Java encryption and decryption demos or equivalent implementations in other languages. ``` -------------------------------- ### POST /platformapi/chainup/open/opay/orderDetail Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk Checks the status of a payment order on the ChainUp open platform. ```APIDOC ## POST /platformapi/chainup/open/opay/orderDetail ### Description Retrieves the details and status of a specific payment order. ### Method POST ### Endpoint `http://service.xfnh.com/platformapi/chainup/open/opay/orderDetail` ### Parameters #### Request Body - **appKey** (string) - Required - The application key for authentication. - **orderNum** (string) - Required - The unique order number to query. ### Request Example ```json { "appKey": "your_app_key", "orderNum": "ORDER12345" } ``` ### Response #### Success Response (200) - **code** (string) - Response code. - **msg** (string) - Response message. - **data** (object) - Order details. - **orderId** (string) - The unique ID of the order. - **orderStatus** (string) - The current status of the order (e.g., 'PAID', 'PENDING', 'FAILED'). - **amount** (string) - The payment amount. - **currency** (string) - The currency of the payment. #### Response Example ```json { "code": "0", "msg": "Success", "data": { "orderId": "CHAINUPORDER67890", "orderStatus": "PAID", "amount": "100.50", "currency": "USD" } } ``` ``` -------------------------------- ### POST /platformapi/chainup/open/opay/orderDetail Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_getReferenceOrder Retrieves detailed information about a specific order using the order number and merchant app key. ```APIDOC ## POST /platformapi/chainup/open/opay/orderDetail ### Description This endpoint retrieves detailed information about a specific order. It requires the merchant's AppKey and the order number to fetch the relevant order details. ### Method POST ### Endpoint `/platformapi/chainup/open/opay/orderDetail` ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey `Example: xxx_xxx` - **orderNum** (string) - Required - Open platform order number. `Example: 1000000002` - **token** (string) - Optional - Authorized token. `Example: 2ae04ed9165624419bad68e9e0f3f29fbd` ### Request Example ```json { "example": "(No request body specified in the provided documentation)" } ``` ### Response #### Success Response (200) - **code** (string) - Return code. Example: 0 - **msg** (string) - Success or failure message. Example: Success - **data** (object) - Contains order-specific details. - **totalAccount** (object) - List of all accounts supported by the merchant. - **accountName** (string) - Account name. Example: name - **accountType** (number) - Account type. Example: 202001 - **accountBalance** (number) - Balance of the account. Example: 1000.21 - **googleStatus** (number) - Whether Google verification is enabled (0 - Disabled, 1 - Enabled). Example: 1 - **appOrderId** (string) - Merchant order ID. Example: 100000009 - **sign** (string) - Signature. Example: 2ae04ed9165624419bad68e9e0f3f29fbdqws2ae04ed9165624419bad68e9e0f3f29fbd - **orderNum** (string) - Order number. Example: 12321 - **orderStatus** (string) - Order status (1 - Pending payment; 2 - Payment failed; 3 - Payment successful; 0 - Closed). Example: 1 - **userId** (number) - User ID. Example: 230000 - **isOpenMobileCheck** (number) - Whether mobile SMS verification is enabled (0 - Disabled, 1 - Enabled). Example: 1 - **orderAmount** (number) - Order amount. Example: 20001.21 - **payCoinSymbol** (string) - Payment currency. Example: btc - **ctime** (string) - Creation time. Example: 20000000 - **appKey** (string) - App Key. Example: xxx_xxx - **showPrecision** (string) - Display precision. Example: 8 #### Response Example ```json { "code": 0, "msg": "Success", "data": { "totalAccount": [ { "accountName": "name", "accountType": 202001, "accountBalance": 1000.21 }, { "accountName": "name", "accountType": 203001, "accountBalance": 1000.21 } ], "googleStatus": 1, "appOrderId": "100000009", "sign": "2ae04ed9165624419bad68e9e0f3f29fbdqws2ae04ed9165624419bad68e9e0f3f29fbd", "orderNum": "12321", "orderStatus": "1", "userId": 230000, "isOpenMobileCheck": "1", "orderAmount": "20001.21", "payCoinSymbol": "btc", "ctime": "20000000", "appKey": "xxx_xxx", "showPrecision": "8" } } ``` ``` -------------------------------- ### Signature Algorithm Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk Explains the security mechanism for API requests. All requests must be signed using a dictionary-sorted parameter string concatenated with a secret key. ```APIDOC ## Signature Algorithm ### Description Requests are validated at the gateway layer. The signature is generated by sorting parameters alphabetically by key, concatenating them as 'keyvalue', appending the secret key, and hashing with MD5. ### Algorithm 1. Sort request parameters by key (dictionary order). 2. Concatenate into a string: `key1value1key2value2...` 3. Ignore parameters where the value is NULL. 4. Final signature: `sign = MD5(sortedParamString + secretKey)` ### Example - **Input**: `{'symbol': 'ltcbtc', 'appKey': '0816016bb06417f50327e2b557d39aaa', 'time': '1522055680'}` - **Sorted String**: `appKey0816016bb06417f50327e2b557d39aaasymbolltcbtctime1522055680` - **Sign**: `MD5(string + secretKey)` ``` -------------------------------- ### Send Notification via POST Request (cURL) Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_notifyPage This snippet demonstrates how to send a POST request to the /notifyPage endpoint using cURL. It requires specifying the service URL and includes query parameters for order details and notification settings. The response indicates the status of the notification request. ```cURL curl --request POST \ --url http://service.xxx.com/notifyPage ``` -------------------------------- ### POST /notifyPage Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_notifyPage This endpoint is used to send notifications regarding page updates or order status changes. It requires several query parameters to identify the order and transaction details. ```APIDOC ## POST /notifyPage ### Description This endpoint is used to send notifications regarding page updates or order status changes. It requires several query parameters to identify the order and transaction details. ### Method POST ### Endpoint /notifyPage ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey. `Example: xxx_xxx` - **outOrderId** (string) - Required - Merchant side order number. `Example: 1000000009` - **orderNum** (string) - Required - Open platform order number. `Example: 1000000002` - **orderStatus** (string) - Required - Order status (1 Pending payment; 2 Payment failed; 3 Payment successful; 0 Closed). `Example: 1` - **payAmount** (string) - Required - Order amount. `Example: 200` - **returnUrl** (string) - Required - Synchronized notification page (order placement interface incoming). `Example: https://www.google.com` ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **code** (string) - Return code - **msg** (string) - Success or failure message - **data** (string) - The client receives the request and returns success, which means the request has been received. - **sign** (string) - Signature. Example: 2ae04ed9165624419bad68e9e0f3f2sa9fbd2ae04ed916511624419bad68e9e20f3f29fbd #### Response Example ```json { "code": "", "msg": "", "sign":"2ae04ed9165624419bad68e9e0f3f2sa9fbd2ae04ed916511624419bad68e9e20f3f29fbd" } ``` ``` -------------------------------- ### Retrieve Order Detail via cURL Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_orderDetail Fetches detailed information for a specific order using the order number and merchant credentials. The request requires an appKey, orderNum, and authorization token. ```cURL curl --request POST \ --url http://service.xxx.com/platformapi/chainup/open/opay/orderDetail ``` -------------------------------- ### POST /platformapi/chainup/open/auth/token Source: https://platformdocs.chainup.com/en/api-reference/oauth/oauth_token Obtain an authentication token for accessing ChainUp open API services. This endpoint requires merchant app key, a code obtained from user authentication, and a signature. ```APIDOC ## POST /platformapi/chainup/open/auth/token ### Description Obtain an authentication token for accessing ChainUp open API services. This endpoint requires merchant app key, a code obtained from user authentication, and a signature. ### Method POST ### Endpoint /platformapi/chainup/open/auth/token ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey - **code** (string) - Required - The returned code when calling the first step of login for user authentication. - **sign** (string) - Required - Signature ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **code** (string) - Return code - **msg** (string) - Success or failure message - **data** (object) - Show child attributes - **data.openId** (string) - The unique openId of the merchant to which the authorized user belongs - **data.expireIn** (string) - Token expiration time, seconds - **data.refreshToken** (string) - The token required to refresh the token - **data.token** (string) - Authorized token #### Response Example ```json { "code": "", "msg": "", "data": { "openId":"4dbca5afca8a46f48d863d18bsdd644731", "expireIn":"", "refreshToken":"4dbca5afca8a46f48d863d18bsdd644731", "token":"2ae04ed9165624419bad68e9e0f3f29fbd" } } ``` ``` -------------------------------- ### Postman Script for Signature Generation Source: https://platformdocs.chainup.com/en/api-reference/guides/sdk A Postman pre-request script to automatically generate MD5 signatures for API requests. It parses request data, sorts parameters, concatenates them with a secret key, and calculates the MD5 hash, setting it as an environment variable named 'sign'. ```javascript //提前定义变量 var domain = "service.xxx.com" var secret = "xxx"; pm.environment.set("domain", domain) var requestStr = request.data; var obj = JSON.parse(requestStr); keys = Object.keys(obj) console.log(obj); //拼接待签名字符串 var str = [] for (var p = 0; p < keys.length; p++) { if(keys[p] == "sign" ||request.data[keys[p]] === ""){ // "==" ==宽松相等,隐性类型转换,值相等,返回true; "===" 严格相等,值和类型都相等,返回true continue; } // console.log(keys[p] + obj[keys[p]]); str.push(keys[p] + obj[keys[p]]); } pm.environment.set("str", str) str.sort() str.push(secret) var s = str.join("") console.log("准备签名"); console.log(s); //MD5加密签名规格,并赋值给环境变量`sign` var sign = CryptoJS.MD5(CryptoJS.enc.Latin1.parse(s)).toString(); pm.environment.set("sign", sign); ``` -------------------------------- ### POST /platformapi/chainup/open/opay/merchantBillingDay Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_merchantBillingDay Retrieves a list of merchant billing records for a specific day, including order details such as amounts, currency, and timestamps. ```APIDOC ## POST /platformapi/chainup/open/opay/merchantBillingDay ### Description Retrieves the billing records for a merchant for a specified day. Supports pagination and filtering by order type. ### Method POST ### Endpoint http://service.xxx.com/platformapi/chainup/open/opay/merchantBillingDay ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey (e.g., xxx_xxx) - **orderType** (string) - Required - Order type (1=payment order; 11=transfer order) - **day** (string) - Required - Statistics date in yyyy-MM-dd format - **pageNum** (string) - Required - Page number for pagination - **pageSize** (string) - Required - Number of records per page (max 2000) - **sign** (string) - Required - Authorized signature ### Request Example ```json { "appKey": "xxx_xxx", "orderType": "1", "day": "2099-01-01", "pageNum": "1", "pageSize": "200", "sign": "signature_string" } ``` ### Response #### Success Response (200) - **code** (string) - Return code - **msg** (string) - Success or failure message - **data.count** (integer) - Total number of records for the day - **data.list** (object[]) - List of billing records - **merchantUserId** (integer) - Merchant's receiving user ID - **appOrderId** (string) - Merchant's order ID - **payCoinSymbol** (string) - Payment currency - **orderAmount** (integer) - Order amount - **orderType** (integer) - Order type (1=payment, 11=transfer) - **userId** (integer) - Payer's user ID - **openId** (string) - Payer's OpenID - **createTime** (string) - Creation time in milliseconds - **payTime** (string) - Payment completion time in milliseconds #### Response Example ```json { "code": "", "msg": "", "data": { "count": 1000, "list": [ { "merchantUserId": 23000, "appOrderId": "100000019", "payCoinSymbol": "btc", "orderAmount": 10, "orderType": 1, "userId": 230000, "openId": "2ae04ed9165624419bad68e9e0f3f29fbd", "createTime": "11200321123", "payTime": "320012321" } ] } } ``` ``` -------------------------------- ### POST /platformapi/chainup/open/opay/orderDetail Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_orderDetail Retrieves detailed information for a given order. Requires merchant app key and order number for identification. ```APIDOC ## POST /platformapi/chainup/open/opay/orderDetail ### Description Retrieves detailed information for a given order. This endpoint is used to fetch the status, amount, and other relevant details of an order placed through the open platform. ### Method POST ### Endpoint `/platformapi/chainup/open/opay/orderDetail` ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey - **orderNum** (string) - Required - Open platform order number. - **token** (string) - Optional - Authorized token. ### Request Example ```json { "example": "No request body is specified for this endpoint. Parameters are expected as query parameters." } ``` ### Response #### Success Response (200) - **code** (string) - Return code. Example: 0 - **msg** (string) - Success or failure message. Example: Success - **data** (object) - Contains the order details. - **totalAccount** (array) - List of all accounts supported by the merchant. - **accountName** (string) - Account name. Example: name - **accountType** (number) - Account type. Example: 202001 - **accountBalance** (number) - Balance of the account. Example: 1000.21 - **googleStatus** (number) - Whether Google verification is enabled (0 - Disabled, 1 - Enabled). Example: 1 - **appOrderId** (string) - Merchant order ID. Example: 100000009 - **sign** (string) - Signature. Example: 2ae04ed9165624419bad68e9e0f3f29fbdqws2ae04ed9165624419bad68e9e0f3f29fbd - **orderNum** (string) - Order number. Example: 12321 - **orderStatus** (string) - Order status (1 - Pending payment; 2 - Payment failed; 3 - Payment successful; 0 - Closed). Example: 1 - **userId** (number) - User ID. Example: 230000 - **isOpenMobileCheck** (number) - Whether mobile SMS verification is enabled (0 - Disabled, 1 - Enabled). Example: 1 - **orderAmount** (number) - Order amount. Example: 20001.21 - **payCoinSymbol** (string) - Payment currency. Example: btc - **ctime** (string) - Creation time. Example: 20000000 - **appKey** (string) - App Key. Example: xxx_xxx - **showPrecision** (string) - Display precision. Example: 8 #### Response Example ```json { "code": 0, "msg": "Success", "data": { "totalAccount": [ { "accountName": "name", "accountType": 202001, "accountBalance": 1000.21 }, { "accountName": "name", "accountType": 203001, "accountBalance": 1000.21 } ], "googleStatus": 1, "appOrderId": "100000009", "sign": "2ae04ed9165624419bad68e9e0f3f29fbdqws2ae04ed9165624419bad68e9e0f3f29fbd", "orderNum": "12321", "orderStatus": "1", "userId": 230000, "isOpenMobileCheck": "1", "orderAmount": "20001.21", "payCoinSymbol": "btc", "ctime": "20000000", "appKey": "xxx_xxx", "showPrecision": "8" } } ``` ``` -------------------------------- ### Refund Order Request (cURL) Source: https://platformdocs.chainup.com/en/api-reference/pay/coin_refundOrder This snippet demonstrates how to make a POST request to the refundOrder endpoint using cURL. It includes the necessary URL and headers for authentication and request. Ensure all required query parameters are included in the actual request. ```cURL curl --request POST \ --url http://service.xxx.com/platformapi/chainup/open/opay/refundOrder ``` -------------------------------- ### POST /platformapi/chainup/open/auth/refreshToken Source: https://platformdocs.chainup.com/en/api-reference/oauth/oauth_refreshToken Refreshes an existing authentication token using the provided credentials and refresh token. ```APIDOC ## POST /platformapi/chainup/open/auth/refreshToken ### Description This endpoint allows merchants to refresh an expired or expiring access token by providing the original token, refresh token, and user identification. ### Method POST ### Endpoint http://service.xxx.com/platformapi/chainup/open/auth/refreshToken ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey (e.g., xxx_xxx) - **refreshToken** (string) - Required - The "refresh_token" received when obtaining the token. - **token** (string) - Required - The token previously authorized before. - **openId** (string) - Required - The unique openId of the authorized user belonging to the merchant. ### Request Example ```json { "appKey": "xxx_xxx", "refreshToken": "4dbca5afca8a46f48d863d18bsdd644731", "token": "2ae04ed9165624419bad68e9e0f3f29fbd", "openId": "4dbca5afca8a46f48d863d18bsdd644731" } ``` ### Response #### Success Response (200) - **code** (string) - Return code - **msg** (string) - Success or failure message - **data** (object) - Response payload - **data.openId** (string) - The unique openId of the merchant to which the authorized user belongs - **data.expireIn** (string) - Token expiration time, seconds - **data.refreshToken** (string) - The token required to refresh the token - **data.token** (string) - Authorized token #### Response Example ```json { "code": "", "msg": "", "data": { "openId": "4dbca5afca8a46f48d863d18bsdd644731", "expireIn": "", "refreshToken": "4dbca5afca8a46f48d863d18bsdd644731", "token": "2ae04ed9165624419bad68e9e0f3f29fbd" } } ``` ``` -------------------------------- ### POST /platformapi/chainup/open/opay/refundOrder Source: https://platformdocs.chainup.com/en/api-reference/pay/coin_refundOrder Processes a refund request for a specific merchant order. Requires authentication via appKey and signature. ```APIDOC ## POST /platformapi/chainup/open/opay/refundOrder ### Description This endpoint is used to initiate a refund for a previously processed OPay order. ### Method POST ### Endpoint http://service.xxx.com/platformapi/chainup/open/opay/refundOrder ### Parameters #### Query Parameters - **appKey** (string) - Required - Merchant AppKey - **appOrderId** (string) - Required - Merchant-side order id, unique across the board - **openId** (string) - Optional - Unique id of the receiving user - **userId** (string) - Optional - Receiving user uid - **orderAmount** (string) - Required - Order amount - **orderSceneType** (string) - Optional - Scene type of the order - **payCoinSymbol** (string) - Required - Payment currency (e.g., BTC) - **sign** (string) - Required - Signature ### Request Example ```json { "appKey": "xxx_xxx", "appOrderId": "10000001", "orderAmount": "200", "payCoinSymbol": "btc", "sign": "2ae04ed9165624419bad68e9e0f3f2sa9fbd2ae04ed916511624419bad68e9e20f3f29fbd" } ``` ### Response #### Success Response (200) - **code** (string) - Return code - **msg** (string) - Success or failure message - **data** (object) - Response payload - **data.orderNum** (string) - Order number #### Response Example ```json { "code": "0", "msg": "success", "data": { "orderNum": "199999999" } } ``` ``` -------------------------------- ### Order Detail Response Structure Source: https://platformdocs.chainup.com/en/api-reference/pay/pay_getReferenceOrder This is the JSON response structure for a successful order detail query. It includes information such as account details, order status, amounts, and timestamps. The 'data' object contains the core order information. ```json { "code": 0, "msg": "Success", "data": { "totalAccount": [ { "accountName": "name", "accountType": 202001, "accountBalance": 1000.21 }, { "accountName": "name", "accountType": 203001, "accountBalance": 1000.21 } ], "googleStatus": 1, "appOrderId": "100000009", "sign": "2ae04ed9165624419bad68e9e0f3f29fbdqws2ae04ed9165624419bad68e9e0f3f29fbd", "orderNum": "12321", "orderStatus": "1", "userId": 230000, "isOpenMobileCheck": "1", "orderAmount": "20001.21", "payCoinSymbol": "btc", "ctime": "20000000", "appKey": "xxx_xxx", "showPrecision": "8" } } ```