Crypto Payments using API#
XGateway enables direct deposits without the necessity to use the Checkout page or pre-create an invoice. This simplified process, known as Channels, has two key differences:
- The exchange rates are not fixed.
- No UI is provided by XGateway.
Creating a Channel#
In order to create a channel, you need to make a POST request to the corresponding API endpoint.
In case of a successful response, the data property contains the address that you can display to your customer. You can also use the qrCodeURL property to display the address in an easy-to-use format.
By default, the payment gateway links the created wallet to a customer forever. The created wallet can be used across all EVM compatible chains.
Remember to authorise the request with your key using x-api-key header.
Processing a callback#
When a customer makes a deposit using a cryptocurrency, XGateway detects the transaction and sends a deposit callback to the merchant. Below is an example of such a callback. For detailed information, please visit the transaction callbacks for deposits and withdrawals page.
Callback example
{
"callbackType":"transaction",
"amount":"200",
"applicationId":null,
"currency":"USDT",
"customerId":"000394",
"hash":"...",
"id":"7e71d132-d80d-4140-8e60-9c89d0bd9eed",
"invoiceId":"184e9933-1526-...-fe567091b5bd",
"network":"tron",
"orderId":null,
"status":"confirmed",
"transactionHash":"0x58f6",
"type":"deposit",
"info":{
"exchangeRate":"1.03759",
"referenceAmount":"207.52",
"referenceCurrency":"USD",
"referenceExchangeRate":"1.000065",
"transactionAmount":"207.51518",
"transactionCurrency":"tUSDT"
},
"fees":{
"processing":"7.263031",
"technical":null
},
"eur":"200.12",
"usd":"207.52"
}
Callbacks for Withdraw requests will be sent to the same URL. Make sure to properly filter callbacks by type.
Confirming a transaction#
Prefer callbacks over polling; they are signed and retried. For high-risk operations, confirm state via API (see the risks and details on the Callbacks Handling page). API responses are the source of truth.
To confirm the callback is valid, please use the API endpoint.
Testing Crypto Payments on Demo environment#
You can test direct crypto deposits in the Demo environment.
Testing with transaction simulation#
The Demo Environment provides an API to simulate a deposit.
Testing with real transactions#
The way to test the integration is to deposit native token on a test network. Proceed with the integration up to the point where the customer wallet is generated and returned to you. Make sure that deposits of ETH are enabled for your profile.
Use faucets like this Alchemy faucet to get some ETH on the Sepolia test network.
Send a portion of this ETH to the wallet, assigned to your customer.
Wait for the system to send you a callback about a successful deposit.