Xsolla-logoXsolla Developers
or
To Publisher Account

User balance: PurchaseWebhook POST

Sent when a user purchases something inside the game. Specifies the change in the user’s balance.

Request
Request Body schema: application/json
notification_type
string

Notification type.

object

Custom project settings (object).

project_id
integer

Project ID. You can find this parameter in your Publisher Account next to the name of the project.

merchant_id
integer

Merchant ID.

operation_type
string

Type of operation.

id_operation
integer

Operation ID in Xsolla database.

object

User details (object).

id
required
string

User ID.

name
string

Username.

email
string

User email.

object

User balance data (object).

old_value
string

Balance before transaction.

new_value
string

Balance after transaction.

diff
string

Quantity of virtual currency in the purchase.

items_operation_type
string

Type of operation made with virtual items.

Array of objects

Virtual items within the purchase.

Array
sku
string

Item ID.

amount
integer

Item quantity.

Responses
204

Return to indicate successful processing.

400

Return in case of an error in the provided information (e.g., a required parameter missing, failed authorization, etc.).

500

Return to indicate temporary errors with your servers.

Request samples
curl -v 'https://your.hostname/your/uri' \
-X POST \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'authorization: Signature 13342703ccaca5064ad33ba451d800c5e823db8f' \
-d '{
        "settings": {
            "project_id": 18404,
            "merchant_id": 2340
        },
        "virtual_currency_balance": {
            "old_value": "0",
            "new_value": "200",
            "diff": "200"
        },
        "user": {
            "name": "Xsolla User",
            "id": "1234567",
            "email": "email@example.com"
        },
        "operation_type": "inGamePurchase",
        "notification_type": "user_balance_operation",
        "items_operation_type": "add",
            "items": [{
            "sku": "com.xsolla.item_1468",
            "amount": "2"
            }],
        "id_operation": "66989"
    }'
Response samples
application/json
{
  • "error": {
    }
}