This example shows you how to integrate the Busha On-Ramp widget to let users buy cryptocurrency directly in your application.
Use Cases
- E-commerce site accepting crypto payments
- Wallet app letting users buy crypto
- Gaming platform selling in-game crypto assets
Basic Integration
The quickest way to integrate the On-Ramp widget is with a button that opens the widget in a new window:
<button
onclick="window.open('https://sandbox.buy.busha.io/?publicKey=YOUR_PUBLIC_KEY', '_blank')"
>
Buy Crypto with Busha
</button>
Live Demo
Try the On-Ramp widget below to see how it works in action:
Nigeria (NGN)
Kenya (KES)
Demo Note: This is a live sandbox widget. You can interact with it to see
the complete user flow, but no real money will be processed.
Iframe Integration
For a more embedded experience, use an iframe:
<iframe
src="https://sandbox.buy.busha.io/?publicKey=YOUR_PUBLIC_KEY"
width="100%"
height="700px"
style="border: 1px solid #e5e7eb; border-radius: 8px;"
title="Busha On-Ramp Widget"
></iframe>
Pre-filled Integration Examples
Nigeria (NGN)
Kenya (KES)
Buy Bitcoin with 50,000 NGN
<button
onclick="window.open('https://sandbox.buy.busha.io/?publicKey=YOUR_PUBLIC_KEY&side=buy&cryptoAsset=BTC&fiatCurrency=NGN&fiatAmount=50000&redirectUrl=https://your-app.com/success', '_blank')"
>
Buy Bitcoin with NGN
</button>
Buy to Specific Wallet Address
<button
onclick="window.open('https://sandbox.buy.busha.io/?publicKey=YOUR_PUBLIC_KEY&cryptoAsset=BTC&address=bc1qyourbitcoinaddress&network=BTC&fiatCurrency=NGN&redirectUrl=https://your-app.com/success', '_blank')"
>
Buy Bitcoin to My Wallet
</button>
Buy Bitcoin with 5,000 KES
<button
onclick="window.open('https://sandbox.buy.busha.io/?publicKey=YOUR_PUBLIC_KEY&side=buy&cryptoAsset=BTC&fiatCurrency=KES&fiatAmount=5000&redirectUrl=https://your-app.com/success', '_blank')"
>
Buy Bitcoin with KES
</button>
Buy USDT with M-Pesa
<button
onclick="window.open('https://sandbox.buy.busha.io/?publicKey=YOUR_PUBLIC_KEY&cryptoAsset=USDT&network=TRX&fiatCurrency=KES&fiatAmount=10000&redirectUrl=https://your-app.com/success', '_blank')"
>
Buy USDT with M-Pesa
</button>
Configuration Parameters
| Parameter | Required | Description |
|---|
| publicKey | Yes | Your Busha Public API Key |
| cryptoAsset | No | Cryptocurrency to buy (e.g., BTC, ETH, USDT) |
| network | No | Blockchain network (e.g., BTC, ERC20, POLYGON) |
| address | No | Pre-fill destination wallet address |
| fiatCurrency | No | Fiat currency (NGN for Nigeria, KES for Kenya) |
| fiatAmount | No | Amount in fiat currency |
| cryptoAmount | No | Amount in crypto (ignored if fiatAmount is set) |
| redirectUrl | No | URL to redirect after transaction completion |
React Component Examples
Nigeria (NGN)
Kenya (KES)
import React from "react";
function BuyBitcoinButton() {
const openOnRamp = () => {
const params = new URLSearchParams({
publicKey: "YOUR_PUBLIC_KEY",
cryptoAsset: "BTC",
fiatCurrency: "NGN",
fiatAmount: "50000",
redirectUrl: "https://your-app.com/success",
});
window.open(`https://sandbox.buy.busha.io/?${params.toString()}`, "_blank");
};
return <button onClick={openOnRamp}>Buy Bitcoin with Naira</button>;
}
export default BuyBitcoinButton;
import React from "react";
function BuyBitcoinButton() {
const openOnRamp = () => {
const params = new URLSearchParams({
publicKey: "YOUR_PUBLIC_KEY",
cryptoAsset: "BTC",
fiatCurrency: "KES",
fiatAmount: "5000",
redirectUrl: "https://your-app.com/success",
});
window.open(`https://sandbox.buy.busha.io/?${params.toString()}`, "_blank");
};
return <button onClick={openOnRamp}>Buy Bitcoin with KES</button>;
}
export default BuyBitcoinButton;
Complete Integration Flow
User Initiates Purchase
User clicks “Buy Crypto” button in your app
Redirect to On-Ramp Widget
Your app opens the Busha On-Ramp widget with pre-filled parameters
User Authentication
User logs in to Busha (or signs up), completes KYC if needed
User Reviews and Confirms
User reviews transaction details including rate and fees, then confirms the
purchase
User Selects Payment Method
User chooses their preferred payment method: - Nigeria: Bank transfer -
Kenya: M-Pesa or mobile money
User Completes Payment
User completes the payment through their selected method
Busha Processes Purchase
Once payment is confirmed, Busha processes the crypto purchase and sends it
to the user’s wallet
Learn More