How to Create an Invoice Using REST API
Create an invoice via API
You can use our API to create invoices programmatically. Our API is well-documented, easy to integrate with your existing systems, and allows you to create invoices automatically from your e-commerce store.
- Receive all available invoice currencies: /v1/invoice/assets
- (Optional) Prepare all data for customization Customization
- Create invoice: /v1/invoice
Here’s an example of the minimal request body for creating an invoice:
{
"asset": "EUR",
"amount": "1000",
}
Callbacks
Callbacks for invoices in the standard mode operate when there is a change in the invoice status, but it is also possible to enable transactional callbacks for each deposit associated with the invoice.
To receive callbacks for an invoice, you need to pass the following parameters when creating /v1/invoice:
{
callbackUrl: string;
shouldSendTransactionalCallback?: boolean; // If you want to receive a callback for each deposit.
}
You can read more about callbacks in this article Callbacks
Customization
Redirect the user once the invoice is paid
There is an option to redirect the user to a specific page after the invoice has been paid. To achieve this, you can pass the following parameters when creating an invoice through the RestAPI
:
{
customization?: {
redirectUrl: string; // URL to redirect the user once the invoice is paid.
redirectButtonTitle?: string; // Custom text to display on the button for redirecting the user.
}
}
The specified redirectUrl
will have parameters added to identify which invoice the redirect corresponds to. These parameters include:
{
invoiceId: string; // UUID
orderId?: string; // externalOrderId from Invoice
}
Example URLs:
- https://example.com/order?invoiceId=506c695a-4187-4463-ac41-07dc0782cb0e&orderId=external-order-id
- https://example.com/order?invoiceId=c08db5ab-093f-4dd8-81c7-8065ffbbe955
Gather info about the Buyer
There is a possibility to collect information about the Buyer before paying the Invoice. To do this, you can pass the following parameters when creating an invoice through the RestAPI:
{
questionnaire: {
schemaFields: [
{
name: string
}
]
}
}
The available fields can be obtained through the route in RestAPI: /v1/invoice/questionnaire
Updated 10 days ago