适用于Unity的SDK / 通过Steam进行支付
  返回文档

适用于Unity的SDK

通过Steam进行支付

注意
如与Steam有直接合同,请按照本说明进行操作。如要通过艾克索拉支付中心使用其他支付方式,无需进行额外操作,即使已实现了通过Steam进行身份认证也是如此。

玩家通过Steam为游戏内购买项进付款时,艾克索拉可作为付款直接帐户。这样您就不必集成Steam SDK或在设置游戏内商店时考虑通过Steam支付的情况下需完成的繁琐设置。

要设置通过Steam进行支付:

  1. 与艾克索拉签署一份额外协议。

注:
通过Steam进行支付时,艾克索拉收取较少的收入分成。详细信息请咨询您的客户成功经理。

  1. 在您的发布商帐户中为Steam设置直接帐户
  2. 设置通过Steam进行本机用户认证
  3. 使用SDK方法实现商品购买逻辑。在您的应用程序中实现购买逻辑时,请调用SteamUtils.GetAdditionalCustomHeaders方法来获取额外请求头。调用SDK方法(如Purchase)进行购买或创建订单(如PurchaseItem)时,将收到的头传入customHeaders参数。

通过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
		}
	}
}
本文对您的有帮助吗?
谢谢!
我们还有其他可改进之处吗? 留言
非常抱歉
请说明为何本文没有帮助到您。 留言
感谢您的反馈!
我们会查看您的留言并运用它改进用户体验。
为此页面评分
为此页面评分
我们还有其他可改进之处吗?

不想回答

感谢您的反馈!

有用链接

上次更新时间: 2023年10月10日

发现了错别字或其他内容错误? 请选择文本,然后按Ctrl+Enter。

报告问题
我们非常重视内容质量。您的反馈将帮助我们做得更好。
请留下邮箱以便我们后续跟进
感谢您的反馈!