### Install PHP SDK Source: https://doc.heleket.com/sdks-and-modules/php-sdk Install the Heleket PHP SDK using Composer. ```bash 1composer require heleket/php-sdk ``` -------------------------------- ### Installation Source: https://doc.heleket.com/sdks-and-modules/php-sdk Install the Heleket PHP SDK using Composer. ```APIDOC ## Installation Install the Heleket PHP SDK using Composer: ```bash composer require heleket/php-sdk ``` ``` -------------------------------- ### Successful Response Example Source: https://doc.heleket.com/other/discount-payment/set-discount-to-payment-method This is an example of a successful response when setting a discount. It confirms the currency, network, and the applied discount percentage. ```json 1{ 2 "state": 0, 3 "result": { 4 "currency": "BUSD", 5 "network": "bsc", 6 "discount": "-10" 7 } 8} 9 10 ``` -------------------------------- ### PHP SDK Wallet Creation Response Example Source: https://doc.heleket.com/sdks-and-modules/php-sdk This is an example of the response structure received after successfully creating a static wallet using the PHP SDK. ```php array(5) { ["uuid"]=> string(12) "9f64a7ce-..." ["order_id"]=> string(2) "24" ["currency"]=> string(4) "USDT" ["network"]=> string(4) "tron" ["address"]=> string(6) "TK8..." } ``` -------------------------------- ### Request Example Source: https://doc.heleket.com/general/request-format Example of a cURL request to the /v1/payment/services endpoint, demonstrating the required headers and content type. ```APIDOC ## Request Example ```bash curl https://api.heleket.com/v1/payment/services \ -X POST \ -H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \ -H 'sign: f80fa426a89eb62bd53997326865d850' \ -H 'Content-Type: application/json' \ -d '{}' ``` ``` -------------------------------- ### List Discounts Response Example Source: https://doc.heleket.com/other/discount-payment/list-of-discounts This is an example of a successful response from the List Discounts API. It includes an array of discount objects, each specifying the currency, network, and discount percentage. ```json { "state": 0, "result": [ { "currency": "BTC", "network": "btc", "discount": 0 }, { "currency": "BUSD", "network": "bsc", "discount": -10 }, { "currency": "DASH", "network": "dash", "discount": 0 } ] } ``` -------------------------------- ### Payout Response Example Source: https://doc.heleket.com/methods/payouts/creating-payout This example demonstrates the structure of a successful payout response, including details like transaction ID, status, and balance. ```json { "state": 0, "result": { "uuid": "a7c0caec-a594-4aaa-b1c4-77d511857594", "amount": "3", "currency": "USDT", "commission": "0.001", "merchant_amount": "3.001" "network": "TRON", "address": "TJ...", "txid": null, "status": "process", "is_final": false, "balance": 129, "payer_currency": "USD", "payer_amount": 3 } } ``` -------------------------------- ### Invoice Response Example Source: https://doc.heleket.com/methods/payments/creating-invoice This is an example of a successful invoice creation response, detailing payment information, status, and transaction details. ```json { 1 "state": 0, 2 "result": { 3 "uuid": "1ec87133-b22d-4643-988f-cac29a6ac85d", 4 "order_id": "3", 5 "amount": "20000.00", 6 "payment_amount": null, 7 "payment_amount_usd": "0.00", 8 "payer_amount": "254.92", 9 "payer_amount_exchange_rate": "78.45392451", 10 "discount_percent": 0, 11 "discount": "0.00", 12 "payer_currency": "USDT", 13 "currency": "RUB", 14 "comments": null, 15 "merchant_amount": "249.82816502", 16 "network": "bsc", 17 "address": "0x2b...", 18 "from": null, 19 "txid": null, 20 "payment_status": "check", 21 "url": "https://pay.heleket.com/pay/1ec87133-b22d-4643-988f-cac29a6ac85d", 22 "expired_at": 1753202502, 23 "status": "check", 24 "is_final": false, 25 "additional_data": null, 26 "created_at": "2025-07-22T18:41:42+03:00", 27 "updated_at": "2025-07-22T18:42:31+03:00", 28 "commission": "5.09853397", 29 "address_qr_code": "data:image/png;base64 ..." 30 } 31} ``` -------------------------------- ### Invoice Creation Response Example Source: https://doc.heleket.com/methods/payments/creating-invoice Example of a successful response when creating an invoice, detailing the payment information and status. ```APIDOC ## Response Example ### Success Response (200 OK) ```json { "state": 0, "result": { "uuid": "1ec87133-b22d-4643-988f-cac29a6ac85d", "order_id": "3", "amount": "20000.00", "payment_amount": null, "payment_amount_usd": "0.00", "payer_amount": "254.92", "payer_amount_exchange_rate": "78.45392451", "discount_percent": 0, "discount": "0.00", "payer_currency": "USDT", "currency": "RUB", "comments": null, "merchant_amount": "249.82816502", "network": "bsc", "address": "0x2b...", "from": null, "txid": null, "payment_status": "check", "url": "https://pay.heleket.com/pay/1ec87133-b22d-4643-988f-cac29a6ac85d", "expired_at": 1753202502, "status": "check", "is_final": false, "additional_data": null, "created_at": "2025-07-22T18:41:42+03:00", "updated_at": "2025-07-22T18:42:31+03:00", "commission": "5.09853397", "address_qr_code": "data:image/png;base64 ..." } } ``` ``` -------------------------------- ### Invoice Creation Request Examples Source: https://doc.heleket.com/methods/payments/creating-invoice Examples of request bodies for creating invoices with various configurations, including currency conversion and network specifications. ```APIDOC ## Request Data Examples ### Example 1: Invoice for 20 USDT in Tron network ```json { "amount": "20", "currency": "USDT", "order_id": "1", "network": "tron" } ``` ### Example 2: Invoice for 25 USD, payable in USDT (any network) ```json { "amount": "25", "currency": "USD", "order_id": "1", "to_currency": "USDT" } ``` ### Example 3: Invoice for 25 USD, payable in USDT (Tron network) ```json { "amount": "25", "currency": "USD", "order_id": "1", "to_currency": "USDT", "network": "tron" } ``` ### Example 4: Invoice for 20 USDT, payable in any network ```json { "amount": "20", "currency": "USDT", "order_id": "1" } ``` ### Example 5: Invoice for 20 USD, payable in Bitcoin only ```json { "amount": "20", "currency": "USD", "order_id": "1", "to_currency": "BTC" } ``` ### Example 6: Invoice for 0.5 BTC, payable in Bitcoin only ```json { "amount": "0.5", "currency": "BTC", "order_id": "1" } ``` ``` -------------------------------- ### Error Response Example Source: https://doc.heleket.com/other/discount-payment/set-discount-to-payment-method This example shows an error response, typically indicating that the specified payment method (currency and network combination) was not found. ```json 1{ 2 "message": "The service BUSD bsc was not found", 3 "state": 1 } 5 ``` -------------------------------- ### Webhook Response Example Source: https://doc.heleket.com/methods/payments/webhook This is an example of a typical webhook response payload received from Heleket. ```json { "type": "payment", "uuid": "62f88b36-a9d5-4fa6-aa26-e040c3dbf26d", "order_id": "97a75bf8eda5cca41ba9d2e104840fcd", "amount": "3.00000000", "payment_amount": "3.00000000", "payment_amount_usd": "0.23", "merchant_amount": "2.94000000", "commission": "0.06000000", "is_final": true, "status": "paid", "from": "THgEWubVc8tPKXLJ4VZ5zbiiAK7AgqSeGH", "wallet_address_uuid": null, "network": "tron", "currency": "TRX", "payer_currency": "TRX", "additional_data": null, "convert": { "to_currency": "USDT", "commission": null, "rate": "0.07700000", "amount": "0.22638000" }, "txid": "6f0d9c8374db57cac0d806251473de754f361c83a03cd805f74aa9da3193486b", "sign": "a76c0d77f3e8e1a419b138af04ab600a" } ``` -------------------------------- ### QR Code Response Example (Static Wallet) Source: https://doc.heleket.com/methods/payments/qr-code-pay-form Example of a successful response when generating a QR code for a static wallet address. The 'image' field contains the Base64 encoded QR code. ```json { "state": 0, "result": { "image": "data:image/png;base64,iVBORw0KGgoAAA..." } } ``` -------------------------------- ### Payment History Response Example Source: https://doc.heleket.com/methods/payments/payment-history This is an example of a successful response when retrieving payment history. It includes details about individual payment items and pagination information. ```json { "state": 0, "result": { "items": [{ "uuid": "ac1af391-8e98-4335-b9d7-7b6f6b40f268", "order_id": "20fe59c4601dd174985e497e3f6bbcd2", "amount": "20.00", "payment_amount": "0.00000000", "payer_amount": "0.00064860", "discount_percent": 0, "discount": "0.00000000", "payer_currency": "BTC", "currency": "USD", "merchant_amount": null, "comments": null, "network": "btc", "address": "bc1qxm6ehuy6mz2l2h3ag88frcjvl2xxlr9hvnq835", "from": null, "txid": null, "payment_status": "cancel", "url": "https:\/\/pay.heleket.com\/pay\/ac1af391-8e98-4335-b9d7-7b6f6b40f268", "expired_at": 1689172103, "status": "cancel", "is_final": true, "additional_data": null, "created_at": "2023-07-12T16:28:24+03:00", "updated_at": "2023-07-12T17:30:16+03:00" }, { "uuid": "1bb48358-2905-4e98-b681-5f1948e818d1", "order_id": "a3329f462eb036dad12b5409147809a3", "amount": "15.00", "payment_amount": "0.00", "payer_amount": "14.25", "discount_percent": 5, "discount": "0.75", "payer_currency": "USDT", "currency": "USDT", "merchant_amount": "15.43500000", "comments": null, "network": "tron", "address": "TSChodGNEJ6D31d9uueFxJAVH9NxiJjTwC", "from": null, "txid": null, "payment_status": "cancel", "url": "https:\/\/pay.heleket.com\/pay\/1bb48358-2905-4e98-b681-5f1948e818d1", "expired_at": 1689099958, "status": "cancel", "is_final": true, "additional_data": null, "created_at": "2023-07-11T20:25:58+03:00", "updated_at": "2023-07-11T21:26:18+03:00" }, { "uuid": "70b8db5c-b952-406d-af26-4e1c34c27f15", "order_id": "65bbe87b4098c17a31cff3e71e515243", "amount": "15.00", "payment_amount": "0.00", "payer_amount": "15.75", "discount_percent": -5, "discount": "-0.75", "payer_currency": "USDT", "currency": "USDT", "merchant_amount": "15.43500000", "comments": null, "network": "tron", "address": "TXhfYSWt2oKRrHAJVJeYRuit6ZzKuoEKXj", "from": null, "txid": null, "payment_status": "cancel", "url": "https:\/\/pay.heleket.com\/pay\/70b8db5c-b952-406d-af26-4e1c34c27f15", "expired_at": 1689099831, "status": "cancel", "is_final": true, "additional_data": null, "created_at": "2023-07-11T20:23:52+03:00", "updated_at": "2023-07-11T21:24:17+03:00" }, "...": "..." ], "paginate": { "count": 15, "hasPages": true, "nextCursor": "eyJpZCI6MjkxNTU0MywiX3BvaW50c1RvTmV4dEl0ZW1zIjp0cnVlfQ", "previousCursor": null, "perPage": 15 } } ``` -------------------------------- ### Exchange Rates List Response Example Source: https://doc.heleket.com/other/list-of-exchange-rates This is an example of the JSON response received when querying the exchange rates list. It includes the state and a list of exchange rate objects, each with 'from', 'to', and 'course'. ```json 1{ 2 "state": 0, 3 "result": [ 4 { 5 "from": "ETH", 6 "to": "USD", 7 "course": "1228.45000000" 8 } 9 ] 10} ``` -------------------------------- ### Signature Generation Example (PHP) Source: https://doc.heleket.com/general/request-format Example of how to generate the signature required for API requests using PHP. If the request body is empty, an empty string should be used for signature generation. ```APIDOC ### Signature Generation Example (PHP) ```php $data = json_encode($data); $sign = md5(base64_encode($data) . $API_KEY); ``` If the request doesn’t require passing parameters in the body, then form a signature for an empty string: ```php $sign = md5(base64_encode('') . $API_KEY); ``` ``` -------------------------------- ### List Discounts Request Example (cURL) Source: https://doc.heleket.com/other/discount-payment/list-of-discounts Use this cURL command to send a POST request to the /v1/payment/discount/list endpoint. Ensure you include the correct merchant ID and signature in the headers. ```bash curl https://api.heleket.com/v1/payment/discount/list \ -X POST \ -H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \ -H 'sign: f80fa426a89eb62bd53997326865d850' \ -H 'Content-Type: application/json' \ -d '{}' ``` -------------------------------- ### Error: Terminal Not Found Source: https://doc.heleket.com/methods/payments/creating-invoice Example response indicating that the payment terminal was not found. ```json { 1 "state": 1, 2 "message": "The terminal was not found" } ``` -------------------------------- ### Validation Error Example Source: https://doc.heleket.com/methods/payouts/payout-history This example shows the response format for validation errors, such as incorrect date formats for `date_from` or `date_to` parameters. ```json { "state": 1, "errors": { "date_from": ["validation.regex"] } } ``` -------------------------------- ### Example API Request using cURL Source: https://doc.heleket.com/general/request-format Demonstrates how to make a POST request to the API endpoint using cURL, including necessary headers for merchant identification and signature. ```curl curl https://api.heleket.com/v1/payment/services \ -X POST \ -H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \ -H 'sign: f80fa426a89eb62bd53997326865d850' \ -H 'Content-Type: application/json' \ -d '{}' ``` -------------------------------- ### Error: Currency Conversion Failed Source: https://doc.heleket.com/methods/payments/creating-invoice Example response when an error occurs during the conversion to the specified 'to_currency'. ```json { 1 "state": 1, 2 "message": "Error convert to_currency" } ``` -------------------------------- ### Error: Merchant Wallet Not Found Source: https://doc.heleket.com/methods/payments/creating-invoice Example response when an active merchant wallet for the payment currency is not found. ```json { 1 "state": 1, 2 "message": "Wallet not found" } ``` -------------------------------- ### Static Wallet Creation Response Source: https://doc.heleket.com/methods/payments/creating-static This is an example of a successful response when creating a static wallet. It includes details such as wallet UUIDs, order ID, address, network, currency, and a payment URL. ```json { "state": 0, "result": { "wallet_uuid": "de15b0f6-883f-4585-b27b-73a648044a92", "uuid": "87961ae5-80c5-413a-a4fe-d38199894940", "order_id": "1", "address": "TTEtddVZyNtLD9wbq4PzomjBhtxenSMXbb", "network": "tron", "currency": "USDT", "url": "https://pay.heleket.com/wallet/3901446a-4b74-4796-b50a-14e14dafe3ed" } } ``` -------------------------------- ### Error: Server Error Source: https://doc.heleket.com/methods/payments/creating-invoice Example response indicating a general server error occurred. ```json { 1 "state": 1, 2 "message": "Server error" } ``` -------------------------------- ### Validation Error: Unsupported Network Source: https://doc.heleket.com/methods/payments/creating-invoice Example response when the provided network code is not supported by the system. ```json { 1 "state": 1, 2 "message": "The network was not found" } ``` -------------------------------- ### Error: Gateway Unavailable Source: https://doc.heleket.com/methods/payments/creating-invoice Example response indicating that the payment gateway is temporarily unavailable due to technical work. ```json { 1 "state": 1, 2 "message": "Gateway error" } ``` -------------------------------- ### Validation Error: Payment Service Not Found Source: https://doc.heleket.com/methods/payments/creating-invoice Example response when the payment service for the specified 'to_currency' is not available. ```json { 1 "state": 1, 2 "message": "Not found service to_currency" } ``` -------------------------------- ### Error: Payments Blocked Source: https://doc.heleket.com/methods/payments/creating-invoice Example response indicating that payments are blocked for the account. Contact support for resolution. ```json { 1 "state": 1, 2 "message": "You are forbidden" } ``` -------------------------------- ### Payment Information Response Example Source: https://doc.heleket.com/methods/payments/payment-information This is a successful response structure for the payment information request, showing details like payment status, amounts, currencies, and transaction specifics. ```json { "state": 0, "result": { "uuid": "70b8db5c-b952-406d-af26-4e1c34c27f15", "order_id": "65bbe87b4098c17a31cff3e71e515243", "amount": "15.00", "payment_amount": "0.00", "payer_amount": "15.75", "discount_percent": -5, "discount": "-0.75", "payer_currency": "USDT", "currency": "USDT", "comments": null, "merchant_amount": "15.43500000", "network": "tron", "address": "TXhfYSWt2oKRrHAJVJeYRuit6ZzKuoEKXj", "from": null, "txid": null, "payment_status": "cancel", "url": "https://pay.heleket.com/pay/70b8db5c-b952-406d-af26-4e1c34c27f15", "expired_at": 1689099831, "status": "cancel", "is_final": true, "additional_data": null, "created_at": "2023-07-11T20:23:52+03:00", "updated_at": "2023-07-11T21:24:17+03:00" } } ``` -------------------------------- ### PHP Signature Verification Example Source: https://doc.heleket.com/methods/payments/webhook This PHP code snippet demonstrates how to receive webhook data, extract the signature, generate a verification hash, and compare it with the received signature. ```APIDOC ## Verifying webhook signature in PHP ### Receiving JSON Data ```php $data = file_get_contents('php://input'); $data = json_decode($data, true); ``` ### Extracting the Signature ```php $sign = $data['sign']; unset($data['sign']); ``` ### Generating the Verification Hash ```php $hash = md5(base64_encode(json_encode($data, JSON_UNESCAPED_UNICODE)) . $apiPaymentKey); ``` ### Comparing Hashes ```php if (!hash_equals($hash, $sign)) { // Handle invalid hash exception // return new InvalidHashException(); } // Alternatively: // if ($hash !== $sign) { // // Handle invalid hash exception // // return new InvalidHashException(); // } // If hashes match, the webhook is verified. ``` ### Handling Slashes in Data Ensure proper encoding of slashes in JSON data to avoid signature mismatches. PHP's `json_encode` with `JSON_UNESCAPED_UNICODE` typically handles this correctly by escaping slashes. ``` -------------------------------- ### Validation Error: Unsupported Currency Source: https://doc.heleket.com/methods/payments/creating-invoice Example response when the currency code provided in the 'currency' parameter is not recognized or supported. ```json { 1 "state": 1, 2 "message": "The currency was not found" } ``` -------------------------------- ### Generate Signature in PHP Source: https://doc.heleket.com/general/request-format Example of how to generate the signature for a request body in PHP. Ensure the API key is kept secret. ```php $data = json_encode($data); $sign = md5(base64_encode($data) . $API_KEY); ``` ```php $sign = md5(base64_encode('') . $API_KEY); ``` -------------------------------- ### Get Exchange Rates List (cURL) Source: https://doc.heleket.com/other/list-of-exchange-rates Use this cURL command to request a list of exchange rates for a given currency. Replace \"ETH\" with the desired currency code. ```bash curl https://api.heleket.com/v1/exchange-rate/ETH/list ``` -------------------------------- ### Get Balance Information Source: https://doc.heleket.com/other/balance This snippet shows the expected JSON response when querying the balance endpoint. It includes balances for both merchant and user wallets across various currencies. ```json { "state": 0, "result": [ { "balance": { "merchant": [ { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.00000000", "currency_code": "ETH" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.57000000", "currency_code": "BTC" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "23.57327446", "currency_code": "TRX" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "5.00000000", "currency_code": "USDT" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "10.00120000", "currency_code": "DASH" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.18500000", "currency_code": "LTC" } ], "user": [ { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.40000000", "currency_code": "BTC" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "52.00000000", "currency_code": "USDT" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.00000000", "currency_code": "DASH" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.30000000", "currency_code": "LTC" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "27.00000000", "currency_code": "TRX" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.19000000", "currency_code": "ETH" } ] } } ] } ``` -------------------------------- ### Initialize Payment Client Source: https://doc.heleket.com/sdks-and-modules/php-sdk Initialize the payment client using your PAYMENT_KEY and MERCHANT_UUID. ```php 1const PAYMENT_KEY = 'uQ4LFWCBE3dT84uQnt7ycL7p9WcSwjkSPQaZbik3ChoWO0egw51f4EAaZQKmefhPP0F1cX8OpRcl2c3HexNedoR7FGEYGA1mTgMPI8lzKl7Ct2I43R6SSC3gVDS3rkGX'; 2const MERCHANT_UUID = 'c26b80a8-9549-4a66-bb53-774f12809249'; 3 4$payment = Heleket Api Client::payment(PAYMENT_KEY, MERCHANT_UUID); ``` -------------------------------- ### Initialize Payout Client Source: https://doc.heleket.com/sdks-and-modules/php-sdk Initialize the payout client using your PAYOUT_KEY and MERCHANT_UUID. ```php 1const PAYOUT_KEY = 'qseRhcxu6wsxhygfhyidwrrgryrrgefhPP0F1cNedoR7FGEYGA1mTgMPX8OpRcl2c3HexNedoR7FGEYGA1mTgMPI8lzKl7Ct2I43R6S1f4EAaZQKmefhSC3gVDS3rkGX'; 2const MERCHANT_UUID = 'c26b80a8-9549-4a66-bb53-774f12809249'; 3 4$payout = Heleket Api Client::payout(PAYOUT_KEY, MERCHANT_UUID); ``` -------------------------------- ### Create Static Wallet with PHP SDK Source: https://doc.heleket.com/sdks-and-modules/php-sdk Use this method to create a new static wallet. Ensure all required parameters like network, currency, order_id, and url_callback are provided in the data array. ```php $data = [ 'network' => 'TRON', 'currency' => 'USDT', 'order_id' => '5535321', 'url_callback' => 'https://example.com/callback' ]; $result = $payment->createWallet($data); ``` -------------------------------- ### Create Static Wallet Request Source: https://doc.heleket.com/methods/payments/creating-static Use this cURL command to create a static wallet. Ensure you include the mandatory 'currency', 'network', and 'order_id' parameters, along with your merchant ID and signature. ```bash curl https://api.heleket.com/v1/wallet \ -X POST \ -H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \ -H 'sign: fe99035f86fa436181717b302b95bacff1' \ -H 'Content-Type: application/json' \ -d '{ "currency": "USDT", "network": "tron", "order_id": "1", "url_callback": "https://your.site/callback" }' ``` -------------------------------- ### Get Balance Source: https://doc.heleket.com/other/balance Retrieves the merchant and user balances for various currencies. ```APIDOC ## POST /v1/balance ### Description Retrieves the merchant and user balances for various currencies. ### Method POST ### Endpoint /v1/balance ### Parameters #### Query Parameters _No parameters_ ### Response #### Success Response (200) - **state** (integer) - The state of the response. - **result** (array) - An array containing balance information. - **balance** (object) - An object containing merchant and user balances. - **merchant** (array) - An array of merchant balances. - **uuid** (string) - Wallet UUID. - **balance** (string) - Business wallet balance. - **currency_code** (string) - Wallet currency code. - **user** (array) - An array of user balances. - **uuid** (string) - Wallet UUID. - **balance** (string) - Personal wallet balance. - **currency_code** (string) - Wallet currency code. ### Response Example ```json { "state": 0, "result": [ { "balance": { "merchant": [ { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.00000000", "currency_code": "ETH" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.57000000", "currency_code": "BTC" } ], "user": [ { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.40000000", "currency_code": "BTC" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "52.00000000", "currency_code": "USDT" } ] } } ] } ``` ``` -------------------------------- ### Refund Blocked Address Request Example (cURL) Source: https://doc.heleket.com/methods/payments/refundblocked Use this cURL command to initiate a refund from a blocked static wallet. Ensure you provide either the 'uuid' or 'order_id' of the static wallet, and the 'address' for the refund. The 'merchant' and 'sign' headers are required for authentication. ```bash curl https://api.heleket.com/v1/wallet/blocked-address-refund \ -X POST \ -H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \ -H 'sign: fe99035f86fa436181717b302b95bacff1' \ -H 'Content-Type: application/json' \ -d '{ "order_id": "1", "address": "TK8..." }' ``` -------------------------------- ### Authorization (Payment) Source: https://doc.heleket.com/sdks-and-modules/php-sdk Initialize the payment client with your PAYMENT_KEY and MERCHANT_UUID. ```APIDOC ## Authorization (Payment) PAYOUT_KEY or PAYMENT_KEY, also MERCHANT_UUID required to use SDK details in documentation. ```php const PAYMENT_KEY = 'uQ4LFWCBE3dT84uQnt7ycL7p9WcSwjkSPQaZbik3ChoWO0egw51f4EAaZQKmefhPP0F1cX8OpRcl2c3HexNedoR7FGEYGA1mTgMPI8lzKl7Ct2I43R6SSC3gVDS3rkGX'; const MERCHANT_UUID = 'c26b80a8-9549-4a66-bb53-774f12809249'; $payment = \Heleket\Api\Client::payment(PAYMENT_KEY, MERCHANT_UUID); ``` ``` -------------------------------- ### Create Invoice with Fiat Currency (cURL) Source: https://doc.heleket.com/methods/payments/creating-invoice Use this example to create a basic invoice with a fiat currency. The user can select the cryptocurrency and network on the payment page. Ensure 'merchant' and 'sign' headers are correctly set. ```curl curl https://api.heleket.com/v1/payment \ -X POST \ -H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \ -H 'sign: fe99035f86fa436181717b302b95bacff1' \ -H 'Content-Type: application/json' \ -d '{ \ "amount": "15", \ "currency": "USD", \ "order_id": "1" \ }' ``` -------------------------------- ### Create Invoice for USDT (all networks) Source: https://doc.heleket.com/methods/payments/creating-invoice Request data to create an invoice for 20 USDT, allowing clients to pay using any of the available networks. ```json { 1 "amount": "20", 2 "currency": "USDT", 3 "order_id": "1" } ``` -------------------------------- ### Create Static Wallet Source: https://doc.heleket.com/sdks-and-modules/php-sdk This method creates a new static wallet for a given network and currency. It requires an order ID and a callback URL. ```APIDOC ## Create Static Wallet ### Description Creates a new static wallet with specified details. ### Method `createWallet(array $data)` ### Parameters #### Request Body - **network** (string) - Required - The network for the wallet (e.g., 'TRON'). - **currency** (string) - Required - The currency for the wallet (e.g., 'USDT'). - **order_id** (string) - Required - A unique identifier for the order. - **url_callback** (string) - Required - The URL to receive callback notifications. ### Response #### Success Response (200) - **uuid** (string) - The unique identifier of the created wallet. - **order_id** (string) - The order ID associated with the wallet. - **currency** (string) - The currency of the wallet. - **network** (string) - The network of the wallet. - **address** (string) - The generated wallet address. ### Request Example ```php $data = [ 'network' => 'TRON', 'currency' => 'USDT', 'order_id' => '5535321', 'url_callback' => 'https://example.com/callback' ]; $result = $payment->createWallet($data); ``` ### Response Example ```json { "uuid": "9f64a7ce-...", "order_id": "24", "currency": "USDT", "network": "tron", "address": "TK8..." } ``` ``` -------------------------------- ### Get Account Balance Source: https://doc.heleket.com/sdks-and-modules/php-sdk Fetches the current balance for both merchant and user accounts across different currencies. ```APIDOC ## Get Account Balance ### Description Retrieves the current balance for merchant and user accounts. ### Method ```php $payment->balance() ``` ### Response Example ```json { "items": [ { "balance": { "merchant": [ { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.00000000", "currency_code": "ETH" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.57000000", "currency_code": "BTC" } ], "user": [ { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "0.40000000", "currency_code": "BTC" }, { "uuid": "abcdabcd-abcd-1234-1234-abcdabcd", "balance": "52.00000000", "currency_code": "USDT" } ] } } ] } ``` ``` -------------------------------- ### Get Payment History Source: https://doc.heleket.com/methods/payments/payment-history Retrieves a list of payment records. Supports filtering by creation date range. ```APIDOC ## POST /v1/payment/list ### Description Returns a list of invoices. Supports filtering by creation date. ### Method POST ### Endpoint https://api.heleket.com/v1/payment/list ### Parameters #### Query Parameters - **date_from** (string) - Optional - Filtering by creation date, from. Format: YYYY-MM-DD H:mm:ss - **date_to** (string) - Optional - Filtering by creation date, to. Format: YYYY-MM-DD H:mm:ss ### Request Example ```json { "date_from": "2023-05-04 00:00:00", "date_to": "2023-05-16 23:59:59" } ``` ### Response #### Success Response (200) - **items** (array) - Array of invoices. Structure of item. - **paginate** (object) - Pagination details. ### Structure of `paginate` - **count** (integer) - Number of items on the current page. - **hasPages** (boolean) - Whether there are enough elements to split into multiple pages. - **nextCursor** (string | null) - Cursor to the next page. - **previousCursor** (string | null) - Cursor to the previous page. - **perPage** (integer) - Maximum number of elements per page. ### Example: Fetching next page ```bash curl https://api.heleket.com/v1/payment/list?cursor=eyJpZCI6MjEyLCJfcG9pbnRzVzVG9OZhXh0SXRlbXMiOnRydWV9 \ -X POST \ -H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \ -H 'sign: f80fa426a89eb62bd53997326865d850' \ -H 'Content-Type: application/json' ``` ``` -------------------------------- ### Internal Server Error Source: https://doc.heleket.com/methods/payments/creating-invoice Example response for a 500 Internal Server Error, including a message and error code. ```json { 1 "message": "Server error, #1", 2 "code": 500, 3 "error": null } ```