Xsolla sends the order_paid
webhook to the specified URL when the user successfully pays for the order.
The order_paid
webhook contains information about the purchased items, payment data and transaction details.
The order_paid
webhook is not sent if the payment is not successful, for example:
It is recommended that the processing time 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, contact your Customer Success Managers or email to csm@xsolla.com.
notification_type required | string Notification type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
required | Array of version = 1 (object) or version = 2 (object) List of items purchased by the user. The set of parameters included in the array depends on the webhook version. Version 2 includes additional parameters: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Array One of: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
required | object Information about the order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
required | object User information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
object Transaction and payment details. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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": "com.xsolla.item_1", "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": "com.xsolla.item_new_1", "type": "bundle", "is_pre_order": false, "quantity": 1, "amount": "1000", "promotions": [] }, { "sku": "com.xsolla.gold_1", "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" }, "billing": { "notification_type": "payment", "settings": { "project_id": 18404, "merchant_id": 2340 }, "purchase": { "subscription": { "plan_id": "b5dac9c8", "subscription_id": "10", "product_id": "Demo Product", "date_create": "2014-09-22T19:25:25+04:00", "date_next_charge": "2014-10-22T19:25:25+04:00", "currency": "USD", "amount": 9.99 }, "total": { "currency": "USD", "amount": 200 }, "promotions": [{ "technical_name": "Demo Promotion", "id": 853 }], "coupon": { "coupon_code": "ICvj45S4FUOyy", "campaign_code": "1507" }, "transaction": { "id": 1, "external_id": 1, "payment_date": "2014-09-24T20:38:16+04:00", "payment_method": 1, "payment_method_name": "PayPal", "payment_method_order_id": 1234567890123456789, "dry_run": 1, "agreement": 1 }, "payment_details": { "payment": { "currency": "USD", "amount": 230 }, "vat": { "currency": "USD", "amount": 0, "percent": 20 }, "sales_tax": { "currency": "USD", "amount": 0, "percent": 0 }, "direct_wht": { "currency": "USD", "amount": 0, "percent": 0 }, "payout_currency_rate": "1", "payout": { "currency": "USD", "amount": 200 }, "country_wht": { "currency": "USD", "amount": 2, "percent": 10 }, "user_acquisition_fee": { "currency": "USD", "amount": 2, "percent": 1 }, "xsolla_fee": { "currency": "USD", "amount": 10 }, "payment_method_fee": { "currency": "USD", "amount": 20 }, "repatriation_commission": { "currency": "USD", "amount": 10 } }, "custom_parameters": { "parameter1": "value1", "parameter2": "value2" } } } }'