Skip to main content
All CollectionsProduct
How to Integrate Transfers in Your Website/App
How to Integrate Transfers in Your Website/App
Rey avatar
Written by Rey
Updated over a month ago

Integrating Transfers into your website or app enables seamless on-ramp and off-ramp transactions, allowing merchants to move funds between bank accounts and wallets. Whether you’re facilitating crypto-to-fiat conversions or vice versa, SpherePay’s Transfer API provides a secure and efficient solution.

For an in-depth explanation of Transfers and how on-ramps and off-ramps work, refer to our support guide:
🔗 Understanding Transfer On/Off-Ramps


Key Components for Integrating Transfers

To set up Transfers, you need to work with the following core APIs:

1️⃣ Wallet API – Used for managing crypto wallets.
📌 API Reference: SpherePay Wallet API

2️⃣ Bank Account API – Used for managing fiat bank accounts.
📌 API Reference: SpherePay Bank Account API

Each transfer involves moving funds between wallets and bank accounts, depending on whether you're processing an on-ramp or off-ramp transaction.


On-Ramp vs. Off-Ramp Transfers

Transfer Type

Source

Destination

On-Ramp

Bank Account (Fiat)

Wallet (Crypto)

Off-Ramp

Wallet (Crypto)

Bank Account (Fiat)


Steps to Integrate Transfers

Step 1: Set Up a Wallet and Bank Account

Before initiating a transfer, ensure that the wallet and bank account exist.

Create a Wallet

Use the Wallet API to create or retrieve a customer’s crypto wallet:

POST https://api.spherepay.co/v2/wallet
{
"network": "sol",
"address": "BTkpRfK8L5Yy7A8wimA4CXra2GhFxdSWK944Ap6dPKCu"
}

Create a Bank Account

Use the Bank Account API to register a bank account:

POST https://api.spherepay.co/v2/bankAccount
{
"accountName": "John Doe Savings",
"bankName": "Bank of America",
"currency": "USD",
"beneficiaryAddress": {
"line1": "123 Elm Street,
"line2": "suite 456",
"city": "New York",
"postalCode": "10001",
"state": "NY",
"country": "USA"
},
"meta": {
"purpose": "Payroll Account",
"notes": "Main account for business transactions"
},
"lookupKey": "10000000001",
"accountDetails": {
"accountType": "checking",
"accountNumber": "123456789",
"routingNumber": "987654321"
}
}

Step 2: Initiate a Transfer

Once you have the Wallet ID and Bank Account ID, you can initiate a transfer using the Transfer API:

On-Ramp (Fiat → Crypto)

To convert fiat to crypto, the Bank Account is the source, and the Wallet is the destination:

POST https://api.spherepay.co/v2/transfer
{
"amount": "10.00",
"customer": "customer_f5bd32a916584675b739b8e2301f1480",
"source": {
"id": "bankAccount_3d67e78e590c4270bdebee7fc6d5075c",
"currency": "usd",
"network": "wire"
},
"destination": {
"id": "wallet_a25c82a765d0499a861cff1b3e8812f2",
"currency": "usdc",
"network": "sol"
}
}

Off-Ramp (Crypto → Fiat)

To convert crypto to fiat, the Wallet is the source, and the Bank Account is the destination:

POST https://api.spherepay.co/v2/transfer
{
"amount": "10.00",
"customer": "customer_f5bd32a916584675b739b8e2301f1480",
"source": {
"id": "wallet_a25c82a765d0499a861cff1b3e8812f2",
"currency": "usdc",
"network": "sol"
},
"destination": {
"id": "bankAccount_3d67e78e590c4270bdebee7fc6d5075c",
"currency": "usd",
"network": "wire"
}
}

📌 Note: Ensure that the currency is compatible between the source and destination accounts and that the correct network is specified.


Step 3: Set Up Transfer Fees (Optional)

Merchants can define transaction fees for each customer using the Transfer Fee API:
📌 API Reference: SpherePay Transfer Fee API

Example Request to Set a Transfer Fee

{ 
"bpsFee": "20",
"targetCustomerId": "customer_f5cf0fe1462d4edbb80b08b67bbd3da5"
}

Final Thoughts

Integrating SpherePay Transfers allows businesses to seamlessly move funds between bank accounts and wallets. Whether you're on-ramping fiat into crypto or off-ramping crypto into fiat, SpherePay’s APIs provide a secure, automated, and customizable solution.

🚀 Start integrating Transfers today and enhance your payment workflow with SpherePay!

Did this answer your question?