Grant purchases to user

Implement granting purchases to the user in your application using information received in the webhooks from Xsolla about the transaction details and purchased items.

Note

2 webhook receiving options have been set up on Xsolla’s side when purchasing and returning items — information with payment and transaction data and information about purchased items can come separately or can be combined into one webhook.

More information on webhook receiving options

Receiving information in combined webhooks:

If you registered in Publisher Account after January 22, 2025, you receive all the information in the Successful payment for order (order_paid) and Order cancellation (order_canceled) webhooks. In this case, you do not need to process the Payment (payment) and Refund (refund) webhooks.

Receiving information in separate webhooks:

If you registered in Publisher Account on or before January 22, 2025, you receive the following webhooks:

You need to process all incoming webhooks.

To switch to the new option with receiving combined webhooks, contact your Customer Success Managers or email to csm@xsolla.com.

For the full operation of the in-game store and payment management, it is necessary to implement the processing of the main webhooks:

If item catalog personalization is implemented on your application’s side, set up processing of Catalog personalization on the partner’s side.

Note
To receive real payments, you only need to sign the licensing agreement and implement processing of the webhooks:

Set up webhooks in Publisher Account

  1. Open your project in Publisher Account.
  2. Click Project settings in the side menu and go to the Webhooks tab.
  3. In the Webhook server field, specify the URL of your server where you want to receive webhooks in the https://example.com format. You can also specify the URL you find in a tool for testing webhooks.
  4. A secret key to sign project webhooks is generated by default. If you want to generate a new secret key, click the refresh icon.
  5. Click Enable webhooks.
Notice
To transfer data, HTTPS protocol is required; use of HTTP protocol is not supported.

Test webhooks in Publisher Account

If webhooks are set up successfully, a webhook testing block is displayed below the webhook setup block.

The testing section in the Publisher Account varies depending on the webhook receiving option.

In the absence of real values, you can enter arbitrary values.

You also can test webhooks when making purchases in the sandbox or live mode. Testing Refund is available only in live mode.

Sending responses to webhook

To confirm receipt of the webhook, your server must return:

  • 200, 201, or 204 HTTP code in case of a successful response.
  • 400 HTTP-code with description of the problem if the specified user was not found or an invalid signature was passed.

Your webhook handler may also return a 5xx code in case of temporary issues on your server.

Note
The complete list and mechanism of webhooks, along with detailed examples of their processing, are described in the webhooks documentation.

Next steps

  1. Implement getting subscription information.
  2. Set up user authentication.

Integration flow

Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Last updated: January 23, 2025

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!