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:
- Configure parameters for receiving webhooks:
- Open your project in Publisher Account.
- Click Project settings in the side menu and go to the Webhooks tab.
- 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. - A secret key to sign project webhooks is generated by default. If you want to generate a new secret key, click the refresh icon.
- Click Enable webhooks.
- Implement the processing of the following types of webhooks in your application:
- To grant virtual items, virtual currencies, virtual currency packages, and bundles:
- To cancel a purchase:
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
Useful links
Integration flowWas this article helpful?
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.Found a typo or other text error? Select the text and press Ctrl+Enter.