The Xsolla server sends a webhook including payment details whenever a user completes a payment.
$request = array(
'notification_type' => 'payment',
'purchase' => array(
'virtual_items' => array(
'items' => array(
0 => array(
'sku' => 'test_item1',
'amount' => 1,
),
1 => array(
'sku' => 'test_item2',
'amount' => 1,
),
2 => array(
'sku' => 'test_item3',
'amount' => 1,
),
)
),
'total' => array(
'currency' => 'USD',
'amount' => 9.99
)
),
'user' => array(
'ip' => '127.0.0.1',
'phone' => '18777976552',
'email' => 'email@example.com',
'id' => '1234567',
'country' => 'US'
),
'transaction' => array(
'id' => 87654321,
'payment_date' => '2014-09-23T19:25:25+04:00',
'payment_method' => 1380,
'dry_run' => 1
),
'payment_details' => array(
'payment' => array(
'currency' => 'USD',
'amount' => 9.99
),
'vat' => array(
'currency' => 'USD',
'amount' => 0
),
'payout_currency_rate' => 1,
'payout' => array(
'currency' => 'USD',
'amount' => 9.49
),
'xsolla_fee' => array(
'currency' => 'USD',
'amount' => 0.19
),
'payment_method_fee' => array(
'currency' => 'USD',
'amount' => 0.31
)
)
)
curl -v https:
-X POST \
-H 'Content-Type:application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Signature 13342703ccaca5064ad33ba451d800c5e823db8f' \
-d '
{
"notification_type": "payment",
"purchase": {
"virtual_items": {
"items": [
{
"sku": "test_item1",
"amount": 1
},
{
"sku": "test_item2",
"amount": 1
},
{
"sku": "test_item3",
"amount": 2
},
]
},
"total": {
"currency": "USD",
"amount": 9.99
}
},
"user": {
"ip": "127.0.0.1",
"phone": "18777976552",
"email": "email@example.com",
"id": "1234567",
"country": "US"
},
"transaction": {
"id": 87654321,
"payment_date": "2014-09-23T19:25:25+04:00",
"payment_method": 1380,
"dry_run": 1
},
"payment_details": {
"payment": {
"currency": "USD",
"amount": 9.99
},
"vat": {
"currency": "USD",
"amount": 0
},
"payout_currency_rate": 1,
"payout": {
"currency": "USD",
"amount": 9.49
},
"xsolla_fee": {
"currency": "USD",
"amount": 0.19
},
"payment_method_fee": {
"currency": "USD",
"amount": 0.31
}
}
}'
You can find the full list of parameters in the API Reference.
If the user cancels the payment, the Xsolla server sends a webhook notification with information about the payment.
Request example
$request = array(
'notification_type' => 'refund',
'purchase' => array(
'virtual_currency' => array(
'name' => 'Coins',
'quantity' => 100,
'currency' => 'USD',
'amount' => 9.99
),
'total' => array(
'currency' => 'USD',
'amount' => 9.99
)
),
'user' => array(
'ip' => '127.0.0.1',
'phone' => '18777976552',
'email' => 'email@example.com',
'id' => '1234567',
'country' => 'US'
),
'transaction' => array(
'id' => 87654321,
'payment_date' => '2014-09-23T19:25:25+04:00',
'payment_method' => 1380,
'dry_run' => 1
),
'refund_details' => (
'code' => 1,
'reason' => 'Fraud'
),
'payment_details' => array(
'payment' => array(
'currency' => 'USD',
'amount' => 9.99
),
'vat' => array(
'currency' => 'USD',
'amount' => 0
),
'payout_currency_rate' => 1,
'payout' => array(
'currency' => 'USD',
'amount' => 9.49
),
'xsolla_fee' => array(
'currency' => 'USD',
'amount' => 0.19
),
'payment_method_fee' => array(
'currency' => 'USD',
'amount' => 0.31
)
)
);
curl -v https:
-X POST \
-H 'Content-Type:application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Signature 13342703ccaca5064ad33ba451d800c5e823db8f' \
-d '
{
"notification_type":"refund",
"purchase":{
"virtual_currency":{
"name": "Coins",
"quantity":10,
"currency":"USD",
"amount":100
},
"subscription":{
"plan_id": "b5dac9c8",
"subscription_id": "10",
"date_create": "2014-09-22T19:25:25+04:00",
"currency": "USD",
"amount": 9.99
},
"checkout":{
"currency":"USD",
"amount":50
},
"virtual_items":{
"items":[
{
"sku": "test_item1",
"amount":1
}
],
"currency":"USD",
"amount":50
},
"total":{
"currency":"USD",
"amount":200
}
},
"user": {
"ip": "127.0.0.1",
"phone": "18777976552",
"email": "email@example.com",
"id": "1234567",
"name": "Xsolla User",
"country": "US"
},
"transaction":{
"id":1,
"external_id":1,
"dry_run":1,
"agreement":1
},
"refund_details":{
"code":1,
"reason":"Fraud"
},
"payment_details":{
"xsolla_fee":{
"currency":"USD",
"amount":"10"
},
"payout":{
"currency":"USD",
"amount":"200"
},
"payment_method_fee":{
"currency":"USD",
"amount":"20"
},
"payment":{
"currency":"USD",
"amount":"230"
}
}
}'
You can find the full list of parameters in the API Reference.
To test the webhook handler:
- In the Publisher Account, open the module settings.
- Go to the Testing tab.
- Enter the test data and click Test. The Xsolla server will send all possible webhooks.
- The test is marked green in case of a valid response and red in case of an error.
A project can receive tips for each purchase. To enable the feature, open module settings, go to the Prices tab, and set Use tips in the Pay2play widget to On. Three tip amount options are available for each enabled currency.
The user will be able to choose the tip amount before entering the store. The tips will be added to the purchase price.
You can limit the number of preorders for any given project. You will receive the following email notifications: when 100 or fewer preorders are remaining, and when no preorders are left. If a user tries to exceed the preorder limit, payment is not processed.

The Preorders module allows you to set up regional restrictions on preorder sales. In particular, you can:
- Set a different cost for individual countries or groups of countries;
- Prohibit sales in certain countries.
Once the project is properly configured, the user trying to make a preorder in a restricted country will see a corresponding warning. In countries where preorders are prohibited, payment is not processed.

To enable the feature, contact your account manager. We will need the following information for each platform with regional restrictions applied:
- Restriction type:
- Activation: A PIN code can be activated in certain countries only.
- Launch: A PIN code can be activated in any country, but the game can be launched only in certain countries.
- Activation and launch: A PIN code can be activated and the game can be launched only in certain countries.
- List of country groups with a different preorder price.
- Settings for each group of countries:
- Group name.
- SKU — a unique group identifier.
- List of prices in different currencies. Be sure to include the price in the default currency set in module settings.
- List of countries within each group.
- List of countries where preorders are disabled (if any).
For any single platform, a country can belong either to a different-price group or to the preorders-disabled group. If a country is not listed in any of the groups, preorders are available without any restrictions, at the prices set in default module settings.
Important! Be sure to upload PIN codes to our system with regional restrictions already configured if PIN code activation and game launch are performed by you or the platform.