# Crypto to Fiat

Let’s do a POLYGON\_USDT (crypto) deposit to NGN (fiat)  payout.&#x20;

{% stepper %}
{% step %}

### First, call [Get available currencies and assume you receive:](https://docs.fonbnk.com/server-to-server/api-endpoints/get-available-currencies)

{% code title="Example response" overflow="wrap" expandable="true" %}

```json
[
  {
    "currencyType": "fiat",
    "currencyCode": "NGN",
    "paymentChannels": [
      {
        "type": "bank",
        "transferTypes": [
          "manual",
          "redirect"
        ],
        "isDepositAllowed": true,
        "isPayoutAllowed": true
      },
      {
        "type": "airtime",
        "transferTypes": [
          "ussd"
        ],
        "carriers": [
          {
            "code": "MTN",
            "name": "MTN"
          },
          {
            "code": "AIRTEL",
            "name": "Airtel"
          },
          {
            "code": "GLO",
            "name": "Glo"
          },
          {
            "code": "9MOBILE",
            "name": "9Mobile"
          }
        ],
        "isDepositAllowed": true,
        "isPayoutAllowed": false
      },
      {
        "type": "mobile_money",
        "transferTypes": [
          "stk_push",
          "otp_stk_push"
        ],
        "carriers": [
          {
            "code": "MTN",
            "name": "MTN Mobile Money"
          },
          {
            "code": "AIRTEL",
            "name": "Airtel Money"
          },
          {
            "code": "GLO",
            "name": "Glo Mobile Money"
          },
          {
            "code": "9MOBILE",
            "name": "9Mobile Money"
          }
        ],
        "isDepositAllowed": true,
        "isPayoutAllowed": true
      }
    ],
    "currencyDetails": {
      "countryIsoCode": "NG",
    },
    "pairs": [
      "crypto",
      "merchant_balance"
    ]
  },
  {
    "currencyType": "crypto",
    "currencyCode": "POLYGON_USDT",
    "paymentChannels": [
      {
        "type": "crypto",
        "transferTypes": [
          "manual"
        ],
        "isDepositAllowed": true,
        "isPayoutAllowed": true
      }
    ],
    "currencyDetails": {
      "network": "POLYGON",
      "asset": "USDT",
      "contractAddress": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
    },
    "pairs": [
      "fiat",
      "merchant_balance"
    ]
  }
]
```

{% endcode %}

We see NGN supports deposit via bank/airtime/mobile money, and payout via bank/mobile money. POLYGON\_USDT supports both deposit and payout. So we can do Crypto →  Fiat ( POLYGON\_USDT → NGN).
{% endstep %}

{% step %}

### Call [Get order limits](https://docs.fonbnk.com/server-to-server/api-endpoints/get-order-limits) with the next query params:

* depositPaymentChannel: "<mark style="color:yellow;">crypto</mark>"
* depositCurrencyType: "<mark style="color:yellow;">crypto</mark>"
* depositCurrencyCode: "<mark style="color:yellow;">POLYGON\_USDT</mark>"
* payoutPaymentChannel: "<mark style="color:yellow;">bank</mark>"
* payoutCurrencyType: "<mark style="color:yellow;">fiat</mark>"
* payoutCurrencyCode: "<mark style="color:yellow;">NGN</mark>"
* payoutCountryIsoCode: "<mark style="color:yellow;">NG</mark>"

{% code title="Example response" overflow="wrap" %}

```json
{
    "deposit": {
        "min": 1,
        "max": 500,
        "minUsd": 1,
        "maxUsd": 500
    },
    "payout": {
        "min": 1409,
        "max": 704460,
        "minUsd": 1,
        "maxUsd": 500
    }
}
```

{% endcode %}

We see that a user can send from 1 to 500 POLYGON\_UST and receive from 1409 to 704460 NGN.

Assume the user wants to receive 30 000 NGN. Validate their tier using the [KYC requirements](https://docs.fonbnk.com/server-to-server/kyc-flow) flow.&#x20;
{% endstep %}

{% step %}

### Call [Create quote:](https://docs.fonbnk.com/server-to-server/api-endpoints/create-quote)

{% code title="Example request" %}

```json
{
    "deposit": {
        "paymentChannel": "crypto",
        "currencyType": "crypto",
        "currencyCode": "POLYGON_USDT"
    },
    "payout": {
        "paymentChannel": "bank",
        "currencyType": "fiat",
        "currencyCode": "NGN",
        "countryIsoCode": "NG",
        "amount": 30000
    }
}
```

{% endcode %}

{% code title="Example response" overflow="wrap" expandable="true" %}

```json
{
    "quoteId": "692d9874a60e2135463730cf",
    "quoteExpiresAt": "2025-12-01T14:00:28.208Z",
    "deposit": {
        "paymentChannel": "crypto",
        "currencyType": "crypto",
        "currencyCode": "POLYGON_USDT",
        "currencyDetails": {
            "network": "POLYGON",
            "asset": "USDT",
            "contractAddress": "0x3b3a06b48119c035a2e86afdb69d9ad930643b3d"
        },
        "cashout": {
            "amountBeforeFees": 21.272315,
            "amountAfterFees": 21.272315,
            "amountBeforeFeesUsd": 21.272315,
            "amountAfterFeesUsd": 21.272315,
            "chargedFees": [],
            "chargedFeesUsd": [],
            "totalChargedFees": 0,
            "totalChargedFeesUsd": 0,
            "exchangeRate": 1,
            "exchangeRateAfterFees": 1,
            "chargedFeesPerRecipient": {},
            "chargedFeesPerRecipientUsd": {},
            "feeSettings": []
        },
        "fieldsToCreateOrder": [
            {
                "key": "blockchainWalletAddress",
                "type": "string",
                "label": "Your wallet address",
                "required": true
            },
            {
                "key": "depositSandboxForcedFlow",
                "type": "enum",
                "label": "Sandbox deposit forced flow",
                "required": false,
                "defaultValue": "deposit_success",
                "options": [
                    {
                        "label": "Deposit success",
                        "value": "deposit_success"
                    },
                    {
                        "label": "Deposit invalid",
                        "value": "deposit_invalid"
                    }
                ]
            }
        ],
        "transferType": "manual"
    },
    "payout": {
        "paymentChannel": "bank",
        "currencyType": "fiat",
        "currencyCode": "NGN",
        "currencyDetails": {
            "countryIsoCode": "NG"
        },
        "cashout": {
            "amountBeforeFees": 31088,
            "amountAfterFees": 30000,
            "amountBeforeFeesUsd": 21.272315,
            "amountAfterFeesUsd": 20.527839,
            "chargedFees": [
                {
                    "id": "service_fee",
                    "type": "percentage",
                    "recipient": "platform",
                    "amount": 777.2
                },
                {
                    "id": "merchant_fee",
                    "type": "percentage",
                    "recipient": "merchant",
                    "amount": 310.88
                }
            ],
            "chargedFeesUsd": [
                {
                    "id": "service_fee",
                    "type": "percentage",
                    "recipient": "platform",
                    "amount": 0.531808
                },
                {
                    "id": "merchant_fee",
                    "type": "percentage",
                    "recipient": "merchant",
                    "amount": 0.212723
                }
            ],
            "totalChargedFees": 1088.08,
            "totalChargedFeesUsd": 0.744531,
            "exchangeRate": 1461.43,
            "exchangeRateAfterFees": 1514.4312,
            "chargedFeesPerRecipient": {
                "platform": 777.2,
                "merchant": 310.88
            },
            "chargedFeesPerRecipientUsd": {
                "platform": 0.531808,
                "merchant": 0.212723
            },
            "feeSettings": [
                {
                    "id": "service_fee",
                    "recipient": "platform",
                    "type": "percentage",
                    "value": 2.5,
                    "min": 0,
                    "max": "Infinity"
                },
                {
                    "id": "merchant_fee",
                    "recipient": "merchant",
                    "type": "percentage",
                    "value": 1,
                    "min": 0,
                    "max": "Infinity"
                }
            ]
        },
        "fieldsToCreateOrder": [
            {
                "key": "phoneNumber",
                "label": "Phone Number",
                "required": true,
                "type": "phone"
            },
            {
                "key": "bankCode",
                "label": "Bank name",
                "required": true,
                "type": "enum",
                "options": [
                    {
                        "label": "Sandbox Bank",
                        "value": "1"
                    },
                    {
                        "label": "Sandbox Bank 2",
                        "value": "2"
                    },
                    {
                        "label": "Sandbox Bank 3",
                        "value": "3"
                    }
                ]
            },
            {
                "key": "bankAccountNumber",
                "label": "Bank Account Number",
                "required": true,
                "type": "string"
            },
            {
                "key": "payoutSandboxForcedFlow",
                "type": "enum",
                "label": "Sandbox payout forced flow",
                "required": false,
                "defaultValue": "payout_success",
                "options": [
                    {
                        "label": "Payout success",
                        "value": "payout_success"
                    },
                    {
                        "label": "Payout failed",
                        "value": "payout_failed"
                    }
                ]
            }
        ]
    }
}
```

{% endcode %}

To receive 30 000 NGN, a user must deposit 21.394438 POLYGON\_USDT. Collect these fields:

* phoneNumber
* bankCode (from enum options)
* bankAccountNumber
* blockchainWalletAddress
  {% endstep %}

{% step %}

### Create the order via [Create order:](https://docs.fonbnk.com/server-to-server/api-endpoints/create-order)

{% code title="Example request" overflow="wrap" expandable="true" %}

```json
{
    "quoteId": "692d9874a60e2135463730cf",
    "userCountryIsoCode": "NG",
    "userEmail": "testuser+ng@fonbnk.com",
    "userIp": "223.134.123.12",
    "deposit": {
        "paymentChannel": "crypto",
        "currencyType": "crypto",
        "currencyCode": "POLYGON_USDT"
    },
    "payout": {
        "paymentChannel": "bank",
        "currencyType": "fiat",
        "currencyCode": "NGN",
        "countryIsoCode": "NG",
        "amount": 30000
    },
    "fieldsToCreateOrder": {
        "blockchainWalletAddress": "0x5b7ae3c6c87f4a3f94b35c77233b13191ebfad20",
        "phoneNumber": "2348012345678",
        "bankCode": "1",
        "bankAccountNumber": "1234567890"
    }
}
```

{% endcode %}

{% code title="Example response (transfer instructions excerpt)" overflow="wrap" expandable="true" %}

```json
{
    "quoteUsed": true,
    "order": {
        "_id": "692d98b0a60e21354637311a",
        "countryIsoCode": "NG",
        "userId": "686671f07730d8d1a9b2260a",
        "userEmail": "testuser+ng@fonbnk.com",
        "status": "deposit_awaiting",
        "deposit": {
            "paymentChannel": "crypto",
            "currencyType": "crypto",
            "currencyCode": "POLYGON_USDT",
            "currencyDetails": {
                "network": "POLYGON",
                "asset": "USDT",
                "contractAddress": "0x3b3a06b48119c035a2e86afdb69d9ad930643b3d"
            },
            "cashout": {
                "amountBeforeFees": 21.272315,
                "amountAfterFees": 21.272315,
                "amountBeforeFeesUsd": 21.272315,
                "amountAfterFeesUsd": 21.272315,
                "chargedFees": [],
                "chargedFeesUsd": [],
                "totalChargedFees": 0,
                "totalChargedFeesUsd": 0,
                "exchangeRate": 1,
                "exchangeRateAfterFees": 1,
                "chargedFeesPerRecipient": {},
                "chargedFeesPerRecipientUsd": {},
                "feeSettings": []
            },
            "providedFieldsToCreateOrder": {
                "blockchainWalletAddress": "0x5b7ae3c6c87f4a3f94b35c77233b13191ebfad20"
            },
            "transferInstructions": {
                "type": "manual",
                "instructionsText": "Please send the exact amount of crypto to the address below. Make sure to send only USDT on the Polygon network. Sending any other assets or using a different network may result in loss of funds.",
                "transferDetails": [
                    {
                        "id": "recipientWalletAddress",
                        "label": "Wallet address to send",
                        "value": "0xdc9cbad0c43f912a66cd44cd22a15c04368e659f"
                    },
                    {
                        "id": "senderWalletAddress",
                        "label": "Your wallet address",
                        "value": "0x5b7ae3c6c87f4a3f94b35c77233b13191ebfad20"
                    },
                    {
                        "id": "amountToSend",
                        "label": "Amount to send",
                        "value": "21.272315"
                    },
                    {
                        "id": "cryptoTransactionRequestAdditionalData",
                        "label": "Crypto transaction additional data",
                        "value": ""
                    }
                ],
                "fieldsToConfirmOrder": [
                    {
                        "key": "blockchainTransactionHash",
                        "type": "string",
                        "label": "Transaction hash",
                        "required": true
                    }
                ]
            }
        },
        "payout": {
            "paymentChannel": "bank",
            "currencyType": "fiat",
            "currencyCode": "NGN",
            "currencyDetails": {
                "countryIsoCode": "NG"
            },
            "cashout": {
                "amountBeforeFees": 31088,
                "amountAfterFees": 30000,
                "amountBeforeFeesUsd": 21.272315,
                "amountAfterFeesUsd": 20.527839,
                "chargedFees": [
                    {
                        "id": "service_fee",
                        "type": "percentage",
                        "recipient": "platform",
                        "amount": 777.2
                    },
                    {
                        "id": "merchant_fee",
                        "type": "percentage",
                        "recipient": "merchant",
                        "amount": 310.88
                    }
                ],
                "chargedFeesUsd": [
                    {
                        "id": "service_fee",
                        "type": "percentage",
                        "recipient": "platform",
                        "amount": 0.531808
                    },
                    {
                        "id": "merchant_fee",
                        "type": "percentage",
                        "recipient": "merchant",
                        "amount": 0.212723
                    }
                ],
                "totalChargedFees": 1088.08,
                "totalChargedFeesUsd": 0.744531,
                "exchangeRate": 1461.43,
                "exchangeRateAfterFees": 1514.4312,
                "chargedFeesPerRecipient": {
                    "platform": 777.2,
                    "merchant": 310.88
                },
                "chargedFeesPerRecipientUsd": {
                    "platform": 0.531808,
                    "merchant": 0.212723
                },
                "feeSettings": [
                    {
                        "id": "service_fee",
                        "recipient": "platform",
                        "type": "percentage",
                        "value": 2.5,
                        "min": 0,
                        "max": "Infinity"
                    },
                    {
                        "id": "merchant_fee",
                        "recipient": "merchant",
                        "type": "percentage",
                        "value": 1,
                        "min": 0,
                        "max": "Infinity"
                    }
                ]
            },
            "providedFieldsToCreateOrder": {
                "phoneNumber": "2348012345678",
                "bankCode": "1",
                "bankAccountNumber": "1234567890"
            }
        },
        "statusChangeLogs": [],
        "createdAt": "2025-12-01T13:31:28.372Z",
        "updatedAt": "2025-12-01T13:31:28.372Z",
        "expiresAt": "2025-12-01T14:01:28.156Z"
    }
}
```

{% endcode %}

From the response <mark style="color:yellow;">fieldsToConfirmOrder</mark> and <mark style="color:yellow;">transferInstructions</mark> we see that:

* to confirm the order we must provide <mark style="color:yellow;">blockchainTransactionHash</mark>
* a user must pay <mark style="color:yellow;">21.272315</mark>  Polygon USDT to this wallet <mark style="color:yellow;">0xdc9cbad0c43f912a66cd44cd22a15c04368e659f</mark> from this wallet <mark style="color:yellow;">0x5b7ae3c6c87f4a3f94b35c77233b13191ebfad20</mark>
  {% endstep %}

{% step %}

#### A user makes the crypto transfer with the exact amount to the specified wallet address.&#x20;

{% endstep %}

{% step %}

#### Call [Confirm order](https://docs.fonbnk.com/server-to-server/api-endpoints/confirm-order) with <mark style="color:yellow;">blockchainTransactionHash</mark> included:

{% code title="Example request" %}

```json
{
  "orderId": "692d98b0a60e21354637311a",
  "fieldsToConfirmOrder": {
     "blockchainTransactionHash": "your hash"
  }
}
```

{% endcode %}
{% endstep %}

{% step %}

#### The system validates the deposit and processes payout.

{% endstep %}

{% step %}

#### Use [Get order](https://docs.fonbnk.com/server-to-server/api-endpoints/get-order) to track status until "<mark style="color:yellow;">payout\_successful</mark>".

{% endstep %}
{% endstepper %}
