Fonbnk Docs
  • Intro
  • Integration Guide
  • On-ramp
    • How it works
    • URL Parameters
    • Webhook
  • Off-ramp
    • How it works
    • URL Parameters
    • Webhook
  • Reference
    • Servers
    • Signing requests
    • Endpoints
      • On-ramp
        • Assets
        • Order
        • Orders
        • Price
        • Providers
        • Limits
      • Off-ramp
        • Order
        • Orders
        • Best offer
        • Limits
        • Countries
        • Wallets
        • Validate fields
        • Create order
        • Confirm order
      • Util
        • Check address
        • Assets
      • Kyc
        • State
        • Submit
    • Specification
Powered by GitBook
On this page
  1. Reference
  2. Endpoints
  3. Off-ramp

Create order

PreviousValidate fieldsNextConfirm order

Create order

post

Creates an order for a provided user details.

Authorizations
Body
offerIdstringRequired

ID of the offer returned from get best offer endpoint

paymentTypestring · enumRequired
  • CRYPTO_WALLET: User will pay with a crypto wallet
  • VIRTUAL_WALLET: Order will be paid from a merchant's virtual wallet
Possible values:
networkstring · enumRequiredPossible values:
assetstring · enumRequiredPossible values:
addressstringRequired

Address of the wallet from which funds will be sent

currencystring · enumRequiredPossible values:
amountnumberRequired

Amount of usd user wants to pay or amount of local currency user wants to receive depending on the currency param value

ipstringOptional

IP address of a user

orderParamsstringOptional

OrderParams that need to be associated with an order

Responses
200
Order created successfully
application/json
post
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"
}
200

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"
}