First-party onramps

Overview

Fern's first-party onramps enable your customers to convert fiat into crypto, delivering funds directly to their wallets. Fern onramps are accessible via API, allowing you to design a seamless and customized user experience.

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

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 bank account.

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 mins. Quotes provide transparent details, including the exact receiving amount and any applicable fees.

For more details, check out 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": {
        "bankAccountId": "072a8b7b-38c7-429a-a6cf-35dae7f2fb77",
        "paymentMethod": "wire",
        "currency": "USD"
    },
    "destination": {
        "walletAddress": "0xbf50fb9c99233f95bce213044507e58485cf9eba",
        "paymentMethod": "ethereum",
        "currency": "USDC"
    }
}'

Response

{
  "quoteId": "072a8b7b-3356-48b5-b2bb-6fca7b618c96",
  "exchangeRate": 1,
  "receivingAmount": 99.25,
  "minGuaranteedReceivingAmount": 99.25,
  "expiresAt": "2024-12-19T01:04:54.783Z",
  "fees": {
    "fernFee": {
      "type": "fern",
      "currency": "USDC",
      "amount": 0.75,
      "usdAmount": 0.75
    },
    "developerFee": {
      "type": "developer",
      "currency": "USDC",
      "amount": 0,
      "usdAmount": 0
    }
  }
}

3

Submit transaction

To create a transaction, use the quote ID to generate an onramp transaction. Once the transaction is created, you'll receive transfer instructions to share with your customer. Once funds are received at the transfer bank account, the destination currency is sent to the specified destination address, completing the transaction within seconds or minutes.

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": "072a8b7b-3356-48b5-b2bb-6fca7b618c96"
}'

Response

{
  "quoteId": "072a8b7b-3356-48b5-b2bb-6fca7b618c96",
  "transactionId": "908c4092-3a5e-44c8-ac4e-ad47993f00e9",
  "status": "AWAITING_TRANSFER",
  "receivingAmountDetails": {
    "amount": 99.25,
    "currency": "USDC",
  },
  "fees": {
    "fernFee": {
      "type": "fern",
      "currency": "USDC",
      "amount": 0.75,
      "usdAmount": 0.75
    },
    "developerFee": {
      "type": "developer",
      "currency": "USDC",
      "amount": 0,
      "usdAmount": 0
    }
  },
  "exchangeRate": 1,
  "transferInstructions": {
    "type": "onramp",
    "paymentMethod": "wire",
    "transferMessage": "Test onramp wire",
    "transferBankName": "Chase",
    "transferBankAddress": "10 Downing Steet",
    "transferBankRoutingNumber": "1234",
    "transferBankAccountNumber": "10029000",
    "transferBankBeneficiaryName": "Fern Money"
  }
}

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/908c4092-3a5e-44c8-ac4e-ad47993f00e9' \
--header 'Authorization: Bearer <API_TOKEN>'

Response

{
  "quoteId": "072a8b7b-3356-48b5-b2bb-6fca7b618c96",
  "transactionId": "908c4092-3a5e-44c8-ac4e-ad47993f00e9",
  "status": "AWAITING_TRANSFER",
  "receivingAmountDetails": {
    "amount": 99.25,
    "currency": "USDC",
  },
  "fees": {
    "fernFee": {
      "type": "fern",
      "currency": "USDC",
      "amount": 0.75,
      "usdAmount": 0.75
    },
    "developerFee": {
      "type": "developer",
      "currency": "USDC",
      "amount": 0,
      "usdAmount": 0
    }
  },
  "exchangeRate": 1,
  "transferInstructions": {
    "type": "onramp",
    "paymentMethod": "wire",
    "transferMessage": "Test onramp wire",
    "transferBankName": "Chase",
    "transferBankAddress": "10 Downing Steet",
    "transferBankRoutingNumber": "1234",
    "transferBankAccountNumber": "10029000",
    "transferBankBeneficiaryName": "Fern Money"
  }
}

Last updated