What You’ll Achieve:
- Understand the basic structure for requesting a Quote.
- Successfully generate a Quote for a currency conversion.
- Learn how to use source_amount vs target_amount in your requests.
-
Explore how to include optional
pay_inandpay_outdetails in your Quote requests. - Interpret a successful Quote response.
Prerequisites
Before you begin, ensure you have:- A Busha Business Account and Secret API Key (from the Quick Start Tutorial).
- An understanding of API Environments (Sandbox vs. Production) and their base URLs (from the Make Your First Request Guide).
- A conceptual understanding of Quotes (from the Quotes explainer).
For deposit requests involving a customer, the
X-BU-PROFILE-ID field should
be included in the request header, and its value should be set to the customer
ID for whom the request is performed on their behalf.How to Create Your First Quote
1
Understand Quote Creation Parameters
The core of creating a Quote involves specifying the currencies and the amount of the transfer. Remember, you must provide either the
source_amount or target_amount, but not both.The essential parameters for creating a quote are:| Parameter | Data Type | Required/Optional | Description |
|---|---|---|---|
source_currency | string | Required | The currency you’re sending. |
target_currency | string | Required | The currency you’re receiving. |
source_amount | string | Optional | The amount of source_currency you want to send. |
target_amount | string | Optional | The amount of target_currency you want to receive. |
pay_in | object | Optional | Details about the incoming transfer method. |
pay_out | object | Optional | Details about the outgoing transfer method. |
2
Create a Basic Quote (Conversion Example)
Let’s create a simple Quote for currency conversion (e.g., converting from NGN to BTC).To create a basic quote:Expected Response:A successful response will return a Quote object, providing the id for this quote, the calculated
- Open your terminal or command prompt.
-
Use the
POSTrequest below to the/v1/quotesendpoint. -
Replace
YOUR_BASE_URLwith your chosen environment’s URL and{YOUR SECRET_KEY}with your actual key. -
Choose either source_amount or
target_amount. In this example, we’ll specifysource_amount
target_amount, the rate, fees, and the expires_at timestamp.-
Note the
idof the Quote. You’ll use this id to execute the transaction (e.g., conversion, deposit, or payout) in a subsequent step. -
Check
expires_at: Always ensure that the quote’sexpires_attime has not passed before attempting to use it.
3
Create a Quote with `pay_in` Details (for Deposits)
For certain transaction types like deposits (PayIns) or direct crypto purchases, you might need to specify details about the incoming payment method using the Expected ResponseThe Quote response itself will be similar to the basic one, with the
pay_in object in your quote request. This helps Busha generate accurate deposit instructions.To create a quote for a deposit (e.g., crypto):-
Use a
POSTrequest to/v1/quotesas before. -
Include the
pay_inobject with relevant details. For a crypto deposit, this might include thenetwork.
pay_in object included in the response.4
Create a Quote with `pay_out` Details (for Payouts/Withdrawals)
When initiating a payout (withdrawal) from your Busha account, you’ll need to specify details about the outgoing payment method using the Expected Response:The Quote response itself will be similar to the basic one, with the
pay_out object. This guides Busha on where and how to send the funds. This also typically requires a recipient_id.To create a quote for a payoutFor payouts to bank accounts, ensure you have a
recipient_id for the bank
account you wish to pay out to. (Refer to: How to Create and Manage
Recipients Guide)-
Use a POST request to
/v1/quotes. -
Include the
pay_outobject with details for the target recipient and channel.
pay_out object included in the response.Troubleshooting Common Quote Creation Issues
- “Quote expired” in subsequent transaction: The quote ID you received was valid when created, but expired before you used it. Always generate a fresh quote immediately before executing the transaction.
-
“One of target and source amount must be set”: You included both
source_amountandtarget_amountin your request. Remove one. -
401 Unauthorized: Double-check that your secret API key is correct.
What’s Next?
Once you have successfully created a Quote, the next step is to execute the actual transaction based on that Quote.- How to Get a Quote
- How to Process Fiat Deposits (PayIns) Guide
- How to Process Crypto Deposits (PayIns) Guide
- How to Make Payouts Guide
- How to Perform Currency Conversions Guide
-
API Reference: Quote Object: For a complete list of all parameters, sub-fields for
pay_inandpay_out, and their data types.