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.

To do this:

  1. Configure parameters for receiving webhooks:
    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.

  1. Implement the processing of the following types of webhooks in your application:

To confirm that the webhook is received, your server must respond with:

  • HTTP code 204 without a message body.
  • HTTP code 400 describing the problem if the specified user was not found or if an invalid signature was passed.

You can test User validation and Payment webhooks in Publisher Account in the Project settings > Webhooks > Payments section.

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.

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: November 26, 2024

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!