# FokawaPay

**Common Uses for FokawaPay:** Webmasters, Freelancers, Webcam Models, Developers, Independent Contractors, Advertising Networks, Affiliate Programs, Live Streaming Networks, Freelance Companies, Hosting Providers, Billing and Payment Processors, Webcam Studios, iGaming Sites & Others.

**FokawaPay** offers instant crypto transfers from your Fokawa.com balance to merchant wallets. To apply, please contact <support@fokawa.com>.

## Integrations

[API](#fokawa-payments-guidelines)

[Woocomerce](https://github.com/fokawadev/payments-fokawa-woocomerce)

Shopify  (Coming Soon)

Drupal  (Coming Soon)

Zapier  (Coming Soon)

OpenCart  (Coming Soon)

WHMCS  (Coming Soon)

Prestashop  (Coming Soon)

Joomla Virtuemart  (Coming Soon)

Magento  (Coming Soon)

Smartstore  (Coming Soon)

Nopcommerce  (Coming Soon)

XenForo  (Coming Soon)

Invoice Ninja  (Coming Soon)

## Fokawa API Payment Guidelines

Simplify the payment experience by allowing your customers to use their Fokawa account to pay for the products and services.

#### Payment Error Code <a href="#payment-error-code" id="payment-error-code"></a>

| Error Code | Description                          |
| ---------- | ------------------------------------ |
| 0          | success                              |
| 1          | Invalid signature                    |
| 2          | Invalid or inactive merchant\_id     |
| 3          | Failed to store payment data         |
| 4          | Missing parameter: {parameter\_name} |
| 5          | Invalid Amount                       |
| 6          | Method not allowed                   |
| 7          | Unsupported Currency                 |
| 8          | Unsupported or Invalid Coin          |
| 9          | Unrecognized IP Address              |

## Payments

Fokawa Payments is a secure and efficient cryptocurrency payment gateway that allows merchants to accept crypto payments from customers.

#### **One-time Wallet Payments** <a href="#one-time-wallet-payments" id="one-time-wallet-payments"></a>

<figure><img src="https://1804760666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBEVVF4Y1m1XHozg7nzsl%2Fuploads%2FORfT1wktutij8euF7SzH%2Fimage.png?alt=media&#x26;token=4d52cd28-7bd6-4fa1-9f95-2a807664ceaa" alt=""><figcaption><p>How it Works?</p></figcaption></figure>

#### Endpoint <a href="#endpoint" id="endpoint"></a>

<mark style="color:green;">`POST`</mark> `/`[`https://payments.fokawa.com/apiv2/payment`](https://payments.fokawa.com/apiv2/)

#### Payload <a href="#payload" id="payload"></a>

Request Payload

| Field             | Type    | Description                                                                                                                                                                                             |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| order\_id         | string  | Unique identifier for the order.                                                                                                                                                                        |
| amount            | decimal | The total amount is based on the preferred currency to be paid by the consumer.                                                                                                                         |
| currency\_code    | string  | A currency code is a three-letter code used to identify a specific currency (PHP, JPY, EUR, etc.). <https://payments.fokawa.com/apiv2/currencycodes/>                                                   |
| merchant\_id      | string  | Unique identifier assigned to the merchant by Fokawa.                                                                                                                                                   |
| return\_url       | string  | URL to which the consumer will be redirected after payment completion.                                                                                                                                  |
| notification\_url | string  | URL where the payment gateway will send payment notifications.                                                                                                                                          |
| payCoinSymbol     | string  | Symbol of the cryptocurrency to be used for the payment (e.g., fkwt, btc, usdt, etc). <https://payments.fokawa.com/apiv2/coinlist/>                                                                     |
| date\_created     | string  | A timestamp indicating when the payment request was created is formatted as 'YYYY-MM-DD HH:MM:SS '.                                                                                                     |
| email             | string  | Email address of the consumer.                                                                                                                                                                          |
| signature         | string  | <p>HMAC-SHA256 signature to verify the authenticity of the request. Generated using a secret key.</p><p>Ex.</p><p>signature = hash\_hmac('sha256', merchant\_id + json\_payload + merchant\_secret)</p> |

The request payload should be a JSON object containing the following fields:

```
{
    "order_id": "string",
    "amount": "decimal",
    "currency_code":"string",
    "merchant_id": "string",
    "return_url": "string",
    "notification_url": "string",
    "payCoinSymbol": "string",
    "date_created": "string",
    "email": "string",
    "signature": "string"
}
```

Example Implementation

{% tabs %}
{% tab title="PHP" %}

```
<?php 
$secret         = 'dz3WhB9z7JpYdkRzjvJt';
$merchant_id    = 'demo';
$api_url        = 'https://payments.fokawa.com/apiv2/payment/';

$data = [ 
    "order_id"          => "orderId-" . uniqid(),
    "amount"            => "200",
    "currency_code"     => "PHP",
    "merchant_id"       => $merchant_id,
    "return_url"        => "https://www.google.com/",
    "notification_url"  => "https://www.google.com/",
    "payCoinSymbol"     => "tether",
    "date_created"      => date('Y-m-d H:i:s'),  
    "email"             => "yahoo@gmail.com"
];

function generate_signature($merchant_id, $json_payload, $secret) {
    $message = $merchant_id . $json_payload . $secret;
    return hash_hmac('sha256', $message, $secret);
}

 $data['signature'] = hash_hmac('sha256', $merchant_id . json_encode($data, JSON_UNESCAPED_SLASHES) . $secret, $secret); 
 
$ch = curl_init($api_url);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

// Execute the request
$response = curl_exec($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// Handle the response
if ($http_status === 200) {
    $response_data = json_decode($response, true);
    if (isset($response_data['payment_url'])) {
        header('Location: ' . $response_data['payment_url']);
        exit;
    } else {
        echo 'Error: Payment URL not found in the response.';
    }
} else {
    echo 'Error: Failed to connect to the payment gateway.';
    echo 'HTTP Status: ' . $http_status;
    echo 'Response: ' . $response;
} 
```

{% endtab %}

{% tab title="Python" %}

```
import hashlib
import hmac
import json
import requests
from datetime import datetime
import uuid

# Configuration variables
secret = 'dz3WhB9z7JpYdkRzjvJt'
merchant_id = 'demo'
api_url = 'https://payments.fokawa.com/apiv2/payment/'

# Payload data
data = {
    "order_id": f"orderId-{uuid.uuid4()}",
    "amount": "200",
    "currency_code": "PHP",
    "merchant_id": merchant_id,
    "return_url": "https://www.google.com/",
    "notification_url": "https://www.google.com/",
    "payCoinSymbol": "tether",
    "date_created": datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
    "email": "yahoo@gmail.com"
}

# Function to generate signature
def generate_signature(merchant_id, json_payload, secret):
    message = merchant_id + json_payload + secret
    return hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest()

# Generate signature and add to payload
data['signature'] = generate_signature(merchant_id, json.dumps(data, separators=(',', ':')), secret)

# Make the HTTP POST request
headers = {
    'Content-Type': 'application/json'
}
response = requests.post(api_url, headers=headers, data=json.dumps(data))

# Handle the response
if response.status_code == 200:
    response_data = response.json()
    if 'payment_url' in response_data:
        print(f"Redirecting to: {response_data['payment_url']}")
        # In a real web app, you would redirect the user to the payment URL
    else:
        print('Error: Payment URL not found in the response.')
else:
    print('Error: Failed to connect to the payment gateway.')
    print('HTTP Status:', response.status_code)
    print('Response:', response.text)

```

{% endtab %}

{% tab title="Javascript" %}

```
const secret = 'dz3WhB9z7JpYdkRzjvJt';
const merchant_id = 'demo';
const api_url = 'https://payments.fokawa.com/apiv2/payment/';

// Generate order ID and current date
const order_id = `orderId-${Date.now()}`;
const date_created = new Date().toISOString().slice(0, 19).replace('T', ' ');

// Payload data
const data = {
    order_id: order_id,
    amount: "200",
    currency_code: "PHP",
    merchant_id: merchant_id,
    return_url: "https://www.google.com/",
    notification_url: "https://www.google.com/",
    payCoinSymbol: "tether",
    date_created: date_created,
    email: "yahoo@gmail.com"
};

// Function to generate HMAC SHA256 signature
function generateSignature(merchant_id, json_payload, secret) {
    const message = merchant_id + json_payload + secret;
    return CryptoJS.HmacSHA256(message, secret).toString(CryptoJS.enc.Hex);
}

// Generate signature and add to payload
data.signature = generateSignature(merchant_id, JSON.stringify(data, null, 0), secret);

// Function to make the HTTP POST request
async function makePaymentRequest(api_url, data) {
    const response = await fetch(api_url, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(data)
    });

    if (response.ok) {
        const responseData = await response.json();
        if (responseData.payment_url) {
            window.location.href = responseData.payment_url;
        } else {
            console.error('Error: Payment URL not found in the response.');
        }
    } else {
        console.error('Error: Failed to connect to the payment gateway.');
        console.error('HTTP Status:', response.status);
        const responseText = await response.text();
        console.error('Response:', responseText);
    }
}

// Make the payment request
makePaymentRequest(api_url, data);

```

{% endtab %}
{% endtabs %}

#### **Response** <a href="#response" id="response"></a>

**Response Payload**

The response payload will be a JSON object containing the following fields:

| Field        | Type   | Description                                                             |
| ------------ | ------ | ----------------------------------------------------------------------- |
| order\_id    | string | Unique identifier for the order. Matches the `order_id` in the request. |
| payment\_url | string | URL where the consumer can complete the payment.                        |
| payment\_id  | string | Unique identifier for the payment transaction.                          |

## Payment Callback

This API documentation describes the process of sending a callback to a merchant's notification URL after processing a payment.&#x20;

### Endpoint

**POST**: `{notification_url}`

### Request Headers

* `Content-Type: application/json`

### Request Body

The request body is a JSON object containing the following fields:

```
{
  "orderStatus": "{status}",
  "orderNum": "{orderNum}",
  "order_id": "{order_id}",
  "currency_amount":"{currency_amount}",
  "currency_code":"{currency_code}",
  "payAmount": "{payAmount}",
  "coin": "{coin}",
  "sign": "{sign}"
}
```

**Parameters**

<table><thead><tr><th width="203">Param</th><th width="94">Type</th><th>Description</th></tr></thead><tbody><tr><td>orderStatus</td><td>string</td><td>The status of the order, which is always <code>"PAID"</code> for successful payments.</td></tr><tr><td>orderNum</td><td>string</td><td>The unique identifier for the order provided by the payment processor.</td></tr><tr><td>order_id</td><td>string</td><td>The unique identifier for the order provided by the merchant.</td></tr><tr><td>currency_amount</td><td>string</td><td>The total amount paid by the consumer.</td></tr><tr><td>currency_code</td><td>string</td><td>A currency code is a three-letter code used to identify a specific currency (PHP, JPY, EUR, etc.).  <a href="https://payments.fokawa.com/apiv2/currencycodes/">https://payments.fokawa.com/apiv2/currencycodes/</a></td></tr><tr><td>payAmount</td><td>string</td><td>The amount paid in the transaction.</td></tr><tr><td>coin</td><td>string</td><td>The cryptocurrency symbol used for the payment.</td></tr><tr><td>sign</td><td>string</td><td>A signature generated to verify the authenticity of the callback.</td></tr></tbody></table>

### Signature Generation

The `sign` field is generated using the `generate_signature_to_merchant` function. This function requires the merchant's ID, the JSON encoded `response_data`, and the merchant's secret key.

```php
function generate_signature_to_merchant($merchant_id, $json_payload, $secret) {
        $message = $merchant_id . $json_payload . $secret;
        return hash_hmac('sha256', $message, $secret);
}
```

**Notes**

* Ensure the `merchant_id`, `secret`, and other sensitive data are stored securely and not exposed in client-side code.
* The `return_url` and `notification_url` should be properly configured to handle the payment status and notifications.

This documentation provides the necessary details to integrate the Fokawa Payments API, including payload structure, signature generation, and expected response to ensure secure transactions.

## Withdrawal

This API endpoint allows merchants to initiate a withdrawal request from their Fokawa account.

#### Fokawa Payments Withdrawal <a href="#fokawa-payments-withdrawal" id="fokawa-payments-withdrawal"></a>

**Endpoint**

<mark style="color:green;">`POST`</mark> `/`[https://payments.fokawa.com/apiv2/withdraw/](#endpoint)

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |

**Body**

| Name              | Type   | Description                                                                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| merchant\_id      | string | Unique identifier for the merchant                                                                                                                                                                      |
| request\_id       | number | Unique identifier for the request                                                                                                                                                                       |
| email             | string | Email address of the consumer.                                                                                                                                                                          |
| notification\_url | string | URL to receive notifications about the transaction                                                                                                                                                      |
| fokawa\_id        | number | Fokawa user ID                                                                                                                                                                                          |
| currency\_code    | string | A currency code is a three-letter code used to identify a specific currency (PHP, JPY, EUR, etc.). <https://payments.fokawa.com/apiv2/currencycodes/>                                                   |
| amount            | number |                                                                                                                                                                                                         |
| coin\_symbol      | string | Symbol of the cryptocurrency to be used for the withdrawal (e.g., usdt, fkwt, btc, etc). <https://payments.fokawa.com/apiv2/coinlist/>                                                                  |
| date              | string | A timestamp indicating when the withdrawal request was created is formatted as 'YYYY-MM-DD HH:MM:SS '.                                                                                                  |
| signature         | string | <p>HMAC-SHA256 signature to verify the authenticity of the request. Generated using a secret key.</p><p>Ex.</p><p>signature = hash\_hmac('sha256', merchant\_id + json\_payload + merchant\_secret)</p> |

**Payload**

```
{
    "merchant_id": string,
    "request_id": string,
    "email": string,
    "notification_url": string,
    "fokawa_id": number,
    "currency_code": string,
    "amount": number,
    "coin_symbol": string,
    "date": string
}
```

#### Response Code

<table><thead><tr><th width="122">Code</th><th>Description</th></tr></thead><tbody><tr><td>0</td><td>msg: suc - Success</td></tr><tr><td>1</td><td>One or more required parameters are missing from the request.</td></tr><tr><td>2</td><td>The merchant ID provided is either invalid or the merchant is not active.</td></tr><tr><td>3</td><td>The signature provided does not match the expected signature.</td></tr><tr><td>4</td><td>The platform coin provided is not supported.</td></tr><tr><td>5</td><td>The currency code provided is not supported.</td></tr><tr><td>70006</td><td>Insufficient account balance</td></tr></tbody></table>

{% tabs %}
{% tab title="PHP" %}

```
<?php

$secret      = 'dz3WhB9z7JpYdkRzjvJt';
$merchant_id = 'demo';
$api_url     = 'https://payments.fokawa.com/apiv2/withdraw/';

$payload = [
    "merchant_id"      => $merchant_id,
    "request_id"       => "cashout-" . uniqid(),
    "email"            => "yahoo@gmail.com",
    "notification_url" => "https://www.yourwebsite.com/payments/callback.php",
    "fokawa_id"        => "32539503",
    "currency_code"    => "php",
    "amount"           => "2000",
    "coin_symbol"      => "ETH",
    "date"             => date('Y-m-d H:i:s')
];

$signature_data = $merchant_id . json_encode($payload) . $secret;
$sign           = hash_hmac('sha256', $signature_data, $secret);
$payload['signature'] = $sign;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL            => $api_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING       => '',
    CURLOPT_MAXREDIRS      => 10,
    CURLOPT_TIMEOUT        => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION   => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_POSTFIELDS     => json_encode($payload),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json'
    ],
]);

$response = curl_exec($curl);

if (curl_errno($curl)) {
    $error_msg = curl_error($curl);
    curl_close($curl);
    die('CURL Error: ' . $error_msg);
}

curl_close($curl);

$response_data = json_decode($response, true);
if (json_last_error() === JSON_ERROR_NONE) {
    var_dump($response_data);
} else {
    var_dump($response);
} 

```

{% endtab %}

{% tab title="Python" %}

```
import requests
import hashlib
import hmac
import json
from datetime import datetime
import uuid

def generate_signature(secret, merchant_id, payload):
    payload_str = json.dumps(payload, separators=(',', ':'))
    signature_data = f"{merchant_id}{payload_str}{secret}"
    signature = hmac.new(secret.encode(), signature_data.encode(), hashlib.sha256).hexdigest()
    return signature

secret = 'dz3WhB9z7JpYdkRzjvJt'
merchant_id = 'demo'
api_url = 'https://payments.fokawa.com/apiv2/withdraw/'

payload = {
    "merchant_id": merchant_id,
    "request_id": f"cashout-{uuid.uuid4()}",
    "email": "yahoo@gmail.com",
    "notification_url": "https://www.yourwebsite.com/payments/callback.php",
    "fokawa_id": "32539503",
    "currency_code": "php",
    "amount": "2000",
    "coin_symbol": "ETH",
    "date": datetime.now().strftime('%Y-%m-%d %H:%M:%S')
}

payload['signature'] = generate_signature(secret, merchant_id, payload)

headers = {
    'Content-Type': 'application/json'
}

try:
    response = requests.post(api_url, headers=headers, data=json.dumps(payload))
    response.raise_for_status()
    response_data = response.json()
    print(response_data)
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")
except json.JSONDecodeError:
    print("Failed to decode JSON response")

```

{% endtab %}

{% tab title="Javascript" %}

```
const axios = require('axios');
const crypto = require('crypto');

const secret = 'dz3WhB9z7JpYdkRzjvJt';
const merchant_id = 'demo';
const api_url = 'https://payments.fokawa.com/apiv2/withdraw/';

const payload = {
    merchant_id: merchant_id,
    request_id: `cashout-${crypto.randomUUID()}`,
    email: "yahoo@gmail.com",
    notification_url: "https://www.yourwebsite.com/payments/callback.php",
    fokawa_id: "32539503",
    currency_code: "php",
    amount: "2000",
    coin_symbol: "ETH",
    date: new Date().toISOString().replace('T', ' ').substring(0, 19)
};

const signatureData = merchant_id + JSON.stringify(payload) + secret;
const sign = crypto.createHmac('sha256', secret).update(signatureData).digest('hex');
payload.signature = sign;

const headers = {
    'Content-Type': 'application/json'
};

axios.post(api_url, payload, { headers })
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        if (error.response) {
            console.error('Response error:', error.response.data);
        } else if (error.request) {
            console.error('Request error:', error.request);
        } else {
            console.error('Error:', error.message);
        }
    });

```

{% endtab %}
{% endtabs %}

#### Response Payload

{% tabs %}
{% tab title="Success" %}

```json
{
   "request_id":"cashout-66ace0f772b67",
   "code":"0",
   "msg":"suc",
   "orderNum":"8ed0ffd53d3c479e987f716926f2aad9",
   "signature":"539e98b40601b81ada4f4d364b143d39d540c39e3493c0ba339393d675248202"
}
```

{% endtab %}

{% tab title="Failed" %}

```json
{
   "request_id":"cashout-66acb24b9dbca",
   "code":"70006",
   "msg":"Insufficient account balance",
   "orderNum":"",
   "signature":"364414b14010253f60f7723aa80f969f48586522bb8600cd4e8ad3176fd148f5"
}
```

{% endtab %}
{% endtabs %}

## Balance

This endpoint retrieves the user's balance for a given merchant.

### Get merchant's Balance <a href="#get-merchants-balance" id="get-merchants-balance"></a>

<mark style="color:green;">`POST`</mark> `/`[https://payments.fokawa.com/apiv2/balance/](#endpoint)

This endpoint retrieves the user's balance for a given merchant.

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |

**Request Body**

| Name         | Type   | Description                                                                                                                                                                                             |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| merchant\_id | string | Name of the user                                                                                                                                                                                        |
| signature    | string | <p>HMAC-SHA256 signature to verify the authenticity of the request. Generated using a secret key.</p><p>Ex.</p><p>signature = hash\_hmac('sha256', merchant\_id + json\_payload + merchant\_secret)</p> |
| date         | string | YYYY-MM-DD HH:MM:SS                                                                                                                                                                                     |

**Response**

```
{
   "code":"0",
   "msg":"Success",
   "message":null,
   "data":{
      "totalBalance":"0.000009990531",
      "totalBalanceSymbol":"BTC",
      "yesterdayProfit":"--",
      "yesterdayProfitRate":"--",
      "platformCoin":"",
      "allCoinMap":{
         "USDT":{
            "walletTransactionOpen":0,
            "icon":"https:\/\/cbl13isq6gv9.s3.ap-northeast-1.amazonaws.com\/1317\/upload\/92c9da2c3f338881333aff4c91200546.png",
            "tcpay_income":"0.000000000000",
            "allBalance":"0.001369",
            "tcpay_symbol":"USDT",
            "exchange_symbol":"FKWT1799\/USDT",
            "present_coin_balance":0,
            "lock_position_balance":"0.000000000000",
            "depositOpen":1,
            "tcpay_balance":"0.001369",
            "canShowProfit":false,
            "otcOpen":1,
            "depositMin":0,
            "withdraw_balance":"0.000000000000",
            "checked":"true",
            "mainChainType":1,
            "allBtcValuatin":"0.000000",
            "lock_position_v2_amount":"0.000000000000",
            "withdrawOpen":1,
            "isFiat":0,
            "showName":"USDT",
            "normal_balance":"0.001369",
            "coupon_balance":0,
            "btcValuatin":"0.000000",
            "sort":1,
            "innerWithdrawShow":1,
            "lock_grant_divided_balance":"0.000000000000",
            "symbolType":1,
            "total_balance":"0.001369",
            "nc_lock_balance":"0.000000000000",
            "fiatIncome":0,
            "coinName":"USDT",
            "lock_balance":"0.000000000000",
            "overcharge_balance":""
         },
         "FKWT1799":{
            "walletTransactionOpen":0,
            "icon":"https:\/\/saas2-s3-public-01.s3.ap-northeast-1.amazonaws.com\/1799\/upload\/80948e46a607c37c0fe0e3bedb30c939.png",
            "tcpay_income":"0.000000000000",
            "allBalance":"0.000000963420",
            "tcpay_symbol":"USDT",
            "exchange_symbol":"FKWT1799\/USDT",
            "present_coin_balance":0,
            "lock_position_balance":"0.000000000000",
            "depositOpen":1,
            "tcpay_balance":"0.000000963420",
            "canShowProfit":true,
            "otcOpen":1,
            "depositMin":0,
            "withdraw_balance":"0.000000000000",
            "checked":"true",
            "mainChainType":0,
            "allBtcValuatin":"0.000000000000",
            "lock_position_v2_amount":"0.000000000000",
            "withdrawOpen":1,
            "isFiat":0,
            "showName":"FKWT",
            "normal_balance":"0.000000963420",
            "coupon_balance":0,
            "btcValuatin":"0.000000000000",
            "sort":2,
            "innerWithdrawShow":1,
            "lock_grant_divided_balance":"0.000000000000",
            "symbolType":1,
            "total_balance":"0.000000963420",
            "nc_lock_balance":"0.000000000000",
            "fiatIncome":0,
            "coinName":"FKWT1799",
            "lock_balance":"0.000000000000",
            "overcharge_balance":""
         },
         "BTC":{
            "walletTransactionOpen":0,
            "icon":"https:\/\/cbl13isq6gv9.s3.ap-northeast-1.amazonaws.com\/1317\/upload\/4e3f2bbd19a5cf34d722c377f56da175.png",
            "tcpay_income":"0.000000000000",
            "allBalance":"0.000006130440",
            "tcpay_symbol":"USDT",
            "exchange_symbol":"BTC\/USDT",
            "present_coin_balance":0,
            "lock_position_balance":"0.000000000000",
            "depositOpen":1,
            "tcpay_balance":"0.000006130440",
            "canShowProfit":true,
            "otcOpen":0,
            "depositMin":0,
            "withdraw_balance":"0.000000000000",
            "checked":"true",
            "mainChainType":1,
            "allBtcValuatin":"0.000006130440",
            "lock_position_v2_amount":"0.000000000000",
            "withdrawOpen":1,
            "isFiat":0,
            "showName":"BTC",
            "normal_balance":"0.000006130440",
            "coupon_balance":0,
            "btcValuatin":"0.000006130440",
            "sort":3,
            "innerWithdrawShow":1,
            "lock_grant_divided_balance":"0.000000000000",
            "symbolType":1,
            "total_balance":"0.000006130440",
            "nc_lock_balance":"0.000000000000",
            "fiatIncome":0,
            "coinName":"BTC",
            "lock_balance":"0.000000000000",
            "overcharge_balance":""
         }
      }
   }
}
```

**Error Code**

| Code | Message                                              | Description                                                     |
| ---- | ---------------------------------------------------- | --------------------------------------------------------------- |
| 0    | Success                                              |                                                                 |
| 1    | Missing parameters                                   | One or more required parameters are missing from the request.   |
| 2    | Invalid or inactive merchant ID                      | The provided merchant ID is either invalid or inactive.         |
| 3    | Invalid signature                                    | The provided signature does not match the expected signature.   |
| 4    | Error occurred while fetching the merhcant's balance | An error occurred while attempting to fetch the user's balance. |

## Currency Codes

This endpoint allows you to query all the supported currencies on FokawaPay.

`GET` `/`[`https://payments.fokawa.com/apiv2/currencycodes`](https://payments.fokawa.com/apiv2/currencycodes)

**Response**

```
[
  {
    "code": "CNY",
    "name": "Chinese Yuan"
  },
  {
    "code": "EUR",
    "name": "Euro"
  },
  {
    "code": "JPY",
    "name": "Japanese Yen"
  },
  {
    "code": "MYR",
    "name": "Malaysian Ringgit"
  },
  {
    "code": "PHP",
    "name": "Philippine Peso"
  },
  {
    "code": "SGD",
    "name": "Singapore Dollar"
  },
  {
    "code": "KRW",
    "name": "South Korean Won"
  },
  {
    "code": "CAD",
    "name": "Canadian Dollar"
  },
  {
    "code": "AUD",
    "name": "Australian Dollar"
  },
  {
    "code": "GBP",
    "name": "British Pound"
  },
  {
    "code": "ILS",
    "name": "Israeli Shekel"
  },
  {
    "code": "BRL",
    "name": "Brazilian Real"
  },
  {
    "code": "HKD",
    "name": "Hong Kong Dollar"
  },
  {
    "code": "TRY",
    "name": "Turkish Lira"
  },
  {
    "code": "UAH",
    "name": "Ukrainian Hryvnia"
  },
  {
    "code": "INR",
    "name": "Indian Rupee"
  },
  {
    "code": "THB",
    "name": "Thai Baht"
  },
  {
    "code": "VND",
    "name": "Vietnamese Dong"
  },
  {
    "code": "CHF",
    "name": "Swiss Franc"
  }
]
```

## Coins List

This endpoint allows you to query all the supported coins on FokawaPay with coins id, name and symbol.

`GET` `/`[`https://payments.fokawa.com/apiv2/coinlist/`](https://payments.fokawa.com/apiv2/coinlist/)

**Response**

```
[
  {
    "id": "fkwt1799",
    "symbol": "fkwt",
    "name": "Fokawa",
    "image": "https://payments.fokawa.com/backoffice/wp-content/plugins/fokawapayments/icon.png?v=6",
    "precision": 4
  },
  {
    "id": "bitcoin",
    "symbol": "btc",
    "name": "Bitcoin",
    "image": "https://assets.coingecko.com/coins/images/1/large/bitcoin.png",
    "precision": 8
  },
  {
    "id": "ethereum",
    "symbol": "eth",
    "name": "Ethereum",
    "image": "https://assets.coingecko.com/coins/images/279/large/ethereum.png",
    "precision": 8
  },
  {
    "id": "tether",
    "symbol": "usdt",
    "name": "Tether",
    "image": "https://assets.coingecko.com/coins/images/325/large/Tether-logo.png",
    "precision": 4
  },
  {
    "id": "binancecoin",
    "symbol": "bnb",
    "name": "Binance Coin",
    "image": "https://assets.coingecko.com/coins/images/825/large/binance-coin-logo.png",
    "precision": 8
  },
  {
    "id": "ripple",
    "symbol": "xrp",
    "name": "Ripple",
    "image": "https://assets.coingecko.com/coins/images/44/large/xrp-symbol-white-128.png",
    "precision": 6
  },
  {
    "id": "cardano",
    "symbol": "ada",
    "name": "Cardano",
    "image": "https://assets.coingecko.com/coins/images/975/large/cardano.png",
    "precision": 6
  },
  {
    "id": "polkadot",
    "symbol": "dot",
    "name": "Polkadot",
    "image": "https://assets.coingecko.com/coins/images/12171/large/polkadot.png",
    "precision": 8
  },
  {
    "id": "solana",
    "symbol": "sol",
    "name": "Solana",
    "image": "https://assets.coingecko.com/coins/images/4128/large/solana.png",
    "precision": 8
  },
  {
    "id": "dogecoin",
    "symbol": "doge",
    "name": "Dogecoin",
    "image": "https://assets.coingecko.com/coins/images/5/large/dogecoin.png",
    "precision": 8
  },
  {
    "id": "litecoin",
    "symbol": "ltc",
    "name": "Litecoin",
    "image": "https://assets.coingecko.com/coins/images/2/large/litecoin.png",
    "precision": 8
  },
  {
    "id": "chainlink",
    "symbol": "link",
    "name": "Chainlink",
    "image": "https://assets.coingecko.com/coins/images/877/large/chainlink-new-logo.png",
    "precision": 8
  },
  {
    "id": "shiba-inu",
    "symbol": "shib",
    "name": "Shiba Inu",
    "image": "https://assets.coingecko.com/coins/images/11939/large/shiba.png",
    "precision": 8
  },
  {
    "id": "uniswap",
    "symbol": "uni",
    "name": "Uniswap",
    "image": "https://assets.coingecko.com/coins/images/12504/large/uniswap-uni.png",
    "precision": 8
  },
  {
    "id": "matic-network",
    "symbol": "matic",
    "name": "Polygon",
    "image": "https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png",
    "precision": 8
  },
  {
    "id": "stellar",
    "symbol": "xlm",
    "name": "Stellar",
    "image": "https://assets.coingecko.com/coins/images/100/large/Stellar_symbol_black_RGB.png",
    "precision": 6
  }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.fokawa.com/openapi-basic-information/fokawapay.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
