Manuals
Manuals




In-game purchases

CrazyGames have partnered with Xsolla to offer you the possibility to integrate in-game purchases more conveniently. Learn more about how to use Xsolla on the CrazyGames developer pages.

Get Xsolla token

If you would like to use Xsolla via CrazyGames’ custom-generated token, you can retrieve the Xsolla token like this:

crazygames.get_xsolla_user_token(function(self, token)
  print(token)
end)

CrazyGames recommend that you retrieve the token every time before using it, since the tokens are usually short-lived, for example only 1 hour. The SDK handles the token refresh.

Order tracking

CrazyGames order tracking is optional. After Xsolla reports that an order has completed, pass the order object to the analytics API:

crazygames.track_order("xsolla", {
  orderId = "example-order-id",
  status = "done",
})

The order table must be JSON-serializable. CrazyGames also encourages reporting new and canceled orders when those states are available.