Advanced features of Invoice creation
The Invoice creation API
The Invoice creation API endpoint is a complex all-in-one endpoint, that routes a customer to a corresponding payment flow based on the parameters sent be the merchant.
This API endpoint accepts several optional parameters that may be used to streamline the customer experience.
The full API endpoint specification is available at the end of this page.
Below there are the features supported by the Invoice creation API.
Applications
The request to create an invoice may specify application using applicationId
. This is an optional parameter used to customise the look and feel of the checkout page. Every application contains its own settings set to tailor the checkout page for different needs (example - different brands under the same merchant).
Pre-populate the form for KYC
The KYC flow through the Checkout V2 supports pre-population of fields in case your service already has the personal data of the customers. This function is only available for banking onramp. In order to pre-populate the form add the information into the URL parameters (query parameters) when working with an invoice. See the example below:
Displayed currencies
It is possible to show to a customer a subset of supported currencies. To do this pass the displayCurrencies
array.
Dynamic redirections
The API supports redirectUrl
parameter. The provided URL is used to redirect a customer in case of a failed or successful deposit.
The Invoice creation API specification
The customer identifier is a mandatory field, which must contain the id of the customer, used in your system. This id is sent back in the callbacks on every deposit in order to link deposits with corresponding customers.
The order identifier is an optional parameter, which will be sent back to your system with a callback for the deposit linked to this exact invoice.
Please read more about invoice currencies here.
Creates an invoice using a fixed or floating exchange rate strategy. The invoice is generated based on the provided parameters including amount, base currency, customer ID, order ID (optional).
This API creates an invoice and returns a checkout link, that should be served to a customer.
If paymentCurrency
is provided and all required activation parameters for a specific payment are included
(customerFirstName
, customerLastName
, customerEmail
, customerCountry
, customerPhone
, customerAccount
), the invoice is instantly activated.
A base currency in this end point is the currency a customer will typically see on the merchant cashier page. Example: A customer wants to deposit 10 EUR of ETH. In this case the base currency is EUR.
A payment currency is the currency that is actually deposited by the customer and available for settlement by the corresponding merchant. Example: A customer wants to deposit 10 EUR of ETH. In this case the payment currency is ETH.
Access to this endpoint requires a valid API key. The API key is sent in the x-api-key
header on requests.
- The input data for creating an invoice.
Params:
- amount - The amount. Must be greater than 0.
- applicationId - The associated application ID in your system.
- baseCurrency - The base currency.
- customerId - The customer ID in the your system.
- orderId - The associated order ID in the your system.
- invoiceStrategy - The invoice strategy. "floating" || "fixed"
- displayCurrencies - The list of currencies to display to the customer.
- customerAccount - The Customer Account number in payment system.
- customerCountry - The ISO 3166-1 alpha-2 country name.
- customerEmail - The email address.
- customerFirstName - The first name.
- customerLastName - The last name.
- customerPhone - The phone number.
- paymentCurrency - The currency in which the payment will be made.
- redirectUrl - The URL to which the customer will be redirected after completing checkout.
Represents all currencies in the payment processing system.
Used to specify the currency of accounts, exchange rates, and transactions in the payment processing system.
It provides a controlled and standardized list of supported currencies for all transactions and balances in the payment processing system.
New currencies can be added to the payment processing system as additional members.
Represents all currencies in the payment processing system.
Used to specify the currency of accounts, exchange rates, and transactions in the payment processing system.
It provides a controlled and standardized list of supported currencies for all transactions and balances in the payment processing system.
New currencies can be added to the payment processing system as additional members.
Represents the possible strategies of an invoice.
Represents all currencies in the payment processing system.
Used to specify the currency of accounts, exchange rates, and transactions in the payment processing system.
It provides a controlled and standardized list of supported currencies for all transactions and balances in the payment processing system.
New currencies can be added to the payment processing system as additional members.
POST /api/v2/invoices HTTP/1.1
Host: api.xgateway.tech
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 487
{
"amount": 0.1,
"applicationId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8",
"baseCurrency": "BNB",
"customerAccount": "2004169722",
"customerCountry": "AU",
"customerEmail": "[email protected]",
"customerFirstName": "John",
"customerId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8",
"customerLastName": "Doe",
"customerPhone": "79111234567",
"orderId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8",
"invoiceStrategy": "floating",
"displayCurrencies": "BNB",
"paymentCurrency": "BNB",
"redirectUrl": "https://example.com/redirect"
}
{
"data": "https://checkout.xgateway.tech/ff36a7a5-08fd-418a-a150-f6f2d36676a8",
"success": true
}
Headers
x-api-key*
String
Your API key
Session Time To Live
Invoices at the moment of creation have no expiration time. After invoice activation on the checkout page (when the customer selects the payment currency and clicks "Proceed"), the system will set an expiration time according to invoice TTL. Once an invoice has expired, the link will show an error.
You can make several requests for the same customer with a different amount/base currency and get a different checkout link back.
Under and over payment
Please review this page to get more information about cases, when a customer overpays an invoice, underpays an invoice or does a deposit with no invoice at all.
Last updated