Unity SDK_支付功能
应用内商品查询功能
[Case1]:
NPurchaseItem[] items = GamePot.getPurchaseItems();
foreach(NPurchaseItem item in items) {
Debug.Log(item.productId); // 产品ID
Debug.Log(item.price); // 价格
Debug.Log(item.title); // 标题
Debug.Log(item.description); // 概述
}
[Case2]:
GamePot.getPurchaseDetailListAsync((bool success, NPurchaseItem[] purchaseInfoList, NError error) =>
{
// string result = "data is empty!";
if (success)
{
//PurchaseDetailList API Success
// if (purchaseInfoList != null)
// result = purchaseInfoList[0].productId;
//if (purchaseInfoList.Length > 1)
//{
// for (int i = 1; i < purchaseInfoList.Length; i++)
// result += "\n" + purchaseInfoList[i].productId;
//}
}
else
{
// API错误
// result = error.ToJson();
}
});
public class NPurchaseItem
{
public string productId { get; set; } // 商品ID
public string type { get; set; } // 商品类型 固定为"inapp"
public string price { get; set; } // 价格 Google商店:$0.99,其他商店:0.99
public string price_amount { get; set; }
public string price_amount_micros { get; set; }
public string price_currency_code { get; set; } // 货币代码 例)KRW、USD
public string price_with_currency { get; set; } // (在UI中显示时推荐)货币与价格合并后的值。 One Store不会传输货币单位。例如)$0.99
public string title { get; set; } // 商品名称
public string description { get; set; } // 商品描述
}支付尝试功能
获取付费道具信息的功能
发放付费道具的功能
My Card支付
第三方支付
Last updated