### Get Available Payment Systems Source: https://docs.freekassa.net/ Lists all available payment systems for a shop. Requires shopId, nonce, and a signature. ```json { "type": "success", "currencies": [ { "id": 4, "name": "VISA", "currency": "RUB", "is_enabled": 1, "is_favorite": 0 } ] } ``` -------------------------------- ### Create Order and Get Payment Link Source: https://docs.freekassa.net/ Creates a new order and returns a payment link. This is a POST request. ```APIDOC ## POST /api/create_order ### Description Creates a new order and returns a payment link. ### Method POST ### Endpoint /api/create_order ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Amount** (number) - Required - The amount of the order. - **Currency** (string) - Required - The currency of the order (e.g., RUB, USD, EUR). - **OrderID** (string) - Required - Your unique identifier for the order. - **Sign** (string) - Required - Signature of the request. - **Email** (string) - Optional - Customer's email address. - **Phone** (string) - Optional - Customer's phone number. - **PaymentSystem** (string) - Optional - The desired payment system. - **SuccessUrl** (string) - Optional - URL to redirect to upon successful payment. - **FailUrl** (string) - Optional - URL to redirect to upon failed payment. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Amount\": 100.50, \"Currency\": \"RUB\", \"OrderID\": \"ORDER789\", \"Sign\": \"REQUEST_SIGNATURE\", \"Email\": \"customer@example.com\"}" } ### Response #### Success Response (200) - **PaymentUrl** (string) - The URL for the customer to complete the payment. #### Response Example { "example": "{\"PaymentUrl\": \"https://pay.fk.money/?m=312&oa=1000&i=¤cy=RUB&em=&phone=&o=123&pay=PAY&s=e723c585cb601241c5bb5727efa16b08\"}" } ``` -------------------------------- ### Example Payment Notification Data Source: https://docs.freekassa.net/ This is an example of the form-data sent to your notification URL after a successful payment. It includes essential transaction details and custom parameters. ```text MERCHANT_ID=123&AMOUNT=100&intid=123456&MERCHANT_ORDER_ID=test_order&P_EMAIL=test_user@test_site.ru&P_PHONE=71231231212&CUR_ID=4&payer_account=123456xxxxxx1234&us_field1=123&us_field2=321&SIGN=68GH247bb77e0ab49f6e429b86bc3e2f ``` -------------------------------- ### Get List of Shops Source: https://docs.freekassa.net/ Retrieves a list of all shops associated with the account. Requires shopId, nonce, and a signature. ```json { "type": "success", "shops": [ { "id": 777, "name": "Рога и копыта", "url": "https://horns-and-hooves.ru" } ] } ``` -------------------------------- ### Get Your Stores Source: https://docs.freekassa.net/ Retrieves a list of your associated stores. This is a POST request. ```APIDOC ## POST /api/stores ### Description Retrieves a list of your associated stores. ### Method POST ### Endpoint /api/stores ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Sign** (string) - Required - Signature of the request. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Sign\": \"REQUEST_SIGNATURE\"}" } ### Response #### Success Response (200) - **Stores** (array) - An array of store objects. - **StoreID** (integer) - The unique identifier for the store. - **Name** (string) - The name of the store. - **Url** (string) - The URL of the store. #### Response Example { "example": "{\"Stores\": [{\"StoreID\": 123, \"Name\": \"My Online Store\", \"Url\": \"https://mystore.com\"}]}" } ``` -------------------------------- ### Get Shops Source: https://docs.freekassa.net/ Retrieves a list of all shops associated with the user account. Requires authentication with shop ID, nonce, and signature. ```APIDOC ## POST /shops ### Description Retrieves a list of all shops associated with the user account. ### Method POST ### Endpoint https://api.fk.life/v1/shops ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must always be greater than the previous value. - **signature** (string) - Required - Request signature. ### Responses #### Success Response (200) - **type** (string) - Indicates success. - **shops** (array) - An array of shop objects, each containing: - **id** (integer) - The shop ID. - **name** (string) - The name of the shop. - **url** (string) - The URL of the shop. #### Error Responses - **400** - Bad Request - **401** - Unauthorized ### Response Example (200) ```json { "type": "success", "shops": [ { "id": 777, "name": "Рога и копыта", "url": "https://horns-and-hooves.ru" } ] } ``` ``` -------------------------------- ### Get Available Payout Systems Source: https://docs.freekassa.net/ Retrieves a list of available payment systems for withdrawals. This is a POST request. ```APIDOC ## POST /api/payout_systems ### Description Retrieves a list of available payment systems for withdrawals. ### Method POST ### Endpoint /api/payout_systems ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Sign** (string) - Required - Signature of the request. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Sign\": \"REQUEST_SIGNATURE\"}" } ### Response #### Success Response (200) - **PayoutSystems** (array) - An array of payout system objects. - **SystemName** (string) - The name of the payout system. - **SystemAlias** (string) - An alias for the payout system. - **Currency** (string) - The currency supported by this payout system. #### Response Example { "example": "{\"PayoutSystems\": [{\"SystemName\": \"Visa/MasterCard\", \"SystemAlias\": \"BANKCARD\", \"Currency\": \"RUB\"}]}" } ``` -------------------------------- ### Get Available Payment Systems Source: https://docs.freekassa.net/ Retrieves a list of all available payment systems for making payments. This is a POST request. ```APIDOC ## POST /api/payment_systems ### Description Retrieves a list of all available payment systems for making payments. ### Method POST ### Endpoint /api/payment_systems ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Sign** (string) - Required - Signature of the request. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Sign\": \"REQUEST_SIGNATURE\"}" } ### Response #### Success Response (200) - **PaymentSystems** (array) - An array of payment system objects. - **SystemName** (string) - The name of the payment system. - **SystemAlias** (string) - An alias for the payment system. - **Currency** (string) - The currency supported by this payment system. #### Response Example { "example": "{\"PaymentSystems\": [{\"SystemName\": \"Visa/MasterCard\", \"SystemAlias\": \"BANKCARD\", \"Currency\": \"RUB\"}]}" } ``` -------------------------------- ### Create Order and Get Payment Link Source: https://docs.freekassa.net/ Creates a new order and generates a payment link. Requires 'shopId', 'nonce', 'signature', 'paymentId', 'i', 'email', 'ip', 'amount', and 'currency'. Additional fields may be required based on the 'getCurrencies' request. ```json { "type": "success", "orderId": 123, "orderHash": "bd4161db429848651499aabcb1d89330", "location": "https://pay.freekassa.net/form/123/bd4161db429848651499aabcb1d89330" } ``` -------------------------------- ### Create Order and Get Payment Link Source: https://docs.freekassa.net/ Creates a new order and generates a payment link. Requires essential payment details and supports optional fields for customization like success/failure URLs and recurrent payments. ```APIDOC ## POST /v1/orders/create ### Description Creates a new order and provides a link to the payment form. Supports additional fields for customization. ### Method POST ### Endpoint https://api.fk.life/v1/orders/create ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must be greater than the previous value. - **signature** (string) - Required - Request signature. - **paymentId** (string) - Optional - Your store's order number. - **i** (integer) - Required - Payment system ID. - **email** (string) - Required - Customer's email address. - **ip** (string) - Required - Customer's IP address. - **amount** (numeric) - Required - Payment amount. - **currency** (string) - Required - Payment currency. - **tel** (string) - Optional - Customer's phone number. - **success_url** (string) - Optional - Override success URL. - **failure_url** (string) - Optional - Override failure URL. - **notification_url** (string) - Optional - Override notification URL. - **recurrent** (string) - Optional - Flag for recurrent payment ('Y'). - **recurrent_period** (string) - Optional - Recurrent payment period (day, week, month, year). - **recurrent_description** (string) - Optional - Description for recurrent payment (10-200 characters). - **recurrent_order_id** (numeric) - Optional - ID for recurring payment. ### Responses #### Success Response (200) - **type** (string) - Indicates success. - **orderId** (integer) - The created order ID. - **orderHash** (string) - Hash of the created order. - **location** (string) - URL to the payment form. #### Error Responses - **400** - Bad Request - **401** - Unauthorized ### Request Example ```json { "shopId": 777, "nonce": 123456789, "signature": "190f3e3b87275da51031223a010e6da6", "paymentId": "987654321", "i": 6, "email": "user@site.ru", "ip": "85.8.8.8", "amount": 100.23, "currency": "RUB" } ``` ### Response Example (200) ```json { "type": "success", "orderId": 123, "orderHash": "bd4161db429848651499aabcb1d89330", "location": "https://pay.freekassa.net/form/123/bd4161db429848651499aabcb1d89330" } ``` ``` -------------------------------- ### Get Shop Balance Source: https://docs.freekassa.net/ Retrieves the current balance of a shop. Requires shopId, nonce, and a signature for authentication. ```json { "type": "success", "balance": [ { "currency": "RUB", "value": 743.43 } ] } ``` -------------------------------- ### Get Payment Systems Source: https://docs.freekassa.net/ Retrieves a list of available payment systems for deposits. Requires authentication with shop ID, nonce, and signature. ```APIDOC ## POST /currencies ### Description Retrieves a list of available payment systems for deposits. ### Method POST ### Endpoint https://api.fk.life/v1/currencies ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must always be greater than the previous value. - **signature** (string) - Required - Request signature. ### Responses #### Success Response (200) - **type** (string) - Indicates success. - **currencies** (array) - An array of currency objects, each containing: - **id** (integer) - The payment system ID. - **name** (string) - The name of the payment system (e.g., VISA). - **currency** (string) - The currency code (e.g., RUB). - **is_enabled** (integer) - Indicates if the system is enabled (1) or not (0). - **is_favorite** (integer) - Indicates if the system is a favorite (1) or not (0). #### Error Responses - **400** - Bad Request - **401** - Unauthorized ### Response Example (200) ```json { "type": "success", "currencies": [ { "id": 4, "name": "VISA", "currency": "RUB", "is_enabled": 1, "is_favorite": 0 } ] } ``` ``` -------------------------------- ### Get Balance Source: https://docs.freekassa.net/ Retrieves the current account balance. This is a POST request. ```APIDOC ## POST /api/balance ### Description Retrieves the current account balance. ### Method POST ### Endpoint /api/balance ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Sign** (string) - Required - Signature of the request. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Sign\": \"REQUEST_SIGNATURE\"}" } ### Response #### Success Response (200) - **Balance** (number) - The current available balance. - **Currency** (string) - The currency of the balance. #### Response Example { "example": "{\"Balance\": 1500.50, \"Currency\": \"RUB\"}" } ``` -------------------------------- ### Get Balance Source: https://docs.freekassa.net/ Retrieves the current balance for a given shop ID. Requires authentication with a shop ID, nonce, and signature. ```APIDOC ## POST /balance ### Description Retrieves the current balance for a given shop ID. ### Method POST ### Endpoint https://api.fk.life/v1/balance ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must always be greater than the previous value. - **signature** (string) - Required - Request signature. ### Responses #### Success Response (200) - **type** (string) - Indicates success. - **balance** (array) - An array of balance objects, each containing: - **currency** (string) - The currency code (e.g., RUB). - **value** (number) - The balance amount. #### Error Responses - **400** - Bad Request - **401** - Unauthorized ### Response Example (200) ```json { "type": "success", "balance": [ { "currency": "RUB", "value": 743.43 } ] } ``` ``` -------------------------------- ### Get Withdrawal Currencies Source: https://docs.freekassa.net/ Retrieves a list of available payment systems for withdrawals. Requires authentication with shop ID, nonce, and signature. ```APIDOC ## POST /withdrawals/currencies ### Description Retrieves a list of available payment systems for withdrawals. ### Method POST ### Endpoint https://api.fk.life/v1/withdrawals/currencies ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must always be greater than the previous value. - **signature** (string) - Required - Request signature. ### Responses #### Success Response (200) - **type** (string) - Indicates success. - **currencies** (array) - An array of currency objects, each containing: - **id** (integer) - The payment system ID. - **name** (string) - The name of the payment system (e.g., VISA). - **min** (number) - The minimum withdrawal amount. - **max** (number) - The maximum withdrawal amount. - **currency** (string) - The currency code (e.g., RUB). - **can_exchange** (integer) - Indicates if exchange is possible (1) or not (0). #### Error Responses - **400** - Bad Request - **401** - Unauthorized ### Response Example (200) ```json { "type": "success", "currencies": [ { "id": 4, "name": "VISA", "min": 100, "max": 15000, "currency": "RUB", "can_exchange": 1 } ] } ``` ``` -------------------------------- ### Get Available Withdrawal Payment Systems Source: https://docs.freekassa.net/ Retrieves a list of payment systems available for withdrawals. Requires shopId, nonce, and a signature. ```json { "type": "success", "currencies": [ { "id": 4, "name": "VISA", "min": 100, "max": 15000, "currency": "RUB", "can_exchange": 1 } ] } ``` -------------------------------- ### Create Recurring Payment Parameters Source: https://docs.freekassa.net/ To set up a recurring payment, include these parameters in the order creation request. The response will contain details for future recurring payments. ```json recurrent:"Y" recurrent_period:"month" recurrent_description:"Подписка на VPN" ``` -------------------------------- ### Create Withdrawal Response Sample Source: https://docs.freekassa.net/ This is a sample JSON response for a successful request to create a withdrawal. It returns the ID of the newly created withdrawal. ```json { "type": "success", "data": { "id": 185 } } ``` -------------------------------- ### List Withdrawals Response Sample Source: https://docs.freekassa.net/ This is a sample JSON response for a successful request to list withdrawals. It includes pagination information and a list of withdrawal orders. ```json { "type": "success", "pages": 12, "orders": [ { "id": 546, "amount": 100.12, "currency": "RUB", "ext_currency_id": 4, "account": "5555555555554444", "date": "2021-03-29 12:28:24", "status": 1 } ] } ``` -------------------------------- ### Generate Notification Script Signature (PHP) Source: https://docs.freekassa.net/ Create an MD5 hash for verifying incoming payment notifications. The signature is based on Merchant ID, Amount, Secret Word 2, and Merchant Order ID. ```php md5($_REQUEST['MERCHANT_ID'].':'.$_REQUEST['AMOUNT'].':secret2:'.$_REQUEST['MERCHANT_ORDER_ID']) ``` -------------------------------- ### Generate Payment Form Signature (PHP) Source: https://docs.freekassa.net/ Use this MD5 hash to sign payment form data. Ensure the order of parameters matches the documentation: Merchant ID, Payment Amount, Secret Word, Currency, Order ID. ```php md5('7012:100.11:secret:RUB:154') ``` ```php
'>
``` -------------------------------- ### Create Order API Source: https://docs.freekassa.net/ Creates a new order. Supports creating recurring orders with additional parameters. ```APIDOC ## POST /orders/create ### Description Creates a new order. Can be used to set up recurring payments. ### Method POST ### Endpoint https://api.fk.life/v1/orders/create ### Parameters #### Request Body - **shopId** (integer) - Required - Your shop ID. - **order_id** (string) - Required - Your unique order ID. - **amount** (float) - Required - The order amount. - **currency** (string) - Required - The currency of the order (e.g., 'RUB', 'USD'). - **description** (string) - Required - A description of the order. - **email** (string) - Optional - Customer's email address. - **phone** (string) - Optional - Customer's phone number. - **payment_system** (string) - Optional - The payment system to use. - **notification_url** (string) - Optional - URL to receive payment notifications. - **success_url** (string) - Optional - URL to redirect after successful payment. - **fail_url** (string) - Optional - URL to redirect after failed payment. - **recurrent** (string) - Optional - Set to 'Y' to enable recurring payments. - **recurrent_period** (string) - Optional - The period for recurring payments (e.g., 'day', 'week', 'month', 'year'). - **recurrent_description** (string) - Optional - A description for the recurring payment. - **recurrent_order_id** (integer) - Optional - The ID of a recurring order to be paid again. - **nonce** (integer) - Required - A unique number, typically the current timestamp. - **signature** (string) - Required - The signature generated for the request. ### Request Example ```json { "shopId": 777, "order_id": "order_123", "amount": 100.50, "currency": "RUB", "description": "Test Order", "recurrent": "Y", "recurrent_period": "month", "recurrent_description": "Monthly Subscription", "nonce": 1678886400, "signature": "generated_signature" } ``` ### Response #### Success Response (200) - **id** (integer) - The unique ID of the created order. - **status** (integer) - The status of the order. - **amount** (float) - The order amount. - **currency** (string) - The order currency. - **recurrent_order** (object) - Information about the recurring order, if created. - **id** (integer) - The ID of the recurring order. - **pay_date_at** (string) - The date and time for the next recurring payment. #### Response Example ```json { "id": 12345, "status": 0, "amount": 100.50, "currency": "RUB", "recurrent_order": { "id": 6789, "pay_date_at": "2023-10-27 10:00:00" } } ``` ``` -------------------------------- ### List Orders Source: https://docs.freekassa.net/ Retrieves a list of orders based on specified query parameters. Ensure 'shopId', 'nonce', and 'signature' are provided. ```json { "type": "success", "pages": 12, "orders": [ { "merchant_order_id": "Order #123", "fk_order_id": 652367, "amount": 100.12, "currency": "RUB", "email": "user@site.ru", "account": "5555555555554444", "date": "2021-03-29 12:28:24", "status": 1 } ] } ``` -------------------------------- ### List Orders Source: https://docs.freekassa.net/ Retrieves a list of orders. This is a POST request. ```APIDOC ## POST /api/orders ### Description Retrieves a list of orders. ### Method POST ### Endpoint /api/orders ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Sign** (string) - Required - Signature of the request. - **DateFrom** (string) - Optional - Start date for filtering orders (YYYY-MM-DD). - **DateTo** (string) - Optional - End date for filtering orders (YYYY-MM-DD). - **Limit** (integer) - Optional - Number of orders to retrieve per page. - **Offset** (integer) - Optional - Number of orders to skip. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Sign\": \"REQUEST_SIGNATURE\", \"DateFrom\": \"2023-01-01\", \"Limit\": 10}" } ### Response #### Success Response (200) - **Total** (integer) - Total number of orders. - **Orders** (array) - Array of order objects. - **OrderID** (string) - Unique identifier for the order. - **Amount** (number) - The amount of the order. - **Currency** (string) - The currency of the order. - **Status** (string) - The current status of the order. - **DateCreate** (string) - The date and time the order was created. #### Response Example { "example": "{\"Total\": 100, \"Orders\": [{\"OrderID\": \"12345\", \"Amount\": 100.50, \"Currency\": \"RUB\", \"Status\": \"paid\", \"DateCreate\": \"2023-10-27 10:00:00\"}]}" } ``` -------------------------------- ### Check Payment System Availability Source: https://docs.freekassa.net/ Verifies if a specific payment system is available for transactions. Requires shopId, nonce, and a signature. ```json { "type": "success" } ``` -------------------------------- ### Process Refund Source: https://docs.freekassa.net/ Initiates a refund for a specified order. Requires 'shopId', 'nonce', and 'signature'. 'orderId' or 'paymentId' must be provided to identify the transaction. ```json { "type": "success", "id": 123 } ``` -------------------------------- ### Create Withdrawal Source: https://docs.freekassa.net/ Initiates a new withdrawal request. ```APIDOC ## POST /withdrawals/create ### Description Initiates a new withdrawal request. ### Method POST ### Endpoint https://api.fk.life/v1/withdrawals/create ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must be greater than the previous value. - **signature** (string) - Required - Request signature. - **paymentId** (string) - Optional - Order number in your store. - **i** (integer) - Required - Payment system ID. - **account** (string) - Required - Account for crediting funds. - **amount** (numeric) - Required - Payment amount. - **currency** (string) - Required - Payment currency. ### Response #### Success Response (200) - **type** (string) - Indicates the success of the operation. - **data** (object) - Contains data related to the withdrawal. - **id** (integer) - The ID of the created withdrawal. #### Response Example (200) ```json { "type": "success", "data": { "id": 185 } } ``` #### Error Responses - **400** - Bad Request - **401** - Unauthorized ``` -------------------------------- ### Check Payment System Availability Source: https://docs.freekassa.net/ Checks if a specific payment system is available for a given amount and currency. This is a POST request. ```APIDOC ## POST /api/check_payment_system ### Description Checks if a specific payment system is available for a given amount and currency. ### Method POST ### Endpoint /api/check_payment_system ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Amount** (number) - Required - The amount to check. - **Currency** (string) - Required - The currency of the amount. - **PaymentSystem** (string) - Required - The alias of the payment system to check. - **Sign** (string) - Required - Signature of the request. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Amount\": 100.00, \"Currency\": \"RUB\", \"PaymentSystem\": \"BANKCARD\", \"Sign\": \"REQUEST_SIGNATURE\"}" } ### Response #### Success Response (200) - **Available** (boolean) - True if the payment system is available for the given parameters, false otherwise. #### Response Example { "example": "{\"Available\": true}" } ``` -------------------------------- ### Create Payout Source: https://docs.freekassa.net/ Creates a new payout. This is a POST request. ```APIDOC ## POST /api/create_payout ### Description Creates a new payout. ### Method POST ### Endpoint /api/create_payout ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Amount** (number) - Required - The amount to payout. - **Currency** (string) - Required - The currency of the payout. - **PaymentSystem** (string) - Required - The payout method (e.g., 'BANKCARD', 'QIWI'). - **Account** (string) - Required - The account details for the payout (e.g., card number, phone number). - **Sign** (string) - Required - Signature of the request. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Amount\": 150.75, \"Currency\": \"RUB\", \"PaymentSystem\": \"BANKCARD\", \"Account\": \"1234567890123456\", \"Sign\": \"REQUEST_SIGNATURE\"}" } ### Response #### Success Response (200) - **PayoutID** (string) - The unique identifier for the created payout. - **Status** (string) - The status of the payout request. #### Response Example { "example": "{\"PayoutID\": \"P1002\", \"Status\": \"processing\"}" } ``` -------------------------------- ### Balance API Source: https://docs.freekassa.net/ Retrieves the current balance of the account. Requires a signature for authentication. ```APIDOC ## GET /balance ### Description Retrieves the current account balance. ### Method GET ### Endpoint https://api.fk.life/v1/balance ### Parameters #### Query Parameters - **shopId** (integer) - Required - Your shop ID. - **nonce** (integer) - Required - A unique number, typically the current timestamp. - **signature** (string) - Required - The signature generated for the request. ### Request Example ```json { "shopId": 777, "nonce": 1678886400, "signature": "generated_signature" } ``` ### Response #### Success Response (200) - **balance** (float) - The current account balance. #### Response Example ```json { "balance": 1234.56 } ``` ``` -------------------------------- ### Refund Order Source: https://docs.freekassa.net/ Initiates a refund for a specific order. This is a POST request. ```APIDOC ## POST /api/refund ### Description Initiates a refund for a specific order. ### Method POST ### Endpoint /api/refund ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **OrderID** (string) - Required - The ID of the order to refund. - **Amount** (number) - Optional - The amount to refund. If not specified, the full order amount will be refunded. - **Sign** (string) - Required - Signature of the request. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"OrderID\": \"ORDER123\", \"Amount\": 50.00, \"Sign\": \"REQUEST_SIGNATURE\"}" } ### Response #### Success Response (200) - **Status** (string) - Indicates if the refund request was successful (e.g., 'success'). - **Message** (string) - A message describing the result of the refund request. #### Response Example { "example": "{\"Status\": \"success\", \"Message\": \"Refund initiated successfully.\"}" } ``` -------------------------------- ### List Payouts Source: https://docs.freekassa.net/ Retrieves a list of payouts. This is a POST request. ```APIDOC ## POST /api/payouts ### Description Retrieves a list of payouts. ### Method POST ### Endpoint /api/payouts ### Parameters #### Request Body - **Key** (string) - Required - Your API key. - **Sign** (string) - Required - Signature of the request. - **DateFrom** (string) - Optional - Start date for filtering payouts (YYYY-MM-DD). - **DateTo** (string) - Optional - End date for filtering payouts (YYYY-MM-DD). - **Limit** (integer) - Optional - Number of payouts to retrieve per page. - **Offset** (integer) - Optional - Number of payouts to skip. ### Request Example { "example": "{\"Key\": \"YOUR_API_KEY\", \"Sign\": \"REQUEST_SIGNATURE\", \"DateFrom\": \"2023-01-01\", \"Limit\": 10}" } ### Response #### Success Response (200) - **Total** (integer) - Total number of payouts. - **Payouts** (array) - Array of payout objects. - **PayoutID** (string) - Unique identifier for the payout. - **Amount** (number) - The amount of the payout. - **Currency** (string) - The currency of the payout. - **Status** (string) - The current status of the payout. - **DateCreate** (string) - The date and time the payout was created. #### Response Example { "example": "{\"Total\": 50, \"Payouts\": [{\"PayoutID\": \"P1001\", \"Amount\": 200.00, \"Currency\": \"RUB\", \"Status\": \"completed\", \"DateCreate\": \"2023-10-26 15:30:00\"}]}" } ``` -------------------------------- ### Sign API Requests with SHA256 HMAC Source: https://docs.freekassa.net/ This PHP snippet demonstrates how to generate a signature for API requests by sorting parameters, concatenating their values with '|', and then hashing the result using SHA256 with your API key. It also shows how to send the signed request using cURL. ```php 777, 'nonce'=>time(), ]; ksort($data); $sign = hash_hmac('sha256', implode('|', $data), $api_key); $data['signature'] = $sign; $request = json_encode($data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.fk.life/v1/balance'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); $result = trim(curl_exec($ch)); curl_close($ch); $response = json_decode($result, true); ``` -------------------------------- ### List Orders Source: https://docs.freekassa.net/ Retrieves a list of orders based on specified query parameters. Supports filtering by shop ID, order ID, payment ID, status, and date range, with pagination. ```APIDOC ## POST /v1/orders ### Description Retrieves a list of orders with filtering and pagination capabilities. ### Method POST ### Endpoint https://api.fk.life/v1/orders ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must be greater than the previous value. - **signature** (string) - Required - Request signature. - **orderId** (integer) - Optional - Freekassa order number. - **paymentId** (string) - Optional - Your store's order number. - **orderStatus** (integer) - Optional - Order status. - **dateFrom** (string) - Optional - Start date for filtering (YYYY-MM-DD HH:MM:SS). - **dateTo** (string) - Optional - End date for filtering (YYYY-MM-DD HH:MM:SS). - **page** (integer) - Optional - Page number for pagination. ### Responses #### Success Response (200) - **type** (string) - Indicates success. - **pages** (integer) - Total number of pages available. - **orders** (array) - An array of order objects. - **merchant_order_id** (string) - Your order ID. - **fk_order_id** (integer) - Freekassa order ID. - **amount** (numeric) - Order amount. - **currency** (string) - Order currency. - **email** (string) - Customer email. - **account** (string) - Payment account. - **date** (string) - Order date and time. - **status** (integer) - Order status. #### Error Responses - **400** - Bad Request - **401** - Unauthorized ### Request Example ```json { "shopId": 777, "nonce": 123456789, "signature": "190f3e3b87275da51031223a010e6da6", "orderId": 123456789 } ``` ### Response Example (200) ```json { "type": "success", "pages": 12, "orders": [ { "merchant_order_id": "Order #123", "fk_order_id": 652367, "amount": 100.12, "currency": "RUB", "email": "user@site.ru", "account": "5555555555554444", "date": "2021-03-29 12:28:24", "status": 1 } ] } ``` ``` -------------------------------- ### PHP Payment Handler with IP and Signature Verification Source: https://docs.freekassa.net/ This PHP script processes payment notifications. It includes IP address verification and checks the payment signature to ensure the notification's authenticity before confirming the order. ```php $merchant_id = '177'; $merchant_secret = 'supersecret'; function getIP() { if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; return $_SERVER['REMOTE_ADDR']; } if (!in_array(getIP(), array('168.119.157.136', '168.119.60.227', '178.154.197.79', '51.250.54.238'))) die("hacking attempt!"); $sign = md5($merchant_id.':'.$_REQUEST['AMOUNT'].':'.$merchant_secret.':'.$_REQUEST['MERCHANT_ORDER_ID']); if ($sign != $_REQUEST['SIGN']) die('wrong sign'); //Так же, рекомендуется добавить проверку на сумму платежа и не была ли эта заявка уже оплачена или отменена //Оплата прошла успешно, можно проводить операцию. die('YES'); ``` -------------------------------- ### Check Payment System Status Source: https://docs.freekassa.net/ Checks the availability status of a specific payment system for making payments. Requires authentication with shop ID, nonce, and signature. ```APIDOC ## POST /currencies/{id}/status ### Description Checks the availability status of a specific payment system for making payments. ### Method POST ### Endpoint https://api.fk.life/v1/currencies/{id}/status ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the payment system. #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must always be greater than the previous value. - **signature** (string) - Required - Request signature. ### Responses #### Success Response (200) - **type** (string) - Indicates success. #### Error Responses - **400** - Bad Request - **401** - Unauthorized ### Response Example (200) ```json { "type": "success" } ``` ``` -------------------------------- ### Refund Order Source: https://docs.freekassa.net/ Initiates a refund for a specified order. Requires the order ID (Freekassa or your store's) and authentication parameters. ```APIDOC ## POST /v1/orders/refund ### Description Processes a refund for a given order. ### Method POST ### Endpoint https://api.fk.life/v1/orders/refund ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must be greater than the previous value. - **signature** (string) - Required - Request signature. - **orderId** (integer) - Optional - Freekassa order number. - **paymentId** (string) - Optional - Your store's order number. ### Responses #### Success Response (200) - **type** (string) - Indicates success. - **id** (integer) - The ID of the refund transaction. #### Error Responses - **400** - Bad Request - **401** - Unauthorized ### Request Example ```json { "shopId": 777, "nonce": 123456789, "signature": "190f3e3b87275da51031223a010e6da6", "orderId": 123456789 } ``` ### Response Example (200) ```json { "type": "success", "id": 123 } ``` ``` -------------------------------- ### PHP IP Verification Function Source: https://docs.freekassa.net/ This PHP function retrieves the real IP address of the client. It's used to verify that the incoming payment notification is from a trusted Free-Kassa server IP. ```php function getIP() { if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; return $_SERVER['REMOTE_ADDR']; } if (!in_array(getIP(), array('168.119.157.136', '168.119.60.227', '178.154.197.79', '51.250.54.238'))) die("hacking attempt!"); ``` -------------------------------- ### List Withdrawals Source: https://docs.freekassa.net/ Retrieves a list of withdrawals with filtering options. ```APIDOC ## GET /withdrawals ### Description Retrieves a list of withdrawals with filtering options. ### Method GET ### Endpoint https://api.fk.life/v1/withdrawals ### Parameters #### Query Parameters - **shopId** (integer) - Required - ID of the shop. - **nonce** (integer) - Required - Unique request ID, must be greater than the previous value. - **signature** (string) - Required - Request signature. - **orderId** (integer) - Optional - Freekassa order number. - **paymentId** (string) - Optional - Order number in your store. - **orderStatus** (integer) - Optional - Order status. - **dateFrom** (string) - Optional - Start date for filtering. - **dateTo** (string) - Optional - End date for filtering. - **page** (integer) - Optional - Page number for pagination. ### Response #### Success Response (200) - **type** (string) - Indicates the success of the operation. - **pages** (integer) - Total number of pages available. - **orders** (array) - An array of withdrawal orders. - **id** (integer) - Withdrawal ID. - **amount** (numeric) - Withdrawal amount. - **currency** (string) - Withdrawal currency. - **ext_currency_id** (integer) - External currency ID. - **account** (string) - Account number for the withdrawal. - **date** (string) - Date and time of the withdrawal. - **status** (integer) - Status of the withdrawal. #### Response Example (200) ```json { "type": "success", "pages": 12, "orders": [ { "id": 546, "amount": 100.12, "currency": "RUB", "ext_currency_id": 4, "account": "5555555555554444", "date": "2021-03-29 12:28:24", "status": 1 } ] } ``` #### Error Responses - **400** - Bad Request - **401** - Unauthorized ``` -------------------------------- ### Recurring Payment Response Details Source: https://docs.freekassa.net/ The response for a recurring payment includes the ID and next payment date, which are essential for subsequent recurring charges. ```json recurrent_order->id - номер рекуррентного платежа для повторной оплаты recurrent_order->pay_date_at - дата и время для повторной оплаты ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.