Payments via Steam
Notice
Follow this how-to if you have a direct contract with Steam. To use other payment methods via Xsolla Pay Station, no additional configuration is required, even if you have implemented user authentication via Steam.
Xsolla can act as a payment gateway when players pay for in-game purchases via Steam. In this case, you don’t need to integrate the Steam SDK or take into account the nuances of paying via Steam when setting up an in-game store.
To set up payments via Steam:
- Sign an additional agreement with Xsolla.
Note
Xsolla takes a reduced revenue share when making payments via Steam. Check the details with your Customer Success Manager.
- Set up the gateway for Steam in your Publisher Account.
- Set up native authentication via Steam.
- Implement item purchase logic using SDK methods. When implementing purchase logic in your application, get additional request headers by calling the
SteamUtils.GetAdditionalCustomHeaders
method. Pass the received headers to thecustomHeaders
parameter when calling the SDK methods to purchase (for example,Purchase
) or create an order (for example,PurchaseItem
).
Example of a script for item purchase via Steam:
Copy
- C#
using UnityEngine;
using Xsolla.Catalog;
using Xsolla.Core;
namespace Xsolla.Samples.Steam
{
public class SellViaSteamGateway : MonoBehaviour
{
// Function for starting the purchase process via Steam Gateway
public void PurchaseItem(string itemSku)
{
// Get additional headers for the request from `SteamUtils` class
var additionalHeaders = SteamUtils.GetAdditionalCustomHeaders();
// Starting the purchase process
// Pass the `itemSku` parameter and callback functions for success and error cases
// Pass `additionalHeaders` variable as the optional `customHeaders` parameter
XsollaCatalog.Purchase(itemSku, OnPurchaseSuccess, OnError, customHeaders: additionalHeaders);
}
private void OnPurchaseSuccess(OrderStatus status)
{
Debug.Log("Purchase successful");
// Add actions taken in case of success
}
private void OnError(Error error)
{
Debug.LogError($"Error: {error.errorMessage}");
// Add actions taken in case of error
}
}
}
Was this article helpful?
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.Useful links
Last updated: October 10, 2023Found a typo or other text error? Select the text and press Ctrl+Enter.