Use Case Overview
This recipe demonstrates a marketplace payment where:- ✅ User A deposits USD from their bank account
- ✅ USD automatically converts to USDC stablecoin
- ✅ USDC is transferred to User B wallet
- ✅ USDC is converted to HKD and sent to User B’s bank account
Prerequisites
Before you start, make sure you have:- API keys from the Dashboard (Get API keys)
- A tool for making API calls (cURL, Postman, or similar)
- Basic understanding of REST APIs
- Your sandbox endpoint:
https://sandbox.hifibridge.com
All examples in this guide use the sandbox environment. When you’re ready for
production, simply replace the sandbox URL with the production endpoint and
use your production API keys.
What you’ll build
Here’s what we’ll accomplish in this recipe:- Generate API Keys - Set up authentication for HIFI API
- Create Individual User A (Buyer) - Onboard US customer and complete KYC for USD rail
- Add Virtual Account - Set up account for USD deposits that convert to USDC
- Create Business user B (Seller) - Onboard Hong Kong seller (or use existing business)
- Execute Payment - Send USDC from User A wallet to User B wallet
- Initiate Offramp - Convert crypto funds to User B HKD bank account
Generate API Keys
Access to the HIFI API requires authentication via API keys. Generate your keys from the HIFI Dashboard before making any API calls.Get Your API Keys
Get Your API Keys
Steps:For a complete guide on API authentication, see our Authentication Documentation.
- Navigate to dashboard.hifibridge.com
- Log in to your account
- Go to Developer → API Keys
- Click Generate New Key
- Select your environment: Sandbox (for testing) or Production (for live transactions)
- Copy the key immediately - it’s only shown once
- Store your API key securely (environment variables, secrets manager, etc.)
- Never commit API keys to version control
- Your key authenticates all HIFI API requests
- If compromised, immediately revoke in the Dashboard and generate a new one
Authorization header of all API requests:Create User A (Sender)
The buyer needs a verified user account to access fiat rails and make purchases. Every user must accept HIFI’s Terms of Service and complete KYC verification before they can move money between fiat and crypto.Complete Onboarding Guide: For a comprehensive walkthrough of user
onboarding and KYC verification, see our User Guide.
User Creation Flow
Creating a user involves four steps:- Generate Terms of Service Link - Get acceptance link for your customer
- Create User - Create the user account after TOS acceptance
- Update KYC Information - Provide required personal details
- Submit KYC - Submit for verification to unlock USD rail
Generate Terms of Service Link
Generate Terms of Service Link
Before creating a user, they must accept HIFI’s Terms of Service. Generate a unique acceptance link using the Generate Terms of Service Link endpoint.Request:Request Fields:Response:Response Fields:What to do with this response:
A unique UUID that becomes your
signedAgreementId after the user accepts the
terms. Generate this using any UUID
generator.The unique link where your user will review and accept HIFI’s Terms of
Service.
The agreement ID (same as your
idempotencyKey). Save this - you’ll need
it to create the user in the next step.- Direct your user to the
url- Present this link to your end user (via email, in your app, etc.) - Save the
signedAgreementId- You’ll need this to create the user in the next step - Wait for acceptance - The
signedAgreementIdbecomes valid only after the user clicks “Accept”
Real-time Notifications: HIFI triggers the
TOS_LINK.UPDATE webhook event
when the user accepts the terms, allowing you to proceed with user creation
immediately. Learn about webhooks →Create User
Create User
Once your user has accepted the Terms of Service, create the user account with the Create User endpoint.Request:Request Fields:Response:✅ User created successfully!Response Fields:What you get:
User type. Use
individual for personal accounts or business for business
accounts.User’s first name.
User’s last name.
User’s email address.
User’s date of birth in YYYY-MM-DD format.
User’s residential address.
The
signedAgreementId from the Terms of Service acceptance.Unique identifier (UUID) for this request to ensure idempotency.
The unique user ID. Save this - you’ll use it for all future operations
with this user.
Automatically provisioned wallet addresses on supported blockchain networks.
- User ID (
3b77cec8-1bb9-5ea0-91a1-e8c1411dd429) - Save this for all future operations - Wallet addresses - Pre-provisioned on multiple blockchains, ready to use immediately
Automatic Wallet Provisioning: Every user automatically receives wallet
addresses on supported blockchain networks (Polygon, Ethereum, etc.). These
wallets are fully functional immediately - no additional setup required.
Update KYC Information
Update KYC Information
Provide the required personal information for KYC verification using the Update KYC endpoint.Request:Request Fields:Response:✅ Personal information updated!
User’s first name (can be used to update if needed).
User’s phone number with country code (E.164 format).
Tax identification number (e.g., SSN for US users).
User’s nationality (ISO 3166-1 alpha-3 country code).
Document Upload: For a complete KYC submission in production, you’ll also
need to upload identity documents (passport, driver’s license, etc.). See the
Quickstart Guide for detailed document upload
instructions.
Submit KYC for USD Rail
Submit KYC for USD Rail
Submit the KYC application to unlock the USD rail using the Submit KYC endpoint.Request:Request Fields:Response:✅ KYC approved! USD rail is now active.Response Fields:
The currency rail to unlock. Use
USD for US Dollar operations.Overall KYC status.
ACTIVE means the USD rail is unlocked and the user can
now onramp and offramp USD.High-level review outcome.
Detailed review results broken down by category.
Sandbox Auto-Approval: In sandbox, KYC applications are typically
automatically approved within minutes. In production, review typically takes
1-3 business days.
Add Virtual Account (User A)
Now that User A has passed KYC, create a Virtual Account for onramping. This is a bank account number automatically created by HIFI that User A can deposit USD into. When fiat arrives, it’s automatically converted to USDC and sent to their wallet.Complete Virtual Account Guide: For more details on virtual accounts and
onramping, see our Virtual Accounts Guide.
Create Virtual Account
Create Virtual Account
A Virtual Account enables User A to deposit USD from their bank, which automatically converts to USDC on Polygon.Request:Request Fields:Response:✅ Virtual account created!Response Fields:
Fiat currency to deposit. Use
usd for US Dollars.Stablecoin to receive after conversion. Use
usdc for USD Coin.Blockchain network for the stablecoin. Options:
POLYGON, ETHEREUMThe unique virtual account ID. Save this for monitoring deposits.
Account status.
activated means it’s ready to receive deposits.Source configuration for fiat deposits.
Destination configuration for crypto conversion.
Most Important: Bank account details User A needs to send money to.
How to Use: Provide these deposit instructions to User A through your
app/website. When they send money to this account via their bank, HIFI
automatically detects the deposit, converts it to USDC, and sends it to their
wallet. For monitoring deposits, subscribe to
ONRAMP.CREATE webhook events.Create Business B (HK Seller)
The recipient business (Business B in Hong Kong) needs a wallet address to receive the payment. Follow the same business creation flow as User A, but complete KYB for the appropriate Hong Kong rail.Using an Existing Business: If Business B already exists in your system,
you can skip business creation and just ensure they have an active wallet
address and Hong Kong bank account for later offramping. You’ll need either
their userid or walletaddress for the crypto transfer.
Required Information
To complete this recipe, you’ll need:- Business B’s
userId- From creating their business account - Business B’s
walletAddress- Provisioned upon creating the business user - Business B’s HKD
accountId- From adding their Hong Kong bank account
- Use Hong Kong business information and address details
- Submit KYB for the Hong Kong rail
- Add an Offramp Account (Hong Kong bank account) instead of a Virtual Account
Execute Payment
Now you can send the wallet transfer payment from User A (US) to Business B (Hong Kong). Create a crypto transfer that sends USDC from User A’s wallet to Business B’s wallet.Transfers can be sent to other HIFI users or external wallet addresses. For
this example, we will send to another HIFI user (Business B).
- Create crypto transfer request - Mark
requireApprovalas true in the request fields (User A) - Accept the transfer approval - Accept the approval through the Approve a transfer endpoint (Business B)
Create Crypto Transfer Request
Create Crypto Transfer Request
Create a crypto transfer request that requires approval by setting Request Fields:Response:Response Fields:
👉 Transfer Approvals Guide
requireApproval: true in the Create a Crypto Transfer endpoint.Request:Unique identifier (UUID) for this transfer request to ensure idempotency.
Source cryptocurrency (e.g., usdc, usdt).
Amount of USDC to send from User A’s wallet.
Blockchain network (e.g., POLYGON, ETHEREUM).
Source of the transfer (User A).
Destination of the transfer (Business B)
Unique crypto transfer transaction ID.
Transfer type.
Current status.
PENDING_APPROVAL means you have an active transfer approval
waiting to be accepted.Source details showing User A’s wallet.
Destination details showing Business B’s wallet info.
Amount of USDC being transferred.
Transfer approval details.
Understanding Transfer Approvals
After submitting a transfer request withrequireApproval: true:- The transfer status becomes PENDING_APPROVAL and does not execute
- Dashboard admins receive email notifications about the pending approval
- Authorized admins review and either approve or reject the transfer
- If approved → transfer executes normally. If rejected, transfer is cancelled
👉 Transfer Approvals Guide
Execute Offramp
With the approved transfer, Business B now has everything they need to transfer the USDC funds from their wallet into their HKD bank account. This is a two-step process:- Create offramp request - Get a quote for the conversion
- Accept the quote - Execute the payment
Required Information
In order to execute the offramp and complete this recipe, follow these steps:- Create an offramp request with the source (wallet, chain, amount) and destination (fiat account), optionally including developer fees.
- Review the returned quote—rate, fees, send/receive amounts, and expiration—in
transferDetails.quoteInformation. - Confirm status is
OPEN_QUOTEand savetransferDetails.idto track and accept the quote. - Accept the quote via
POST /v2/offramps/{id}/quote/acceptto convert stablecoins to fiat and initiate payout. - Monitor statuses through crypto and fiat phases (e.g.,
CRYPTO_INITIATED→ completion) using the receipt fields or webhooks.
🎉 Congratulations!
You’ve successfully completed a marketplace payment! By following this recipe, you can now:- ✅ Generate API keys and authenticate with HIFI
- ✅ Onboard users and complete KYC for multiple currency rails
- ✅ Create virtual accounts for fiat-to-crypto conversion
- ✅ Execute marketplace payments with transfer approvals
- ✅ Provide transparent fee structures and quote expiration
Next Steps
Ready to build a full marketplace payment platform? Here’s what to explore next:- Webhooks - Set up real-time notifications for transaction status updates and user engagement
- Offramp Guide - Deep dive into offramp transactions and compliance requirements
- Onchain Transfers - Learn how to initiate and track onchain wallet-to-wallet transfers
- Transfer Approvals - Configure optional approvals for higher-control transfer workflows
- Error Handling - Implement robust error handling for failed transactions and expired quotes
- API Reference - Explore all available endpoints and parameters for advanced features