### Successful Response Example (Balance Inquiry) Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration Example of a successful response when inquiring about account balance. ```json { "code": 0, "msg": "success", "data": { "currency_id": 46, "balance": "0.785074013", "operable_balance": "0.785074013", "operable_balance_usdt": "0.043642", "balance_usdt": "0.043642", "chain": "Tron", "network": "Nile", "token": "JST", "contract": "TF17BgPaZYbz8oxbjhriubPDsA7ArKoLX3" } } ``` -------------------------------- ### Payout - Successful Response Example Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration Example of a successful response after initiating a payout. ```json { "code": 0, "msg": "success", "data": { "cost": "0.801502", "actual_receipt": "0.001", "trade_no": "202603171746187e582d1b789b27ea55", "estimated_transfer": "0" } } ``` -------------------------------- ### Token List - Successful Response Example Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration Example of a successful response when retrieving the token list. ```json { "code": 0, "msg": "success", "data": [ { "currency_id": 46, "chain": "Tron", "network": "Nile", "token": "JST", "contract": "TF17BgPaZYbxxxxhriubPDsA7ArKoLX3", "chain_id": 3448148188, "logo": "https://halo-n.oss-ap-southeast-1.aliyuncs.com/png/202505/xxx-c3f3-4d5d-a9b5-0143d78326f9.png", "decimal": 18, "balance": "0.785074013", "operable_balance": "0.785074013", "frozen_amount": "0", "status": 1, "transaction_enabled": true } ] } ``` -------------------------------- ### Create Order - Successful Response Example Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration This is an example of a successful response when creating an order. ```json { "code": 0, "msg": "success", "data": { "trade_no": "20260317173635066d54f5b6c7269d41", "chain": "Tron", "token": "TRX", "contract": "TRX", "amount": "16.556743", "mode": "address", "pay_address": "THgSjcyhyxfzrjtS7VYw1vnHvb7QkMsY...", "time_expire": 1773741995, "decimal": 6, "chain_id": 3448148188, "equity": 1, "create_time": 1773740196, "amount_collected": "", "need_confirms": 0, "already_confirms": 0, "entrust_url": "https://checkout.pay.halochat.io/20260317173635066d54f5b6c7269d41", "chain_info": { "token": "TRX", "abi": "", "rpc": "https://nile.trongrid.io", "browser_url": "https://nile.tronscan.org/#/transaction", "decimal": 6, "logo": "https://halo-n.oss-ap-southeast-1.aliyuncs.com/png/202505/45d1f4b5-b80f-4331-af78-ec557f97d832.png", "series": "Tron", "monitor_chain_id": 3448148188 } } } ``` -------------------------------- ### Successful Response Example for Payment API Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration An example of a successful response from the payment API. ```json { "code": 0, "msg": "success", "data": { "trade_no": "20260317173635066d54f5b6c7269d41", "out_trade_no": "ORDER_1773740195363", "chain": "Tron", "token": "TRX", "contract": "TRX", "fiat_name": "USD", "fiat_amount": "5", "amount": "16.556743", "mode": "address", "pay_address": "THgSjcyhyxfzrjtS7VYw1vnHvb7QkMsY...", "status": "TO-BE-PAID", "time_expire": 1773741995, "decimal": 6, "chain_id": 3448148188, "equity": 1, "create_time": 1773740196, "amount_collected": "0", "need_confirms": 0, "already_confirms": 0, "entrust_url": "", "redirect_url": "", "chain_info": { "token": "TRX", "abi": "", "rpc": "https://nile.trongrid.io", "browser_url": "https://nile.tronscan.org/#/transaction", "decimal": 6, "logo": "", "series": "", "monitor_chain_id": 0 } } } ``` -------------------------------- ### Successful Response Example (Static Payment QR Code) Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration Example of a successful response when creating a static payment QR code. ```json { "code": 0, "msg": "success", "data": { "id": 115, "address": "TXd8UKLtLqk5V15v7e3W43ZdNw5berp6DP" } } ``` -------------------------------- ### Successful Response Example for Price Exchange API Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration An example of a successful response from the Price Exchange API. ```json { "code": 0, "msg": "success", "data": { "amount": "0.00001971", "exchange_rate": "100" } } ``` -------------------------------- ### Query Transfer Status - Successful Response Example Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration Example of a successful response when querying the status of a transfer. ```json { "code": 0, "msg": "success", "data": { "service_charge": "0.000002", "gas": "0.8015", "amount": "0.001", "status": "TRANSFER", "target_address": "TDYiTL3pke3T9BsoTotbKb922WsXQCmS...", "start_time": 1773740882, "created_time": 1773740882, "trade_no": "202603171748020a09cbb09b4846bc99", "token": "DK7bKg181cC7pBgX3PxSIH2WdklZ5IPT" } } ``` -------------------------------- ### Create Payment Order Request Body Example Source: https://docs.pay.halochat.io/docs/developer/payment-api/hosted-checkout-page-integration Example of the JSON payload to create a payment order. ```json { "out_trade_no": "uz54NEW9TVhLSIDHUSYB4aEFupKoE7I8", "symbol": "USD", "amount": "15", "name": "PRODUCT_NAME", "image": "https://callback.com/logo.png", "describe": "CHECKOUT_DESCRIPTION", "time_expire": 1773750780, "callback_url": "https://callback.com/", "redirect_url": "https://yourdomain.com/success" } ``` -------------------------------- ### Create Payment Order Success Response Body Source: https://docs.pay.halochat.io/docs/developer/payment-api/hosted-checkout-page-integration Example of a successful response body when creating a payment order. ```json { "code": 0, "msg": "success", "data": { "url": "https://checkout.pay.halochat.io/202603172021145994e1572e91672b34", "time_expire": 1773750780, "trade_no": "202603172021145994e1572e91672b34" } } ``` -------------------------------- ### Response Field Description for Price Exchange API Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration Describes the fields returned when getting price exchange rates. ```json Field| Type| Description ---|---|--- amount| string| Amount exchange_rate| string| Exchange rate ``` -------------------------------- ### Create Payment Order Fail Response Body Source: https://docs.pay.halochat.io/docs/developer/payment-api/hosted-checkout-page-integration Example of a failed response body when creating a payment order. ```json { "code": 10003, "msg": "Params Error: Invalid amount", "data": null } ``` -------------------------------- ### Golang Signature Algorithm Source: https://docs.pay.halochat.io/docs/developer/to-get-started/signature This Go code snippet demonstrates how to generate a signature using the HMAC-SHA256 algorithm. ```golang // sign (golang) func hmacSHA256Sign(appKey, timestamp string, body interface{}) (string, error) { jsonStr, err := json.Marshal(body) if err != nil { return "", err } sha256Mac := hmac.New(sha256.New, []byte(appKey)) _, err = sha256Mac.Write(append(jsonStr, []byte(timestamp)...)) if err != nil { return "", err } return hex.EncodeToString(sha256Mac.Sum(nil)), nil } ``` -------------------------------- ### Response Field Description for App Token List API Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration Describes the fields returned for the App Token List API. ```json Root object: Field| Type| Description ---|---|--- code| integer| Business code, `0` means success msg| string| Message data| array| Enabled tokens and balances for the current app `data[]` elements: Field| Type| Description ---|---|--- currency_id| integer| Global unique currency ID chain| string| Chain name network| string| Network name token| string| Token symbol contract| string| Contract address chain_id| integer| Chain ID logo| string| Token logo URL decimal| integer| Token decimals balance| string| Total balance (decimal string) operable_balance| string| Operable balance frozen_amount| string| Frozen amount status| integer| Status: 1 — enabled, 2 — disabled transaction_enabled| boolean| Receiving enabled (always `true` in this response) ``` -------------------------------- ### Java Signature Algorithm Source: https://docs.pay.halochat.io/docs/developer/to-get-started/signature This Java code snippet shows how to generate a signature using the HMAC-SHA256 algorithm. ```java // sign (Java) public static String sign(String appKey, long timestamp, String body) { String input = body + timestamp; Mac mac = Mac.getInstance("HmacSHA256"); SecretKey secretKey = new SecretKeySpec( appKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256" ); mac.init(secretKey); byte[] hash = mac.doFinal(input.getBytes(StandardCharsets.UTF_8)); // bytes to hex StringBuilder sb = new StringBuilder(); for (byte b : hash) { sb.append(String.format("%02x", b)); } return sb.toString(); } ``` -------------------------------- ### Base URL Source: https://docs.pay.halochat.io/docs/developer/to-get-started/api-specification-common-rules The base URL for all API requests. ```text https://api.pay.halochat.io ``` -------------------------------- ### Response Field Description for Payment API Source: https://docs.pay.halochat.io/docs/developer/payment-api/native-checkout-integration Describes the fields returned in a payment transaction response. ```json Field| Type| Description| Example ---|---|---|--- trade_no| string| Transaction ID (platform)| "20250629153045a7b3c9d2e5f8a1b4c6" out_trade_no| string| Merchant's order ID| "202401011753513569" chain| string| Blockchain network| "Tron" token| string| Cryptocurrency token| "TRX" contract| string| Token contract address| "TRX" fiat_name| string| Fiat currency name| "USD" fiat_amount| string| Fiat amount to pay| "5" amount| string| Crypto amount to send| "15.724197" mode| string| Payment mode| "address" pay_address| string| Recipient crypto address| "TSg8kWPE2s7z5Lon6bSnZZrYnquGHx2..." status| string| Transaction status| "TO-BE-PAID" time_expire| integer| Expiration timestamp (Unix)| 1753515371 decimal| integer| Token decimals| 6 chain_id| integer| Chain ID| 3448148188 equity| integer| Equity value| 1 create_time| integer| Creation timestamp (Unix)| 1753513571 amount_collected| string| Collected amount| "0" need_confirms| integer| Required confirmations| 0 already_confirms| integer| Current confirmations| 0 entrust_url| string| Payment URL (if applicable)| "" redirect_url| string| Redirect callback URL after successful payment (http(s)://)| "" chain_info| object| Chain information| `{"token": "TRX", "rpc": "...", ...}` ``` -------------------------------- ### Response from Merchant Webhook Server Source: https://docs.pay.halochat.io/docs/developer/payment-api/webhook-notification This snippet illustrates a successful HTTP response from the merchant's webhook server, indicating that the notification was received and processed. ```http HTTP/1.1 200 OK Content-Type: text/plain Success ``` -------------------------------- ### QRPayment Body Source: https://docs.pay.halochat.io/docs/developer/payment-api/webhook-notification The structure of the request body for QR payment transactions. ```json { "appid": "1aiqfs0agrd3b9fm", (By default, it is different from the payment APPID.) "trade_no": "2c8b150bf35abc59189e333c107247db", "type": "QR_PAYMENT" "chain": "Tron", "chain_id": 3448148188, "contract": "TRX", "txid": "2cdf12e85ec73a61280daaf49c4f27686519407fa0dc7b7744596cad29cbd53c", "currency_id": 75, "from_address": "TSpjU4PUYzAyY88wyKEEMD7MryneC1WLeb", "to_address": "TY1RJdyJh4y1tgmPFrnSaWFhM1HwqTvCQ1", "token_amount": "11", "status": "PAID", (PAID) "time": 1773473913, } ``` -------------------------------- ### Request to Merchant Webhook Server Source: https://docs.pay.halochat.io/docs/developer/payment-api/webhook-notification This snippet shows the structure of the HTTP POST request sent to the merchant's webhook server when a payment event occurs. It includes custom headers for authentication and event details, along with a JSON payload containing transaction information. ```http POST /webhook/callback HTTP/1.1 Host: merchant.example.com Content-Type: application/json X-Appid: ad4cyr8dpfs... X-Timestamp: 1773471015 X-Sign: e0c6a719ebc366da... X-EventType: Paid { "appid": "ad4cyr8dpfs...", "trade_no": "202603141449020ad66d22c5787af677", "out_trade_no": "20250101xxxxxxxxxxxxx12221c", "amount_collected": "5", "amount": "5", "token_amount": "4.998045", "chain": "Tron", "chain_id": 3448148188, "type": "PAYMENT", "currency_id": 75, "txid": "008f81782daa47709d67bc2073ffff639035cfd17b7e4ad06f0d6ec24099c013", "status": "PAID", "time": 1773471015, "redirect_url": "https://yourdomain.com/success" } ``` -------------------------------- ### Payment Body Source: https://docs.pay.halochat.io/docs/developer/payment-api/webhook-notification The structure of the request body for payment transactions. ```json { "appid": "ad4cyr8dpfs...", "trade_no": "202603141449020ad66d22c5787af677", "out_trade_no": "20250101xxxxxxxxxxxxx12221c", "amount_collected": "5", "amount": "5", "token_amount": "4.998045", "chain": "Tron", "chain_id": 3448148188, "type": "PAYMENT", "currency_id": 75, "txid": "008f81782daa47709d67bc2073ffff639035cfd...", "status": "PAID", (TO-BE-PAID/PAID/TIME-OUT) "time": 1773471015, "redirect_url": "https://yourdomain.com/success" } ``` -------------------------------- ### Payout Body Source: https://docs.pay.halochat.io/docs/developer/payment-api/webhook-notification The structure of the request body for payout transactions. ```json { "appid": "ad4cyr8dpfs...", "chain": "Tron", "chain_id": 3448148188, "contract": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf", "currency_id": 75, "status": "PAID", (PAID/FAIL) "time": 1773473637, "token_amount": "1", "trade_no": "202603141533083d1eba01c48c2a873c", "txid": "aa23e0aebd2e4c5b82786a5e8b1f414222c7c525a438b95e2cc7d67c81187a5d", "type": "TRANSFER" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.