Xsolla sends the order_paid
webhook to the specified URL when the following conditions are fulfilled:
payment
webhook.The order_paid
webhook contains information about the purchased items and transaction details.
The order_paid
webhook will not be sent if:
payment
webhook has not been received.It is recommended that the processing speed of the order_paid
webhook is less than 3 seconds.
The expected answers are described in the Responses section. You can use other response codes. Depending on the response code and the connection of the automatic payment refund functionality, the webhook processing logic on Xsolla’s side is as follows:
Response code | Automatic payment refund is disabled (by default) | Automatic payment refund is enabled |
---|---|---|
400 , 401 , 402 , 403 , 404 , 409 , 422 , 415 |
No actions | Automatic refund to the user |
200 , 201 , 204 |
No actions | No actions |
Different code or no response to webhook | Multiple webhooks are sent within a specified time interval: 2 attempts with a 5-minute interval, 7 attempts with a 15-minute interval, 10 attempts with a 60-minute interval. | Multiple webhooks are sent within a specified time interval: 2 attempts with a 5-minute interval, 7 attempts with a 15-minute interval, 10 attempts with a 60-minute interval. If all webhooks are sent but a successful response is not received, an automatic refund is issued to the user. |
To connect the automatic refund functionality, please contact the project account manager or write to am@xsolla.com.
notification_type required | string Notification type. | ||||||||||||||||||||||||||||||||||||||
required | Array of objects List of items purchased by the user. | ||||||||||||||||||||||||||||||||||||||
Array | |||||||||||||||||||||||||||||||||||||||
required | object Information about the order. | ||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||
required | object User information. | ||||||||||||||||||||||||||||||||||||||
custom_parameters | object Additional information. |
Return to indicate successful processing.
Return in case of an error in the provided information (e.g., a required parameter missing, failed authorization, etc.).
curl -v 'https://your.hostname/your/uri' \ -X POST \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Signature d09695066c52c1b8bdae92f2d6eb59f5b5f89843' \ -d '{ "notification_type": "order_paid", "items": [ { "sku": "virtual-good-item_test", "type": "virtual_good", "is_pre_order": false, "quantity": 3, "amount": "1000", "promotions": [ { "amount_without_discount": "6000", "amount_with_discount": "5000", "sequence": 1 }, { "amount_without_discount": "5000", "amount_with_discount": "4000", "sequence": 2 } ], "custom_attributes": { "purchased": 0, "attr": "value" } }, { "sku": "virtual-good-item_test_test_new", "type": "bundle", "is_pre_order": false, "quantity": 1, "amount": "1000", "promotions": [] }, { "sku": "gold", "type": "virtual_currency", "is_pre_order": false, "quantity": 1500, "amount": "[null]", "promotions": [] } ], "order": { "id": 1, "mode": "default", "currency_type": "virtual", "currency": "sku_currency", "amount": "2000", "status": "paid", "platform": "xsolla", "comment": null, "invoice_id": "1", "promotions": [ { "amount_without_discount": "4000", "amount_with_discount": "2000", "sequence": 1 } ], "promocodes": [ { "code": "promocode_some_code", "external_id": "promocode_sku" } ], "coupons": [ { "code": "WINTER2021", "external_id": "coupon_sku" } ] }, "user": { "external_id": "id_xsolla_login_1", "email": "gc_user@xsolla.com" } }'