The response example provided is a shortened version and does not include the full set of fields. For the complete response body details, please refer to the full API specification.
Request Example:
POST https://api.inqud.com/v1/user/crypto-acquiring/{projectId}/checkouts
projectId is the ID of the widget
Header
Value
X-Token-API-Id
{tokenApiId}
X-Token-API-Secret
{tokenApiSecret}
Request Body Example:
{
"clientOrderId": "12345676890",
"expiresAt": "2024-12-01T12:00:00Z",
"name": "My website balance top up",
"returnUrl": "https://example.com/return",
"type": "NO_PRICE"
}
The response example provided is a shortened version and does not include the full set of fields. For the complete response body details, please refer to the full API specification.
Request Example:
POST https://api.inqud.com/v1/user/crypto-acquiring/{projectId}/checkouts
The response example provided is a shortened version and does not include the full set of fields. For the complete response body details, please refer to the full API specification.
The id from the server response, which begins with CCO- is the {checkoutId} you will use to initialize the widget.
Note: The {checkoutId} is the identifier for the checkout, which you have created in the previous step.
Embedded widget has a fixed width of 392px
3. Define JavaScript callback [optional]
Provide a JavaScript function to receive checkout status updates and adjust your frontend accordingly.
// Define callback function
function handleCheckoutStatusChange(event) {
const checkoutId = event.detail.id;
const status = event.detail.status;
console.log(`Callback Invoked: checkoutId=${checkoutId}, status=${status}`);
// Handle the status change according to your business logic
if (status === 'SUCCESS') {
// Payment was successful, update the frontend accordingly
} else if (status === 'CONFLICT') {
// Payment is in conflict, update the frontend accordingly
}
}
// Wait for the widget to load
document.addEventListener('DOMContentLoaded', function() {
const widget = document.querySelector('app-widget');
// Register "handleCheckoutStatusChange()" for receiving callbacks
if (widget) {
widget.addEventListener('statusChanged', handleCheckoutStatusChange);
}
});
In this example, the handleCheckoutStatusChange function is called whenever the status of the checkout changes. The checkoutId and status are then extracted from the event.details object and used to update the frontend according to the business logic of the merchant.
The widget variable is initialized to the app-widget element which represents the crypto widget. An event listener is then added to the widget that listens for status changes. When a status change occurs, the handleCheckoutStatusChange function is called with the event object as an argument.