Skip to main content
Privy provides an API integration with Bridge for bank transfer onramp and offramp flows. Bridge handles fiat-to-crypto conversion, crypto-to-fiat conversion, and settlement. This recipe details how an app can use Privy to integrate Bridge and provide a seamless fiat/crypto conversion experience for users. Using Privy’s APIs, your app can:
  • Link a Privy user with a Bridge customer account and their external bank accounts
  • Initiate onramp transactions (fiat-to-crypto conversion handled by Bridge)
  • Initiate offramp transactions (crypto-to-fiat conversion handled by Bridge)
  • Switch between Bridge sandbox and production environments

Setup

Configure your app to use Bridge for account funding

If you don’t already have a Bridge account, request access at Bridge and get Bridge API keys. Then, turn on the bank transfer method on the Integrations page in the Privy dashboard. Enter your Bridge API keys when prompted, and save. Bridge Configuration

Register a new user for onramp or offramp

When a user is onramping or offramping via Bridge for the first time, they must agree to their terms of service, as well as go through the KYC process.

Provide a terms of service agreement to the user

First, the user must agree to the onramp provider’s terms of service. Request a new terms of service url for a user: Then, add the query param redirect_uri to the url, so that after the user goes to that link and signs the terms of service, the user is redirected to your app. Upon redirect, a signed_agreement_id parameter will be in the url, which you will use for the next KYC step.

Submit the user’s KYC information

In order to onramp or offramp, the user must first be KYC’d. You can check their KYC status like so: If the user is not KYC’d yet, gather and submit their KYC information: Note: After submission, the KYC process takes about 1-2 minutes to undergo review. Sometimes, a manual review is required, which can take longer (a few hours).

Onramp funds

This assumes that all the above steps have been completed.

Trigger the onramp flow

Once the user is KYC’d, you can trigger the onramp flow. This will return deposit instructions for the user to complete, since they will need to send fiat funds to the onramp provider in order to receive stablecoins in their wallet. For example:
{
  "id": "3a61a69a-1f20-4113-85f5-997078166729",
  "deposit_instructions": {
    "amount": "100.0",
    "currency": "usd",
    "payment_rail": "ach_push",
    "account_holder_name": "account_holder_name",
    "bank_account_number": "11223344556677",
    "bank_address": "1800 North Pole St., Orlando, FL 32801",
    "bank_beneficiary_address": "1234 Elm St, Springfield, IL 12345",
    "bank_beneficiary_name": "Bridge Ventures Inc",
    "bank_name": "Bank of Nowhere",
    "bank_routing_number": "123456789",
    "bic": "bic",
    "deposit_message": "BRGFU2Z9TJPJXCS7ZZK2",
    "iban": "iban"
  },
  "status": "awaiting_funds"
}

Follow bank deposit instructions

If the onramp method is a bank transfer, the user will need to follow the specific instructions to send a bank deposit with the specified deposit message. If these instructions are not followed correctly, the onramp will fail.

Offramp

This assumes that that the Terms of Service and KYC process have been completed for the user.

Register a fiat account to offramp to

In order for Bridge to offramp and send fiat funds to the user, the user must first register a fiat account (e.g. bank account) with them.

Trigger the offramp flow

Once the user has a fiat account registered, you can trigger the offramp flow. In this flow, stablecoins must be sent from the user’s wallet to the onramp provider’s on-chain address.
To check on a status of an onramp or offramp, you can go to the Wallets page in the Privy dashboard, and click on the wallet. On the sidebar, go to the Fiat transactions tab.