Off Ramp
Off-ramp
Returns a single order by its ID.
GET /api/offramp/order/{id} HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Accept: */*
Successful response
{
"_id": "6603f8fc1c3f3f94d6b30818",
"offerId": "65b8c6b8b188250081f30165",
"paymentType": "CRYPTO_WALLET",
"network": "CELO",
"asset": "CUSD",
"exchangeRate": 1268.6275,
"cashout": {
"localCurrencyAmount": 1294,
"usdAmount": 1.02,
"feeAmountUsd": 0.02,
"feeAmountUsdFonbnk": 0.02,
"feeAmountUsdPartner": 0,
"feeAmountLocalCurrency": 26,
"feeAmountLocalCurrencyFonbnk": 26,
"feeAmountLocalCurrencyPartner": 0,
"cryptoAmount": 1.02,
"feeAmountCrypto": 0.02,
"feeAmountCryptoFonbnk": 0.02,
"feeAmountCryptoPartner": 0
},
"fromAddress": "0x5b7ae3c6c87F4A3F94b35c77233b13191eBFAD20",
"toAddress": "0xe9bBDDCF0E8fcD41Bd1345aa5688B565931B0184",
"status": "offramp_success",
"createdAt": "2024-03-27T10:46:20.513Z",
"expiresAt": "2024-03-27T11:46:20.509Z",
"hash": "0xbda5dd11b17d65249238137f5d542320b66141ac96be3b750804354a6eadfb04",
"statusHistory": [
{
"status": "initiated",
"changedAt": "2024-03-27T10:46:20.522Z"
},
{
"status": "awaiting_transaction_confirmation",
"changedAt": "2024-03-27T10:46:31.007Z"
},
{
"status": "transaction_confirmed",
"changedAt": "2024-03-27T10:46:43.357Z"
},
{
"status": "offramp_pending",
"changedAt": "2024-03-27T10:46:44.568Z"
},
{
"status": "offramp_success",
"changedAt": "2024-03-27T10:50:02.649Z"
}
],
"requiredFields": {
"bankCode": "011:02",
"buyerBankAccountNumber": "3159586782",
"phoneNumber": "2347000000007"
},
"countryIsoCode": "NG",
"currencyIsoCode": "NGN",
"offerRequiredFields": [
{
"label": "Phone number",
"type": "phone",
"value": "2347000000007"
},
{
"label": "Bank name",
"type": "enum",
"value": "First Bank of Nigeria"
},
{
"label": "Bank account Number",
"type": "string",
"value": "3179586682"
}
],
"orderParams": "43"
}
Returns a paginated list of orders. Filters can be applied to the list by providing query parameters.
this parameter should be provided in order to get a next page from the pagination, it should be taken from "nextCursor" response value
number from 1 to 100, describes how many records should be in each pagination page
- CRYPTO_WALLET: User will pay with a crypto wallet
- VIRTUAL_WALLET: Order will be paid from a merchant's virtual wallet
address of a user wallet
phone number of the client, should include country code
email of the client
hash of the user transaction
country ISO code, e.g. NG
type of the offramp
value of the orderParams query param during order creation
- initiated: The offramp order has been initiated
- awaiting_transaction_confirmation: User sent the transaction hash and system is awaiting confirmation
- transaction_confirmed: User transaction has been confirmed
- transaction_failed: User transaction has failed
- offramp_success: The offramp transaction has been successful
- offramp_pending: The offramp transaction is pending
- offramp_failed: The offramp transaction has failed
- offramp_retry: The offramp transaction is being retried
- refunding: The offramp transaction is being refunded
- refunded: The offramp transaction has been refunded
- refund_failed: The offramp transaction refund has failed
- expired: The offramp order has expired
- cancelled: The offramp order has been cancelled by the user
- validating_transaction: The offramp transaction is being validated
- transaction_invalid: The offramp transaction is invalid
GET /api/offramp/orders HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Accept: */*
Successful response
{
"list": [
{
"_id": "6603f8fc1c3f3f94d6b30818",
"offerId": "65b8c6b8b188250081f30165",
"network": "CELO",
"asset": "CUSD",
"paymentType": "CRYPTO_WALLET",
"exchangeRate": 1268.6275,
"cashout": {
"localCurrencyAmount": 1294,
"usdAmount": 1.02,
"feeAmountUsd": 0.02,
"feeAmountUsdFonbnk": 0.02,
"feeAmountUsdPartner": 0,
"feeAmountLocalCurrency": 26,
"feeAmountLocalCurrencyFonbnk": 26,
"feeAmountLocalCurrencyPartner": 0,
"cryptoAmount": 1.02,
"feeAmountCrypto": 0.02,
"feeAmountCryptoFonbnk": 0.02,
"feeAmountCryptoPartner": 0
},
"fromAddress": "0x5b7ae3c6c87F4A3F94b35c77233b13191eBFAD20",
"toAddress": "0xe9bBDDCF0E8fcD41Bd1345aa5688B565931B0184",
"status": "offramp_success",
"createdAt": "2024-03-27T10:46:20.513Z",
"expiresAt": "2024-03-27T11:46:20.509Z",
"hash": "0xbda5dd11b17d65249238137f5d542320b66141ac96be3b750804354a6eadfb04",
"statusHistory": [
{
"status": "initiated",
"changedAt": "2024-03-27T10:46:20.509Z"
},
{
"status": "initiated",
"changedAt": "2024-03-27T10:46:20.522Z"
},
{
"status": "awaiting_transaction_confirmation",
"changedAt": "2024-03-27T10:46:31.007Z"
},
{
"status": "transaction_confirmed",
"changedAt": "2024-03-27T10:46:43.357Z"
},
{
"status": "offramp_pending",
"changedAt": "2024-03-27T10:46:44.568Z"
},
{
"status": "offramp_success",
"changedAt": "2024-03-27T10:50:02.649Z"
}
],
"requiredFields": {
"bankCode": "011:02",
"buyerBankAccountNumber": "3159586782",
"phoneNumber": "2347000000007"
},
"countryIsoCode": "NG",
"currencyIsoCode": "NGN",
"offerRequiredFields": [
{
"label": "Phone number",
"type": "phone",
"value": "2347000000007"
},
{
"label": "Bank name",
"type": "enum",
"value": "First Bank of Nigeria"
},
{
"label": "Bank account Number",
"type": "string",
"value": "3179586682"
}
],
"orderParams": "43"
}
],
"nextCursor": "646c7e3ce2597a00921e2c53"
}
Returns the best offer for the provided country, network, asset, amount and off-ramp type.
Amount of usd user wants to pay or amount of local currency user wants to receive depending on the currency param value
Currency of the amount param
country ISO code, for example KE for Kenya, NG for Nigeria
GET /api/offramp/best-offer HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Accept: */*
Successful response
{
"offer": {
"_id": "65b8c6b8b188250081f30165",
"countryIsoCode": "NG",
"currencyIsoCode": "NGN",
"exchangeRate": 1260.2,
"requiredFields": {
"phoneNumber": {
"type": "phone",
"label": "Phone number",
"required": true
},
"bankCode": {
"required": true,
"type": "enum",
"label": "Bank name",
"options": [
{
"value": "120001:02",
"label": "9Payment Service Bank"
},
{
"value": "801:02",
"label": "Abbey Mortgage Bank"
}
]
},
"buyerBankAccountNumber": {
"type": "string",
"label": "Bank account Number",
"required": true
}
},
"type": "bank"
},
"cashout": {
"localCurrencyAmount": 6301,
"usdAmount": 5,
"feeAmountUsd": 0.12,
"feeAmountUsdFonbnk": 0.12,
"feeAmountUsdPartner": 0,
"feeAmountLocalCurrency": 155,
"feeAmountLocalCurrencyFonbnk": 155,
"feeAmountLocalCurrencyPartner": 0,
"cryptoAmount": 5,
"feeAmountCrypto": 0.12,
"feeAmountCryptoFonbnk": 0.12,
"feeAmountCryptoPartner": 0
}
}
Returns minimum and maximum amount of order in USD and local currency with applied fees.
offramp type
country ISO code
GET /api/offramp/limits HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Accept: */*
Successful response
{
"minUsd": 1.02,
"maxUsd": 100,
"minLocalCurrency": 1292,
"maxLocalCurrency": 125921
}
Returns a list of supported countries and their offramp types
GET /api/offramp/countries HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Accept: */*
Successful response
[
{
"countryIsoCode": "NG",
"currencyIsoCode": "NGN",
"name": "Nigeria",
"offrampTypes": [
{
"type": "bank",
"name": "Bank"
},
{
"type": "airtime",
"name": "Airtime"
}
]
},
{
"countryIsoCode": "KE",
"currencyIsoCode": "KES",
"name": "Kenya",
"offrampTypes": [
{
"type": "mobile_money",
"name": "M-PESA",
"carriers": [
{
"id": "618e43914f57e07d255ff353",
"name": "Safaricom Kenya"
}
]
},
{
"type": "airtime",
"name": "Airtime"
},
{
"type": "paybill",
"name": "Paybill"
}
]
},
{
"countryIsoCode": "UG",
"currencyIsoCode": "UGX",
"name": "Uganda",
"offrampTypes": [
{
"type": "mobile_money",
"name": "Mobile money"
},
{
"type": "airtime",
"name": "Airtime"
}
]
},
{
"countryIsoCode": "GH",
"currencyIsoCode": "GHS",
"name": "Ghana",
"offrampTypes": [
{
"type": "mobile_money",
"name": "Mobile money"
},
{
"type": "airtime",
"name": "Airtime"
}
]
},
{
"countryIsoCode": "ZA",
"currencyIsoCode": "ZAR",
"name": "South Africa",
"offrampTypes": [
{
"type": "bank",
"name": "Bank"
},
{
"type": "airtime",
"name": "Airtime"
}
]
},
{
"countryIsoCode": "TZ",
"currencyIsoCode": "TZS",
"name": "Tanzania",
"offrampTypes": [
{
"type": "mobile_money",
"name": "Mobile money"
},
{
"type": "airtime",
"name": "Airtime"
}
]
}
]
Returns a list of supported wallet networks and their assets for crypto wallet orders
GET /api/offramp/wallets HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Accept: */*
A list of supported wallet networks and their assets
[
{
"network": "POLYGON",
"asset": "USDC"
},
{
"network": "CELO",
"asset": "USDC"
},
{
"network": "ETHEREUM",
"asset": "USDC"
},
{
"network": "AVALANCHE",
"asset": "USDC"
},
{
"network": "CELO",
"asset": "CUSD"
},
{
"network": "POLYGON",
"asset": "USDT"
},
{
"network": "AVALANCHE",
"asset": "USDT"
},
{
"network": "CELO",
"asset": "USDT"
},
{
"network": "ETHEREUM",
"asset": "USDT"
}
]
The get best offer endpoint returns the required fields that need to be provided by a user. This endpoint allows you to validate the fields provided by a user. Endpoint might return a list of user information that can help a user to verify the correctness of the provided information.
ID of the offer returned from get best offer endpoint
POST /api/offramp/validate-fields HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 115
{
"offerId": "65b8c6b8b188250081f30163",
"requiredFields": {
"bankCode": "011:02",
"buyerBankAccountNumber": "3139586782"
}
}
Validation successful
{
"details": [
{
"label": "Bank account holder name",
"value": "JOHN SMITH"
}
]
}
Creates an order for a provided user details.
ID of the offer returned from get best offer endpoint
- CRYPTO_WALLET: User will pay with a crypto wallet
- VIRTUAL_WALLET: Order will be paid from a merchant's virtual wallet
Address of the wallet from which funds will be sent
Amount of usd user wants to pay or amount of local currency user wants to receive depending on the currency param value
IP address of a user
OrderParams that need to be associated with an order
POST /api/offramp/create-order HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 279
{
"offerId": "65b8c4b8b188250081f30165",
"network": "CELO",
"asset": "CUSD",
"amount": 1.02,
"address": "0x5b7ae3c3c87F4A3F94b35c77233b13191eBFAD20",
"requiredFields": {
"bankCode": "011:02",
"buyerBankAccountNumber": "3134586782"
},
"currency": "usd",
"ip": "192.168.1.1",
"orderParams": "someParams"
}
Order created successfully
{
"_id": "6603f8fc1c3f3f94d6b30818",
"offerId": "65b8c6b8b188250081f30165",
"paymentType": "CRYPTO_WALLET",
"network": "CELO",
"asset": "CUSD",
"exchangeRate": 1268.6275,
"cashout": {
"localCurrencyAmount": 1294,
"usdAmount": 1.02,
"feeAmountUsd": 0.02,
"feeAmountUsdFonbnk": 0.02,
"feeAmountUsdPartner": 0,
"feeAmountLocalCurrency": 26,
"feeAmountLocalCurrencyFonbnk": 26,
"feeAmountLocalCurrencyPartner": 0,
"cryptoAmount": 1.02,
"feeAmountCrypto": 0.02,
"feeAmountCryptoFonbnk": 0.02,
"feeAmountCryptoPartner": 0
},
"fromAddress": "0x5b7ae3c6c87F4A3F94b35c77233b13191eBFAD20",
"toAddress": "0xe9bBDDCF0E8fcD41Bd1345aa5688B565931B0184",
"status": "offramp_success",
"createdAt": "2024-03-27T10:46:20.513Z",
"expiresAt": "2024-03-27T11:46:20.509Z",
"hash": "0xbda5dd11b17d65249238137f5d542320b66141ac96be3b750804354a6eadfb04",
"statusHistory": [
{
"status": "initiated",
"changedAt": "2024-03-27T10:46:20.522Z"
},
{
"status": "awaiting_transaction_confirmation",
"changedAt": "2024-03-27T10:46:31.007Z"
},
{
"status": "transaction_confirmed",
"changedAt": "2024-03-27T10:46:43.357Z"
},
{
"status": "offramp_pending",
"changedAt": "2024-03-27T10:46:44.568Z"
},
{
"status": "offramp_success",
"changedAt": "2024-03-27T10:50:02.649Z"
}
],
"requiredFields": {
"bankCode": "011:02",
"buyerBankAccountNumber": "3159586782",
"phoneNumber": "2347000000007"
},
"countryIsoCode": "NG",
"currencyIsoCode": "NGN",
"offerRequiredFields": [
{
"label": "Phone number",
"type": "phone",
"value": "2347000000007"
},
{
"label": "Bank name",
"type": "enum",
"value": "First Bank of Nigeria"
},
{
"label": "Bank account Number",
"type": "string",
"value": "3179586682"
}
],
"orderParams": "43"
}
Confirms an order by providing a transaction hash for crypto orders and order ID returned from the create order endpoint.
ID of the order returned from create order endpoint
Transaction hash for crypto orders
POST /api/offramp/confirm-order HTTP/1.1
Host: sandbox-api.fonbnk.com
x-client-id: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 114
{
"orderId": "660528663163c4652145aaba",
"hash": "0xf4c04687dca90a9060861493d7baa8ce761081c44949ec3507c5413304b13ae3"
}
Order confirmed successfully
{
"_id": "6603f8fc1c3f3f94d6b30818",
"offerId": "65b8c6b8b188250081f30165",
"paymentType": "CRYPTO_WALLET",
"network": "CELO",
"asset": "CUSD",
"exchangeRate": 1268.6275,
"cashout": {
"localCurrencyAmount": 1294,
"usdAmount": 1.02,
"feeAmountUsd": 0.02,
"feeAmountUsdFonbnk": 0.02,
"feeAmountUsdPartner": 0,
"feeAmountLocalCurrency": 26,
"feeAmountLocalCurrencyFonbnk": 26,
"feeAmountLocalCurrencyPartner": 0,
"cryptoAmount": 1.02,
"feeAmountCrypto": 0.02,
"feeAmountCryptoFonbnk": 0.02,
"feeAmountCryptoPartner": 0
},
"fromAddress": "0x5b7ae3c6c87F4A3F94b35c77233b13191eBFAD20",
"toAddress": "0xe9bBDDCF0E8fcD41Bd1345aa5688B565931B0184",
"status": "offramp_success",
"createdAt": "2024-03-27T10:46:20.513Z",
"expiresAt": "2024-03-27T11:46:20.509Z",
"hash": "0xbda5dd11b17d65249238137f5d542320b66141ac96be3b750804354a6eadfb04",
"statusHistory": [
{
"status": "initiated",
"changedAt": "2024-03-27T10:46:20.522Z"
},
{
"status": "awaiting_transaction_confirmation",
"changedAt": "2024-03-27T10:46:31.007Z"
},
{
"status": "transaction_confirmed",
"changedAt": "2024-03-27T10:46:43.357Z"
},
{
"status": "offramp_pending",
"changedAt": "2024-03-27T10:46:44.568Z"
},
{
"status": "offramp_success",
"changedAt": "2024-03-27T10:50:02.649Z"
}
],
"requiredFields": {
"bankCode": "011:02",
"buyerBankAccountNumber": "3159586782",
"phoneNumber": "2347000000007"
},
"countryIsoCode": "NG",
"currencyIsoCode": "NGN",
"offerRequiredFields": [
{
"label": "Phone number",
"type": "phone",
"value": "2347000000007"
},
{
"label": "Bank name",
"type": "enum",
"value": "First Bank of Nigeria"
},
{
"label": "Bank account Number",
"type": "string",
"value": "3179586682"
}
],
"orderParams": "43"
}