Initialize Transaction - API
Direct API Integration
There are 2 steps involved in creating a transaction via API on Basqet.
- Step 1: Initializing the transaction
- Step 2: Initiating the Transaction
Initialize Transaction API
API Details
Action: Initialize Transaction
Method: POST
Path: /v1/transaction
Auth Requirement: Public/Private Key
Business Summary
This endpoint serves as the entry point for processing payments through Basqet. It creates a transaction object which can be initiated to collect payments from your customers. Once initialized, this object provides the necessary reference and structure to proceed.
You can use this API to:
- Send your customer's details to Basqet to generate a unique transaction record before they pay.
- Use the resulting transaction ID to provide your customer with the specific wallet address and payment info they need to complete their crypto transfer.
Request Parameters
Query Parameters
| Name | Type | Required | Default | Allowed Values | Description |
|---|---|---|---|---|---|
| customer | object | Yes | - | - | Customer’s details for the transaction |
| customer.name | string | No | null | - | Customer's full name. |
| customer.email | string | Yes | - | Any valid email e.g [email protected] | Customer's email address |
| public_key | string | Conditionally | - | Prefixed with pub_ | Required when the public key is not sent in the Authorization header. |
| payment_link | string | Conditionally | - | Prefixed with pl_ | Payment link slug. Cannot be sent alongside public_key. |
| currency | string | Yes | NGN | USD or NGN | The fiat currency slug for the transaction |
| amount | string | Yes | - | Numeric string | Transaction amount to be paid in the specified currency (e.g., "1500"). |
| description | string | No | null | - | Transaction’s description |
| meta | object | No | null | — | Any custom data you want to pass. The data will be returned in the response |
Request Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Conditionally | Bearer token in the form `Bearer pub_...`. Optional if `public_key` is passed in the request body. |
| Content-Type | string | Yes | application/json |
Request Examples
cURL
curl \--request POST \
--url <https://api.basqet.com/v1/transaction> \
--header 'Authorization: Bearer pub\_live\_xxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"customer": {
"name": "Test User",
"email": "[email protected]"
},
"currency": "USD",
"amount": "1000.00",
"description": "Test Transaction \#001",
"meta": {
"test\_mode": true,
"cart\_id": "999"
}
}'
Response Schema
| Field | Type | Nullable | Description |
|---|---|---|---|
| status | string | No | Response status. Always success for 2xx responses |
| data | object | No | Container for the transaction details. |
| data.id | string | No | Unique internal identifier for the transaction |
| data.reference | string | No | The transaction reference for the merchant |
| data.amount_paid | number | Yes | The actual amount received. Remains null until payment is made. |
| data.status | string | No | Current state of the transaction. Initial value is INITIATED. |
| data.description | string | Yes | Transaction’s description provided. null if omitted |
| data.initialized_amount | number | No | The fiat amount to be paid specified during the request. |
| data.payment_amount | number | Yes | The amount to be paid in crypto. null until the payment is initiated. |
| data.payment_address | string | Yes | Destination Crypto payment address. null until payment is initiated. |
| data.payment_currency | number | Yes | Internal currency ID for the selected fiat currency. It is null until payment is initiated. |
| data.initialized_currency | number | No | Internal currency ID for the fiat currency used to initialize the transaction. |
| data.is_live | boolean | No | Flag indicating if the transaction is in Live mode (true) or Test mode (false) |
| data.merchant | object | No | Information about the merchant account. |
| data.merchant.id | number | No | Unique internal identifier for the merchant. |
| data.merchant.name | string | No | Merchant display name. |
| meta | object | No | Echo of the request meta payload, or {} when omitted. |
Sample Response
"status": "success",
"data": {
"id": "BASQET\_TXN\_REF\_12345",
"reference": "BASQET\_TXN\_REF\_12345",
"amount\_paid": null,
"status": "INITIATED",
"description": "Invoice \#1024",
"initialized\_amount": 1500,
"payment\_amount": null,
"payment\_address": null,
"payment\_currency": null,
"initialized\_currency": 1,
"is\_live": true,
"merchant": {
"id": 10,
"name": "Acme Store"
}
},
"meta": {
"order\_id": "order\_1024",
"channel": "web"
}
}
Error Reference
| HTTP Code | Message | Resolution |
|---|---|---|
| 400 | Validation Error | Ensure all required fields (customer.email, amount, currency) are present, the email is valid, and the amount is a numeric string. This also occurs if both public_key and payment_link are sent together. |
| 404 | Invalid Public Key | Verify that the public_key or payment_link is correct, the merchant account is active, and the fiat currency slug is supported. |
| 422 | Varies based on KYC status | Ensure the merchant has completed the required KYB verification for live-mode transactions before attempting to initialize. |
| 500 | Internal server error | An unexpected error occurred. Please retry the request or contact Basqet support. |
Notes
public_keyin the body andAuthorization: Bearer pub_...are interchangeable for this endpoint.- Sending
Authorization: Bearer sec_...currently does not create a transaction successfully because the controller still looks up the key as a public key.
Webhook Payload
When a transaction is initialized, we make a POST request to your webhook URL. This is the format of the webhook payload you will receive:
{
"event": "payment.initiated",
"data": {
"transaction": {
"reference": "bq_B09BMmXXgWMzRSmon",
"merchant_name": "Appstate",
"payment_currency": null,
"payment_currency_name": null,
"payment_currency_slug": null,
"status": "INITIATED",
"customer_email": "[email protected]",
"customer_name": "tunde",
"payment_amount": null,
"amount_paid": null,
"description": null,
"is_live": false,
"created_at": "2022-07-14T20:17:11.000Z",
"meta": {}
}
}
}
Initiate Transaction API
API Details
Action: Initiate Transaction
Method: POST
Path: /v1/transaction/:transaction_id/pay
Auth Requirement: None
Business Summary
This endpoint updates the transaction object by assigning a cryptocurrency to it and returning the calculated value and a payment address assigned to it.
You can use this API to:
- Select the specific cryptocurrency the customer wants to use to convert an INITIATED transaction into a live payment request.
- Transition the transaction to the PENDING state to generate a unique wallet address and a QR code for the customer.
- Lock in the real-time conversion rate to determine the exact amount of crypto the customer needs to send.
Request Parameters
Path Parameters
| Name | Type | Required | Default | Allowed Values | Description |
|---|---|---|---|---|---|
| transaction_id | string | Yes | - | - | The unique identifier of the transaction |
Query Parameters
| Name | Type | Required | Default | Allowed Values | Description |
|---|---|---|---|---|---|
| currency_id | string | Yes | - | Tether : 3, Bitcoin : 4, Quidax Token: 5, Ethereum: 6, Litecoin: 7 | The unique identifier of the cryptocurrency the customer wishes to pay in. |
| refund_address | string | No | - | - | Optional refund address stored in transaction’s metadata. |
Request Headers
| Name | Type | Required | Default | Allowed Values | Description |
|---|---|---|---|---|---|
| Authorization | string | Yes | - | - | Bearer YOUR_SECRET_KEY |
| Content-Type | string | Yes | application/json | application/json | The media type of the resource. |
Request Examples
cURL
curl --request POST \
--url https://api.basqet.com/v1/transaction/BASQET\_TXN\_REF\_12345/pay \
--header 'Content-Type: application/json' \
--data '{
"currency\_id": 2,
"refund\_address": "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113"
}'
Response Schema
| Field | Type | Nullable | Description |
|---|---|---|---|
| status | string | No | Status of the API request |
| data | object | No | Object for the transaction details |
| data.id | integer | No | Unique internal identifier for the transaction |
| data.reference | string | No | The transaction reference for the merchant |
| data.description | string | Yes | The Transaction description provided during initialization |
| data.initialized_amount | number | No | The original fiat amount |
| data.initialized_currency | string | No | The fiat currency slug (e.g., USD, NGN). |
| data.payment_amount | number | No | The amount in crypto to be sent |
| data.amount_paid | number | Yes | null until payment is confirmed on-chain. |
| data.payment_currency | number | Yes | Internal currency ID for the selected fiat currency. It is null until payment is initiated. |
| data.payment_address | string | No | The destination wallet address |
| data.status | string | No | The current status of the transaction. Becomes `PENDING` after successful initiation |
| data.qrCode | string | No | Base64 data URL of the QR code for the payment_address. |
| data.is_live | boolean | Yes | Indicates if the transaction is in live or test mode |
| data.merchant | object | No | Information about the merchant account |
| data.merchant.id | integer | No | Unique identifier for the merchant |
| data.merchant.name | string | No | The registered name of the merchant |
| data.meta | object | Yes | Additional configuration like fee bearer and refund address |
Sample Response
{
"status": "success",
"data": {
"qrCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"id": "BASQET_TXN_REF_12345",
"reference": "BASQET_TXN_REF_12345",
"amount_paid": null,
"status": "PENDING",
"description": "Invoice #1024",
"initialized_amount": 1500,
"payment_amount": 0.002357,
"payment_address": "bc1qexampleaddress",
"payment_currency": "BTC",
"initialized_currency": "USD",
"is_live": true,
"merchant": {
"id": 10,
"name": "Acme Store"
}
},
"meta": {}
}
Error reference
| HTTP Code | Message | Resolution |
|---|---|---|
| 400 | Missing/invalid payload fields | Ensure currency_id is present and numeric, and that the refund_address format is valid. |
| 404 | Varies | Occurs if the transaction_id is invalid, the selected currency_id is not supported, or the merchant's subaccount/processor is not configured. |
| 422 | The transaction is not initiated | Verify that the transaction is still in the INITIATED state. This also occurs if the merchant account is inactive. |
| 500 | Internal server error | An unexpected server-side error occurred. Retry the request or contact support. |
| 503 | Varies | An upstream error occurred while generating the price quote or the wallet address. Retry the request. |
Webhook Payload
Payment Pending (payment.pending)
payment.pending)When a transaction has been initiated and is awaiting payment, we make a POST request to your webhook URL (as set up in your dashboard). This is the format of the webhook payload you will receive:
{
"event": "payment.pending",
"data": {
"transaction": {
"reference": "bq_B09BMmXXgWMzRSmon",
"merchant_name": "Appstate",
"payment_currency": 6,
"payment_currency_name": "Ethereum",
"payment_currency_slug": "ETH",
"status": "PENDING",
"customer_email": "[email protected]",
"customer_name": "tunde",
"payment_amount": 0.001366,
"amount_paid": null,
"description": null,
"is_live": false,
"created_at": "2022-07-14T20:17:11.000Z",
"meta": {}
}
}
}
Payment Completed (payment.received)
payment.received)When a transaction is successfully completed and the merchant has received payment, we make a POST request to your webhook URL (as set up in your dashboard). This is the format of the webhook payload you will receive:
{
"event": "payment.received",
"data": {
"transaction": {
"reference": "bq_RkaUV0Zy3PGpQsT8c",
"merchant_name": "Bar BQ Express",
"payment_currency": 3,
"payment_currency_name": "Bitcoin",
"payment_currency_slug": "BTC",
"status": "SUCCESSFUL",
"customer_email": "[email protected]",
"customer_name": "John Doe",
"payment_amount": 1,
"amount_paid": 1,
"description": "Payment for Lamborghini",
"is_live": false,
"created_at": "2026-02-09T16:18:20.000Z",
"meta": {}
}
}
}
Payment Abandoned (payment.abandoned)
payment.abandoned)When a transaction has been abandoned by the customer (e.g., the checkout session expires), we make a POST request to your webhook URL (as set up in your dashboard). This is the format of the webhook payload you will receive:
{
"event": "payment.abandoned",
"data": {
"transaction": {
"reference": "bq_B09BMmXXgWMzRSmon",
"merchant_name": "Appstate",
"payment_currency": 6,
"payment_currency_name": "Ethereum",
"payment_currency_slug": "ETH",
"status": "ABANDONED",
"customer_email": "[email protected]",
"customer_name": "tunde",
"payment_amount": 0.001366,
"amount_paid": null,
"description": null,
"is_live": false,
"created_at": "2022-07-14T20:17:11.000Z",
"meta": {}
}
}
}
Verify Transaction
Verify Transaction API
API Details
Action: Verify Transaction
Method: GET
Path: /v1/transaction/:transaction_id/status
Auth Requirement: Public or Secret Key (Bearer Auth)
Business Summary
This endpoint verifies the current status of a transaction using its unique transaction ID. It returns the latest transaction details, allowing you to check the current state of the customer's transaction.
Updated 5 days ago