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:

Query Params

Used to pre-fill customer data on the checkout page.

  • firstName

  • lastName

  • email

  • address1

  • address2

  • postCode

  • city

  • country: (ISO 3166-1 alfa-2 country code)

  • dateOfBirth: YYYY-MM-DD

  • sourceOfFunds: SALARY, BUSINESS_INCOME, PENSION, OTHER

Add all or some query params to a URL. Example of usage:

https://checkout.xgateway.dev/v2/invoice/4f61498c-6e80-4b15-a88a-b7e5a29292bd?firstName=Genry&lastName=Pollok&email[email protected]&address1=Some-Street 12 tn.2&address2=ap.3&postCode=12345&city=New York&country=US&dateOfBirth=1984-09-09&sourceOfFunds=SALARY

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

Note, that baseCurrency parameter defines the expected currency of the deposit. It does not change or affect the reference currency - the currency used for all the internal accounting for you as a merchant.

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.

Create an invoice for the customer for a specified currency and optional order id.

post

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.

Authorizations
Body
  • 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.
amountnumber ยท doubleRequired
applicationIdstringOptional
baseCurrencystring ยท enumRequired

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.

Supported cryptocurrencies:

  • BNB - Binance Coin
  • bUSDT - Tether (pegged to USD), issued on BNB Smart Chain network (BEP20 token)
  • BTC - Bitcoin
  • ETH - Ether
  • eUSDC - USD Coin (pegged to USD), issued on Ethereum network (ERC20 token)
  • eUSDT - Tether (pegged to USD), issued on Ethereum network (ERC20 token)
  • FTN - Fasttoken
  • POL - POL
  • pUSDC - USD Coin (pegged to USD), issued on Polygon network (ERC20 token)
  • SOL - SOL
  • sUSDT - Tether (pegged to USD), issued on Solana network (SPL token)
  • tUSDC - USD Coin (pegged to USD), issued on Tron network (TRC20 token)
  • tUSDT - Tether (pegged to USD), issued on Tron network (TRC20 token)
  • wpUSDC - wrapped USD Coin (pegged to USD), issued on Polygon network (ERC20 token)
  • wpUSDT - wrapped Tether (pegged to USD), issued on Polygon network (ERC20 token).

Supported fiat currencies:

  • AZN - Azerbaijani Manat
  • BDT - Bangladeshi Taka
  • EUR - Euro
  • GBP - Pound Sterling
  • INR - Indian Rupee
  • JPY - Japanese Yen
  • KES - Kenyan Shilling
  • PKR - Pakistani Rupee
  • RUB - Russian Ruble
  • TRY - Turkish Lira
  • USD - United States Dollar
  • UZS - Uzbekistani Som.
Possible values:
customerAccountstringOptional
customerCountrystringOptional
customerEmailstringOptional
customerFirstNamestringOptional
customerIdstringRequired
customerLastNamestringOptional
customerPhonestringOptional
displayCurrenciesany ofOptional
string ยท enumOptional

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.

Supported cryptocurrencies:

  • BNB - Binance Coin
  • bUSDT - Tether (pegged to USD), issued on BNB Smart Chain network (BEP20 token)
  • BTC - Bitcoin
  • ETH - Ether
  • eUSDC - USD Coin (pegged to USD), issued on Ethereum network (ERC20 token)
  • eUSDT - Tether (pegged to USD), issued on Ethereum network (ERC20 token)
  • FTN - Fasttoken
  • POL - POL
  • pUSDC - USD Coin (pegged to USD), issued on Polygon network (ERC20 token)
  • SOL - SOL
  • sUSDT - Tether (pegged to USD), issued on Solana network (SPL token)
  • tUSDC - USD Coin (pegged to USD), issued on Tron network (TRC20 token)
  • tUSDT - Tether (pegged to USD), issued on Tron network (TRC20 token)
  • wpUSDC - wrapped USD Coin (pegged to USD), issued on Polygon network (ERC20 token)
  • wpUSDT - wrapped Tether (pegged to USD), issued on Polygon network (ERC20 token).

Supported fiat currencies:

  • AZN - Azerbaijani Manat
  • BDT - Bangladeshi Taka
  • EUR - Euro
  • GBP - Pound Sterling
  • INR - Indian Rupee
  • JPY - Japanese Yen
  • KES - Kenyan Shilling
  • PKR - Pakistani Rupee
  • RUB - Russian Ruble
  • TRY - Turkish Lira
  • USD - United States Dollar
  • UZS - Uzbekistani Som.
Possible values:
or
invoiceStrategystring ยท enumOptional

Represents the possible strategies of an invoice.

Possible values:
localestringOptional
orderIdstringOptional
paymentCurrencystring ยท enumOptional

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.

Supported cryptocurrencies:

  • BNB - Binance Coin
  • bUSDT - Tether (pegged to USD), issued on BNB Smart Chain network (BEP20 token)
  • BTC - Bitcoin
  • ETH - Ether
  • eUSDC - USD Coin (pegged to USD), issued on Ethereum network (ERC20 token)
  • eUSDT - Tether (pegged to USD), issued on Ethereum network (ERC20 token)
  • FTN - Fasttoken
  • POL - POL
  • pUSDC - USD Coin (pegged to USD), issued on Polygon network (ERC20 token)
  • SOL - SOL
  • sUSDT - Tether (pegged to USD), issued on Solana network (SPL token)
  • tUSDC - USD Coin (pegged to USD), issued on Tron network (TRC20 token)
  • tUSDT - Tether (pegged to USD), issued on Tron network (TRC20 token)
  • wpUSDC - wrapped USD Coin (pegged to USD), issued on Polygon network (ERC20 token)
  • wpUSDT - wrapped Tether (pegged to USD), issued on Polygon network (ERC20 token).

Supported fiat currencies:

  • AZN - Azerbaijani Manat
  • BDT - Bangladeshi Taka
  • EUR - Euro
  • GBP - Pound Sterling
  • INR - Indian Rupee
  • JPY - Japanese Yen
  • KES - Kenyan Shilling
  • PKR - Pakistani Rupee
  • RUB - Russian Ruble
  • TRY - Turkish Lira
  • USD - United States Dollar
  • UZS - Uzbekistani Som.
Possible values:
redirectUrlstringOptional
Other propertiesanyOptional
Responses
201

Created

application/json
post
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

Name
Type
Description

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