### Create Market Order API & PHP Example Source: https://github.com/payeer/docs/blob/main/trade-api/ru.md This section details the API endpoint and parameters for creating a market order. It includes a PHP example demonstrating how to construct the request, sign it, and send it using cURL, along with example request and response bodies. ```APIDOC Endpoint: POST /api/trade/order_create Method: order_create Request Parameters: - pair (string, required): Trading pair (e.g., TRX_USD) - type (string, required): Order type, must be 'market' - action (string, required): Trading action, 'buy' or 'sell' - amount (string, optional): Quantity of the asset to trade. Either 'amount' or 'value' must be specified. - value (string, optional): Total value of the order. Either 'amount' or 'value' must be specified. - ts (long, required): Timestamp in milliseconds (e.g., 1644489441948) Request Headers: - Content-Type: application/json - API-ID: Your API ID (e.g., bd443f00-092c-4436-92a4-a704ef679e24) - API-SIGN: HMAC-SHA256 signature of (method + JSON request body) using API secret key Example Request Body: { "pair": "TRX_USD", "type": "market", "action": "buy", "amount": "10", "ts": 1644489441948 } Response 200 (application/json): { "success": true, "order_id": 37054922, "params": { "pair": "TRX_USD", "type": "market", "action": "buy", "amount": "10.000000", "price": "0.07200", "value": "0.72" } } ``` ```PHP $msec = round(microtime(true) * 1000); $apiId = 'bd443f00-092c-4436-92a4-a704ef679e24'; $apiSecret = 'api_secret_key'; $method = 'order_create'; $req = json_encode(array( 'pair' => 'TRX_USD', 'type' => 'market', 'action' => 'buy', 'amount' => '10', 'ts' => $msec, )); $sign = hash_hmac('sha256', $method.$req, $apiSecret); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://payeer.com/api/trade/".$method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "API-ID: ".$apiId, "API-SIGN: ".$sign )); $response = curl_exec($ch); curl_close($ch); echo '
'; print_r(json_decode($response, true)); echo ''; ``` -------------------------------- ### Create Stop-Limit Order API & PHP Example Source: https://github.com/payeer/docs/blob/main/trade-api/ru.md This section outlines the API endpoint and parameters for creating a stop-limit order. It provides a PHP example showing how to prepare and send the signed request via cURL, along with example request and response bodies. ```APIDOC Endpoint: POST /api/trade/order_create Method: order_create Request Parameters: - pair (string, required): Trading pair (e.g., TRX_USD) - type (string, required): Order type, must be 'stop_limit' - action (string, required): Trading action, 'buy' or 'sell' - amount (string, required): Quantity of the asset to trade. - price (string, required): The limit price for the order. - stop_price (string, required): The stop price that triggers the limit order. - ts (long, required): Timestamp in milliseconds (e.g., 1644492621264) Request Headers: - Content-Type: application/json - API-ID: Your API ID (e.g., bd443f00-092c-4436-92a4-a704ef679e24) - API-SIGN: HMAC-SHA256 signature of (method + JSON request body) using API secret key Example Request Body: { "pair": "TRX_USD", "type": "stop_limit", "action": "buy", "amount": "10", "price": "0.08", "stop_price": "0.078", "ts": 1644492621264 } Response 200 (application/json): { "success": true, "order_id": 37057767, "params": { "pair": "TRX_USD", "type": "stop_limit", "action": "buy", "amount": "10.000000", "price": "0.08000", "value": "0.80", "stop_price": "0.07800" } } ``` ```PHP $msec = round(microtime(true) * 1000); $apiId = 'bd443f00-092c-4436-92a4-a704ef679e24'; $apiSecret = 'api_secret_key'; $method = 'order_create'; $req = json_encode(array( 'pair' => 'TRX_USD', 'type' => 'stop_limit', 'action' => 'buy', 'amount' => '10', 'price' => '0.08', 'stop_price' => '0.078', 'ts' => $msec, )); $sign = hash_hmac('sha256', $method.$req, $apiSecret); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://payeer.com/api/trade/".$method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "API-ID: ".$apiId, "API-SIGN: ".$sign )); $response = curl_exec($ch); curl_close($ch); echo '
'; print_r(json_decode($response, true)); echo ''; ``` -------------------------------- ### Payeer API Connection Test Endpoint (/time) and PHP Example Source: https://github.com/payeer/docs/blob/main/trade-api/en.md Documentation for the `/time` API endpoint, used to check connectivity with the Payeer API and retrieve the server's current timestamp. This snippet includes the API specification and a practical PHP code example for making the request and parsing the response. ```APIDOC Endpoint: /time Method: GET Request Weight: 1 Response Parameters: success: boolean - Request success indicator (true, false) time: long - Server timestamp (e.g., 1644322909335) Example Response (200 OK, application/json): { "success": true, "time": 1644322909335 } ``` ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://payeer.com/api/trade/time"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); $response = curl_exec($ch); curl_close($ch); echo '
'; print_r(json_decode($response, true)); echo ''; ``` -------------------------------- ### Create Stop Limit Order on Payeer API Source: https://github.com/payeer/docs/blob/main/trade-api/en.md This snippet outlines the process for creating a stop-limit order via the Payeer API. It provides the API endpoint details, necessary request parameters including stop price, example JSON request and response structures, and a PHP code example for making the API call with proper authentication. ```APIDOC API Endpoint: POST /api/trade/order_create Description: Creates a stop-limit order on the Payeer exchange. Request Parameters: - pair (string, required): Trading pair (e.g., TRX_USD) - type (string, required): Order type, must be 'stop_limit' - action (string, required): Order action, 'buy' or 'sell' - amount (string, required): Amount to buy/sell - price (string, required): Limit price for the order - stop_price (string, required): Stop price that triggers the limit order - ts (long, required): Timestamp in milliseconds (e.g., 1644492621264) Request Headers: - Content-Type: application/json - API-ID: Your API ID - API-SIGN: HMAC-SHA256 signature of method + request body using API secret Example Request Body (application/json): { "pair": "TRX_USD", "type": "stop_limit", "action": "buy", "amount": "10", "price": "0.08", "stop_price": "0.078", "ts": 1644492621264 } Example Success Response 200 (application/json): { "success": true, "order_id": 37057767, "params": { "pair": "TRX_USD", "type": "stop_limit", "action": "buy", "amount": "10.000000", "price": "0.08000", "value": "0.80", "stop_price": "0.07800" } } ``` ```PHP $msec = round(microtime(true) * 1000); $apiId = 'bd443f00-092c-4436-92a4-a704ef679e24'; $apiSecret = 'api_secret_key'; $method = 'order_create'; $req = json_encode(array( 'pair' => 'TRX_USD', 'type' => 'stop_limit', 'action' => 'buy', 'amount' => '10', 'price' => '0.08', 'stop_price' => '0.078', 'ts' => $msec, )); $sign = hash_hmac('sha256', $method.$req, $apiSecret); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://payeer.com/api/trade/".$method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "API-ID: ".$apiId, "API-SIGN: ".$sign )); $response = curl_exec($ch); curl_close($ch); echo '
'; print_r(json_decode($response, true)); echo ''; ``` -------------------------------- ### Get Price Statistics for Trading Pairs (GET /api/trade/ticker) Source: https://github.com/payeer/docs/blob/main/trade-api/en.md This section details how to retrieve current price statistics and 24-hour changes for trading pairs from the Payeer API. It provides a PHP cURL example for making the GET request and comprehensive documentation of the request parameters (optional `pair` list) and the detailed structure of the JSON response, including ask, bid, last prices, and 24-hour min/max/delta values. ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://payeer.com/api/trade/ticker"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); $response = curl_exec($ch); curl_close($ch); echo '
'; print_r(json_decode($response, true)); echo ''; ``` ```APIDOC Endpoint: GET /api/trade/ticker Description: Getting price statistics and their changes over the last 24 hours. Request Weight: 1 Request Parameters: pair: string (optional, comma-separated list of pairs, e.g., "BTC_USD,BTC_RUB") Response 200 (application/json): success: boolean (request success indicator) pairs: object (list of pairs, key-value pairs where key is the trading pair)
'; print_r(json_decode($response, true)); echo ''; ``` -------------------------------- ### Payeer API: Get Available Payment Systems Source: https://github.com/payeer/docs/blob/main/rest-api/en.md This API endpoint retrieves a list of payment systems currently available for payout transactions. It provides details for each system, including ID, name, commission rates, supported currencies, and required fields for creating a payout. ```APIDOC POST /getPaySystems Headers: Content-Type: application/x-www-form-urlencoded Request Body Parameters: account: Your account number in the Payeer system (e.g., P1000000) apiId: The API user’s ID; given out when adding the API (e.g., 12345) apiPass: The API user's secret key (e.g., qwerty) action: Action type, must be 'getPaySystems' Example Request Body: account=P1000000&apiId=12345&apiPass=qwerty&action=getPaySystems Response 200 (application/json): { "auth_error":"0", "errors":[], "list":{ "1136053":{ "id":"1136053", "name":"Payeer", "gate_commission":[], "gate_commission_min":[], "gate_commission_max":[], "currencies":["USD","RUB","EUR"], "commission_site_percent":0, "r_fields":{ "ACCOUNT_NUMBER":{ "name":"Номер счета", "reg_expr":"#^P[0-9]+$#", "example":"P1000000" } } } } } Response List Array Parameters: id: payment system ID (required for payout) name: payment system name gate_commission: gateway fee for each supported currency gate_commission_min: minimum gateway fee for each currency gate_commission_max: maximum gateway fee for each currency currencies: supported currencies commission_site_percent: Payeer’s fee in percent r_fields: list of parameters for creating a payout ``` -------------------------------- ### Payeer API: Create Order Endpoint (`/order_create`) Source: https://github.com/payeer/docs/blob/main/trade-api/en.md Details the API endpoint for creating new trading orders on Payeer, supporting limit, market, and stop limit types. This includes general response parameters, specific request parameters for limit orders, required headers, and example request/response bodies. ```APIDOC Endpoint: /order_create Method: POST Request Weight: 5 (10 for market order) General Response Parameters: success: boolean - Request success indicator (true, false) order_id: integer - ID of the created order (e.g., 37057767) params: object - Parameters of the created order pair: string - Trading pair (e.g., TRX_USD) type: string - Order type (limit, market, stop_limit) action: string - Action (buy, sell) amount: string - Amount (e.g., 10.000000) price: string - Price (e.g., 0.08000) value: string - Value (e.g., 0.80) stop_price: string - Stop price (e.g., 0.07800) (for stop_limit orders) Limit Order Request Parameters: pair: string - Trading pair (e.g., TRX_USD) type: string - Order type (must be 'limit') action: string - Action (buy, sell) amount: string - Amount (e.g., 10) price: string - Price (e.g., 0.08) ts: long - Timestamp in milliseconds (e.g., 1644488888211) Request Headers: API-ID: string - Your API ID (e.g., bd443f00-092c-4436-92a4-a704ef679e24) API-SIGN: string - HMAC-SHA256 signature of (method + request_body) Content-Type: application/json Example Request Body (application/json): { "pair": "TRX_USD", "type": "limit", "action": "buy", "amount": "10", "price": "0.08", "ts": 1644488888211 } Example Response 200 Body (application/json): { "success": true, "order_id": 37054386, "params": { "pair": "TRX_USD", "type": "limit", "action": "buy", "amount": "10.000000", "price": "0.08000", "value": "0.80" } } ``` -------------------------------- ### PHP Example: Fetching Payeer Transaction History with Filtering Source: https://github.com/payeer/docs/blob/main/trade-api/en.md This PHP code demonstrates how to construct and send a POST request to the Payeer API's 'my_history' method. It includes setting up API credentials, signing the request with HMAC-SHA256, and handling JSON data for filtering transaction records by pair, action, status, and date range. ```php $msec = round(microtime(true) * 1000); $apiId = 'bd443f00-092c-4436-92a4-a704ef679e24'; $apiSecret = 'api_secret_key'; $method = 'my_history'; $req = json_encode(array( 'pair' => 'BTC_USD,BTC_RUB', 'action' => 'buy', 'status' => 'canceled', 'date_from' => strtotime('01.09.2021 00:00:00'), 'date_to' => strtotime('30.09.2021 23:59:59'), 'limit' => 3, 'ts' => $msec, )); $sign = hash_hmac('sha256', $method.$req, $apiSecret); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://payeer.com/api/trade/".$method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "API-ID: ".$apiId, "API-SIGN: ".$sign )); $response = curl_exec($ch); curl_close($ch); echo '
'; print_r(json_decode($response, true)); echo ''; ``` -------------------------------- ### Fetch All Trading Pairs and Limits using PHP cURL Source: https://github.com/payeer/docs/blob/main/trade-api/en.md This PHP code snippet demonstrates how to make a GET request to the Payeer API's `/info` endpoint using cURL to retrieve all available trading pairs and their associated limits. The response is then decoded from JSON and printed for inspection. ```php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://payeer.com/api/trade/info"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); $response = curl_exec($ch); curl_close($ch); echo '
'; print_r(json_decode($response, true)); echo ''; ``` -------------------------------- ### Retrieve Trade Pair Information (POST /api/trade/info) Source: https://github.com/payeer/docs/blob/main/trade-api/en.md This snippet demonstrates how to make a POST request to the Payeer API to retrieve detailed information about specified trading pairs. It includes a PHP cURL example for sending the request, along with the expected JSON request and response structures, detailing pair prices, limits, and fees. ```PHP $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://payeer.com/api/trade/info"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array( 'pair' => 'BTC_USD,BTC_RUB', ))); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); echo '
'; print_r(json_decode($response, true)); echo ''; ``` ```APIDOC Endpoint: POST /api/trade/info Description: Retrieve detailed information for specified trading pairs. Request Body (application/json): pair: string (comma-separated list of pairs, e.g., "BTC_USD,BTC_RUB") Response 200 (application/json): success: boolean (request success indicator) limits: object requests: array interval: string ("min") interval_num: number (e.g., 1) limit: number (e.g., 600) pairs: object (key-value pairs where key is the trading pair)
'; print_r(json_decode($response, true)); echo ''; ``` -------------------------------- ### Payeer API: Get Payout Details Source: https://github.com/payeer/docs/blob/main/rest-api/en.md Retrieves detailed information about a specific payout using its reference ID. This endpoint is used to check the status and details of a payout initiated through the Payeer system. ```APIDOC Endpoint: /payoutDetails (implied) Method: POST (implied by typical API patterns for detailed queries) Request Parameters (Body - form-urlencoded): - account (string): Your account number in the Payeer system. Example: P1000000 - apiId (integer): The API user’s ID; given out when adding the API. Example: 12345 - apiPass (string): The API user's secret key. Example: qwerty - action (string): Action type, must be 'payoutDetails'. - referenceId (string): identification number in your accounting system. Example: 08d7f228-5a03-4dc7-b13a-7c14146df8f7 Optional Request Parameters (Body - form-urlencoded): - referenceApiId (integer): id of the api-user (apiId is used by default). Example: 123456 Response: (Not explicitly provided, but expected to be JSON with payout details) ``` -------------------------------- ### Payeer API: Fetch User Orders (my_orders) Endpoint Source: https://github.com/payeer/docs/blob/main/trade-api/en.md Comprehensive documentation for the `my_orders` API endpoint, which allows users to retrieve their trade orders. This section details the required HTTP method (POST), request headers for authentication, the structure of the JSON request body, and the expected format of a successful JSON response, including various attributes for each order. ```APIDOC Endpoint: POST /api/trade/my_orders Headers: API-ID: string (Your API ID. Example: bd443f00-092c-4436-92a4-a704ef679e24) API-SIGN: string (HMAC-SHA256 signature of 'method + request_body' using your API secret key. Example: f133d2e7a960a3db86052be6d4f7699313e9416bce557868e7ad0f026c67c9ca) Content-Type: application/json Request Body (application/json): { "ts": 1644398635534 (integer, timestamp in milliseconds) } Response 200 (application/json): { "success": true, (boolean, indicates if the request was successful) "items": { "36149941": { (object, key is order ID, value is order details) "id": "36149941", (string, unique order identifier) "date": 1643186519, (integer, Unix timestamp of order creation) "pair": "TRX_RUB", (string, trading pair, e.g., "TRX_RUB") "action": "buy", (string, "buy" or "sell") "type": "stop_limit", (string, order type, e.g., "limit", "stop_limit") "amount": "10.000000", (string, total amount of currency) "price": "5.00", (string, price per unit) "value": "50.00", (string, total value of the order) "amount_processed": "0.000000", (string, amount of currency processed) "amount_remaining": "10.000000", (string, remaining amount of currency) "value_processed": "0.00", (string, value processed) "value_remaining": "50.00", (string, remaining value) "stop_price": "4.30" (string, optional, stop price for stop-limit orders) }, "36150146": { ... }, "36989287": { ... }, "36989301": { ... }, "36989322": { ... }, "36995144": { ... } } } ``` -------------------------------- ### Payeer API: Get Transaction History (POST) Source: https://github.com/payeer/docs/blob/main/rest-api/en.md Retrieves a detailed history of transactions from the Payeer system. This endpoint allows users to query past transactions based on various criteria and requires specific authentication parameters. ```APIDOC Endpoint: /history (implied) Method: POST Request Headers: Content-Type: application/x-www-form-urlencoded Request Parameters (Body - form-urlencoded): - account (string): Your account number in the Payeer system. Example: P1000000 - apiId (integer): The API user’s ID; given out when adding the API. Example: 12345 - apiPass (string): The API user's secret key. Example: qwerty - action (string): Action type, must be 'history'. Optional Request Parameters (Body - form-urlencoded): - id (integer): transaction ID. Example: 197941397 - date (string): Date/time of creation in the format YYYY-MM-DD HH:MM:SS. Example: 2016-03-02 15:35:17 - type (string): transaction type. Values: transfer, deposit, withdrawal, sci. - status (string): transaction status. Values: success, processing, canceled, waiting, pending. - from (string): sender's account number. Example: P1000000, @anonum, @merchant, null - debitedAmount (float): amount withdrawn. Example: 1 - debitedCurrency (string): withdrawal currency. Values: USD, EUR, RUB - to (string): recipient's account number. Example: P1000001, @sms, null - creditedAmount (float): amount received. Example: 1 - creditedCurrency (string): deposit currency. Values: USD, EUR, RUB - payeerFee (float): Payeer’s fee. Example: 0.01 - gateFee (float): gateway fee. Example: 0.01 - comment (string): comments. Example: test - paySystem (string): name payment method. Example: Payeer - shopId (integer): merchant id. Example: 12345 - shopOrderId (integer): id invoice of merchant. Example: 123 - exchangeRate (float): exchange rate for auto-conversion. Example: 1 - protect (string): transaction protection for transfer. Values: Y, N - protectDay (string): number of days for protection. Values: 1-30, null - isApi (string): via API. Values: Y, N - shop (object): sci parameters. Fields: id (store id), domain (domain store), orderid (invoice id of store), description (description). - apiId (integer): API user ID the transaction was made through. Example: 12345 - referenceId (string): identification number in your accounting system. Example: 08d7f228-5a03-4dc7-b13a-7c14146df8f7 Request Body Example: account=P1000000&apiId=12345&apiPass=qwerty&action=history Response 200 (application/json): - auth_error (string): Authentication error code. '0' indicates success. - errors (array): List of errors, if any. - params (object): Additional parameters. - history (object): Object containing transaction history data. Response Body Example: {"auth_error":"0","errors":[],"params":{},"history":{}} ```