Enterprise-level SDK for Unity / Payments via Steam
  Back to Docs

Enterprise-level SDK for Unity

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:

  1. 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.

  1. Set up the gateway for Steam in your Publisher Account.
  2. Set up native authentication via Steam.
  3. 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 the customHeaders 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
Full screen
Small screen
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!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Rate this page
Rate this page
Is there anything we can improve?

Don’t want to answer

Thank you for your feedback!

Useful links

Last updated: October 10, 2023

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!