First-party offramps

Overview

Fern's first-party offramps enable your customers to convert any ERC-20 token into a fiat currency, delivering funds to their bank account via local payment rails.

To implement offramps, use the Bank Accounts API, Quotes API, and Transactions API. Specify a cryptocurrency as the source and a fiat currency as the destination to configure the transaction as an offramp.

For the latest list of supported fiat and cryptocurrencies, as well as payment methods, refer to What Fern supports.

Step-by-step guide

1

Create a bank account for a verified customer

Once your customer has been created and successfully verified, you can use the Bank Accounts endpoint to create a new bank account for the customer.

Ensure that the beneficiary name matches your customer's name and the account type is accurate. Otherwise, there is a risk the funds will be returned to the sending wallet.

2

Generate quote

To fetch a proposed price for a currency conversion, use the Quotes endpoint. This endpoint generates a quote for your specified currency route, guaranteeing the price for 5 min. Quotes provide transparent details, including:

  • the exact receiving amount,

  • fees,

  • minimum guaranteed amount,

  • price impact (if applicable).

For more details, visit the Quotes section.

Request

curl --location 'https://app.fernhq.com/api/v0/quotes/'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer <API_TOKEN>'
--data '{ "customerId": "03b7030f-6da1-4d76-9352-cdebd82112c8", "sendingAmount": 100, "source": { "paymentMethod": "base", "currency": "USDC" }, "destination": { "bankAccountId": "072a8b7b-38c7-429a-a6cf-35dae7f2fb77", "paymentMethod": "wire", "currency": "USD" } }'

Response

{
  "quoteId": "ec823f56-fc7f-493e-8723-9583a91466a7",
  "exchangeRate": 1,
  "receivingAmount": 79.5,
  "minGuaranteedReceivingAmount": 79.5,
  "expiresAt": "2024-12-19T00:29:27.355Z",
  "fees": {
    "fernFee": {
      "type": "fern",
      "currency": "USD",
      "amount": 20.5,
      "usdAmount": 20.5
    },
    "developerFee": {
      "type": "developer",
      "currency": "USD",
      "amount": 0,
      "usdAmount": 0,
    },
  }
}

3

Submit transaction

To create a transaction, use the quote ID to generate an offramp transaction. Once the transaction is initiated and funds are received at the transfer wallet address, the destination currency is sent to the specified destination address via the indicated payment rail.

For more details, check out the Transactions section.

Request

curl --location 'https://app.fernhq.com/api/v0/transactions/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_TOKEN>' \
--data '{
    "customerId": "03b7030f-6da1-4d76-9352-cdebd82112c8",
    "quoteId": "ec823f56-fc7f-493e-8723-9583a91466a7"
}'

Response

{
  "transactionId": "1d8beb26-b4d1-47ee-8e5d-0d3905f200c7",
  "quoteId": "ec823f56-fc7f-493e-8723-9583a91466a7",
  "status": "PROCESSING",
  "receivingAmountDetails": {
    "amount" : 79.5,
    "currency": "USD",
  },
  "fees": {
    "fernFee": {
      "type": "fern",
      "currency": "USD",
      "amount": 20.5,
      "usdAmount": 20.5
    },
    "developerFee": {
      "type": "developer",
      "currency": "USD",
      "amount": 0,
      "usdAmount": 0,
    },
  }
  "exchangeRate": 1,
  "transferInstructions": {
    "type": "offramp",
    "paymentMethod": "ethereum",
    "transferWalletAddress": "0xbf50fb9c99233f95bce213044507e58485cf9eba",
    "sendingAmountDetails": {
      "amount": 100,
      "currency": "USDC",
    }
  }
}

4

Monitor transaction status

Track the progress of a transaction by calling the Transactions endpoint or visiting the Developer dashboard. You can also subscribe to webhooks for real-time notifications on status changes (coming soon).

For a full list of transaction statuses, refer to Transaction Statuses.

Request

curl --location 'https://app.fernhq.com/api/v0/transactions/1d8beb26-b4d1-47ee-8e5d-0d3905f200c7' \
--header 'Authorization: Bearer <API_TOKEN>'

Response

{
  "transactionId": "1d8beb26-b4d1-47ee-8e5d-0d3905f200c7",
  "quoteId": "ec823f56-fc7f-493e-8723-9583a91466a7",
  "status": "PROCESSING",
  "receivingAmountDetails": {
    "amount" : 79.5,
    "currency": "USD",
  },
  "fees": {
    "fernFee": {
      "type": "fern",
      "currency": "USD",
      "amount": 20.5,
      "usdAmount": 20.5
    },
    "developerFee": {
      "type": "developer",
      "currency": "USD",
      "amount": 0,
      "usdAmount": 0,
    },
  }
  "exchangeRate": 1,
  "transferInstructions": {
    "type": "offramp",
    "paymentMethod": "ethereum",
    "transferWalletAddress": "0xbf50fb9c99233f95bce213044507e58485cf9eba",
    "sendingAmountDetails": {
      "amount": 100,
      "currency": "USDC",
    }
  }
}

Last updated