Skip to main content

App > Design > Integrations > Payments

Set up Xsolla to sell products through its web store and settle purchases and refunds via webhooks

Written by Jason Liang

The App > Design > Integrations > Payments page sets up third-party payment and web store providers for your app. It currently supports Xsolla.

Xsolla

Xsolla is a web store and payment platform. Enabling this integration lets brainCloud sell products through Xsolla and settle purchases through Xsolla webhooks: when a player pays, Xsolla notifies brainCloud, which then delivers the purchased product.

Click the Xsolla panel to expand it, turn on Enable, fill in the settings and click Save Changes. You can find these values in your Xsolla Publisher Account.

  • Project ID (required, numeric): your Xsolla project ID. Webhooks for any other project are rejected.

  • Project Secret Key (Webhooks) (required): your project's secret key, used to verify that webhook requests really come from Xsolla.

  • Login Project ID: the ID of your Xsolla Login project. Although marked optional, it is required for GetUserToken, which gets an Xsolla user token for the player.

  • Server OAuth 2.0 Client ID and Server OAuth 2.0 Client Secret (required): the server OAuth client brainCloud uses to call Xsolla's APIs, for example for GetUserToken.

  • Project API Key (optional, but required for Consume on Purchase): your Xsolla project API key.

  • Sandbox: use Xsolla's sandbox Pay Station for testing.

Webhook URL

Under Set in Xsolla, the page shows your app's Webhook URL. Use the copy button to copy it, and register it as the webhook URL in your Xsolla Publisher Account. brainCloud handles these Xsolla notifications:

  • User validation: confirms the player exists in your app.

  • Order paid: records the purchase and delivers the product to the player.

  • Order canceled: processes a refund (see Refunds below).

Each Xsolla order must identify the player and the product being bought, using these custom parameters when you create the Xsolla payment token:

  • custom_user_id: the player's brainCloud profile ID.

  • custom_payload: the product's brainCloud payload string, from GetSalesInventory. The order must contain exactly one item.

Xsolla purchases are delivered by the webhook. If your client also calls VerifyPurchase with store ID xsolla and the order ID, it returns the result of the webhook and does not deliver the product again. Each Xsolla price on a brainCloud product needs the Xsolla item SKU.

Behaviour

  • Consume on Purchase (recommended): after a purchase is delivered, brainCloud removes consumable items from the player's Xsolla inventory, since brainCloud manages your app's currency and item inventory. Requires the Project API Key; without it, the switch is disabled and your client needs to consume the items itself.

  • Chargeback Price: what to do when a refund includes items the player no longer has, has given away or has used. Choose None to only take back what the player still has, or List Price or Buy Back Price to charge the player that price, in virtual currency, for each item that can't be taken back. Balances may go negative.

Refunds

When Xsolla sends an order canceled notification, brainCloud reverses the purchase: it takes back the statistics, virtual currency and items the purchase awarded, applying your Chargeback Price setting to any items it can't take back. Each order is refunded only once, even if Xsolla sends the notification again.

Permissions

Write access to this page is required to change these settings. Users with read-only access can view the page, but all controls are disabled. If you leave the page with unsaved changes, you are asked to confirm.

Did this answer your question?