Payments

Charge users for game items.

Payments allow charges to be made to users’ credit or debit cards.

You can create an arbitrary one-off charge for your users, such as to sell them items available only off-chain. You are responsible for monitoring the status of the payment, and making delivery of the goods purchased by the user. To create a charge, make a POST http request to https://api.gamexx.dev/nx/payments:

curl --request POST \
     --url https://api.gamexx.dev/nx/payments \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-api-key: <your api key>' \
     --data '
{
  "title": "Amazing new item",
  "description": "This item grants the user amazing skills",
  "price": {
    "currencyId": "USDC",
    "naturalAmount": "100"
  },
  "quantity": 1,
  "buyerId": "exampleId"
}
'

You must provide the following fields:

  • title: The name of the charge

  • description: An explanation for the charge

  • price.currencyId: Must provide "USDC" for now

  • price.naturalAmount: The amount to charge

  • quantity: The number of units of goods that you are selling to the user

  • buyerId: The reference id of the user making the purchase

All requests return a “payment URL” and a “payment ID”. You must then navigate the buyer to the “payment URL” to complete the purchase.

You can check on the status of the payment by making a GET http request to https://api.gamexx.dev/nx/payments/{id-of-the-payment}. The request will return the current status of the payment as well as other details.

Last updated