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:

  1. The exchange rates are not fixed.

  2. No UI is provided by XGateway.

Creating an Channel

In order to create a channel, you need to make a POST request to the corresponding API endpoint.

Returns a previously created or brand-new address with a link to a QR code.

post

Create a channel for the customer for a specified currency.

Access to this endpoint requires a valid API key. The API key is sent in the x-api-key header on requests.

Authorizations
Body
  • Contains currency and customer id.

Params:

  • currency - The currency.
  • customerId - The customer ID in the external system.
currencystring · enumRequired

Represents supported crypto currencies in the payment processing system.

Currencies:

  • 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).
Possible values:
customerIdstringRequired
Responses
200
Ok
application/json
Responseany of
or
post
POST /api/v2/channels HTTP/1.1
Host: api.xgateway.tech
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 70

{
  "currency": "BNB",
  "customerId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8"
}
{
  "data": {
    "address": "n3UrMJG4rxAbXfVWo8dpZ4JLsDZMFm8LM9",
    "qrCodeURL": "https://objects.xgateway.dev/public/43c33515-8b56-4937-ae48-7bd6de7e11f9.svg"
  },
  "success": true
}

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 this page.

{
   "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"
}

Confirming a transaction

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.

The best 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 one, to get some ETH on 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.

Last updated