When a user completes a payment, Xsolla sends payment details in a webhook with the payment
type to the webhook URL.
If a response with a 5xx
code is received, Xsolla resends a webhook with an increased time interval until your listener confirms receiving. The maximum number of retries is 12.
You can give permissions to receive detailed information in webhooks. To do that, you can set the following toggles to On in Publisher Account in the Project settings > Webhooks > Advanced settings section:
Toggle | Description |
---|---|
Show info about the saved payment account | Information about the saved payment method is passed in the payment_account custom object. |
Show info about transactions via saved payment methods | Information is passed in the following custom parameters of the webhook:
|
Add order object to webhook | Information about the order is passed in the order object of the Payment webhook. |
Send only necessary user parameters without sensitive data | Only the following information about the user is passed in the webhook:
|
Show card BIN and suffix | The following information about the bank card number is passed in the webhook:
|
Show card brand | The brand of the card used for making the payment. For example, Mastercard or Visa. |
notification_type required | string Notification type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
required | object Transaction details (object). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
required | object Payment details (object). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
object Custom project settings (object). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
object User details (object). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
object Purchase details (object). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
custom_parameters | object Your custom parameters. |
Return to indicate successful processing.
Return in case of an error in the provided information (e.g., a required parameter missing, failed authorization, etc.). In this case, the user’s money is debited, but the purchase fails. To make a refund, contact Xsolla customer support at support@xsolla.com.
Return to indicate temporary errors with your servers.
curl -v 'https://your.hostname/your/uri' \ -X POST \ -d '{ "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 }, "checkout": { "currency": "USD", "amount": 50 }, "total": { "currency": "USD", "amount": 200 }, "promotions": [{ "technical_name": "Demo Promotion", "id": 853 }], "coupon": { "coupon_code": "ICvj45S4FUOyy", "campaign_code": "1507" }, "order": { "id": 1234 "lineitems": [ { "sku": "test_1", "quantity": 1, "price": { "currency": "EUR", "amount": 6.5 } } ] } }, "user": { "ip": "127.0.0.1", "phone": "18777976552", "email": "email@example.com", "id": "1234567", "name": "John Smith", "country": "US" }, "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" } }'
{- "error": {
- "code": "INVALID_USER",
- "message": "Invalid user"
}
}