What You’ll Achieve:
- Understand key design principles for an optimal Off-Ramp user journey.
- Learn the quickest way to integrate the Off-Ramp widget using a client-side URL.
- Understand the basic parameters for configuring the Off-Ramp URL.
- Learn about handling post-transaction redirects.
Prerequisites
- An active Busha Business Account.
- Your Public API Key (refer to the How to Generate an API Key Guide if you don’t have one).
- A conceptual understanding of the Busha Off-Ramp Widget (refer to the Understanding the Off-Ramp Widget Overview).
- Basic knowledge of web development (HTML, JavaScript) or mobile app development.
Step 1: Integration Design and User Experience Best Practices
A successful Off-Ramp integration isn’t just about technical implementation. It’s about crafting an intuitive and efficient user journey. By incorporating these design principles, you can significantly enhance your users’ experience when buying crypto.| Requirement | Description |
|---|---|
| Multiple entry points | All partner apps should add multiple entry points to the off-ramp.
|
| Amount input | Partner apps with an amount input screen should show:
|
| Payout method selection screen | Partner apps with a payout method selection screen should show:
|
| Provider selection screen | Partner apps with multiple providers should show:
|
| Handle crypto deposits | Partner apps with send functionality should handle crypto deposits for
users to ensure high transaction success rates.
|
| Transaction tracking | All partner apps should display a toast message after the user completes their transaction and use the ramp transfers API to display the transfer event timeline. |
| Mobile app configuration | All partner mobile apps, configure app and browser so KYC and payment
methods in the widget work correctly.
|
Step 2: Quick Start Integration with On-Ramp URL
Integrating the Busha Off-Ramp widget via a URL redirect is the quickest way to get Busha’s crypto buying functionality into your application. All you need to do is incorporate the integration design principles from Step 1, collect the necessary information from your users, and then construct a URL to which you redirect them.For sandbox requests, you can obtain test addresses from any of the providers
listed in the Test Addresses reference.
https://sandbox.buy.busha.io/ is the base URL for the Busha Off-Ramp widget in the Sandbox environment, and publicKey=pk_test_123 is your Public API Key passed as a query parameter.
Server-Side URL Construction
While direct client-side URL construction is quick, we strongly recommend that you build the Off-Ramp URL on your application’s server-side. This approach offers several benefits:
- Security: Keeps your Public API Key (though less sensitive than the Secret Key) from being directly exposed in your client-side source code, where it could be easily scraped.
- Flexibility: Allows you to dynamically generate complex URLs with various parameters based on real-time data, user selections, and API responses (e.g., from the Pairs or Quotes API) without exposing your internal logic.
- Reliability: Ensures that the URL is always correctly formatted and includes all necessary parameters.
window.open() or redirect.Configuring the Integration URL with Parameters
To pre-fill information and customize the user experience (as described in Step 1), you’ll add more query parameters to the base URL. This allows you to pass user selections directly to the widget, speeding up their journey. Common parameters you might include are:| Parameter | Required | Description |
|---|---|---|
publicKey | Yes | Specify the Business PublicKey to recognize that a transaction is referred by a specific business’ application. |
side | Yes | Specify whether the customer intends to buy or sell |
cryptoAsset | No | Specify the cryptocurrency asset (e.g., BTC, ETH, MATIC) for the
customer’s purchase. The customer must use the specified cryptocurrency
|
network | No | Specify the cryptocurrency network (e.g., ERC20, POLYGON) for the customer’s purchase. The customer must use the specified network - no substitutions are allowed. |
fiatCurrency | No | Specify the cryptocurrency asset (e.g., NGN, KES) for the customer’s
purchase. When passed, the customer must use the specified fiat currency
|
cryptoAmount | No | Specify the crypto amount to be processed. |
fiatAmount | No | Specify the fiat amount to be processed. If passed,
cryptoAmount is ignored. |
redirectUrl | Yes | URL to redirect the user to when they to complete a sell transaction. |
redirectUrl. Some parameters you should expect are:
| Parameter | Required | Description |
|---|---|---|
transferId | Yes | The represents the transfer that has just been completed or initiated. |
depositWalletAddress | Yes | Denotes the address that you should deposit the
cryptoAmount into. |
cryptoAsset | Yes | The crypto asset that should be deposited |
network | Yes | Specific network for the crypto asset. |
cryptoAmount | Yes | Required for Off-Ramp transfers. Denotes the crypto amount that should be deposited in the address |
fiatCurrency | No | Denotes the fiat currency for the transfer. |
fiatAmount | No | Denotes the fiat amount that will be credited to the payout destination or was paid to complete the purchase. |
redirectUrl should be able to receive and handle the returned values and process the deposit of the cryptoAmount into the depositWalletAddress upon users’ confirmation.
Troubleshooting
- Widget Not Loading/API Key Issues: Ensure that your
publicKeyis correctly passed in the URL, and that it is active in your Busha dashboard. - Redirect Issues: Verify that your
redirectUrlis correctly configured in the widget URL, and that your application endpoint is ready to receive and process the redirect. - Parameter Errors: Double-check that all passed URL parameters are spelled correctly and adhere to the expected format (e.g., correct currency codes, valid amounts).
What’s Next?
You’ve successfully learned how to integrate the Busha Off-Ramp widget! Consider these next steps to further enhance your Busha integration:- How to Integrate the On-Ramp Widget
- How to Generate an API Key: Review best practices for securing your credentials.
- Busha API Reference: Explore other Busha APIs, such as the Pairs API, to dynamically fetch available currencies and limits for a more advanced integration.