update: 新增收据接口
parent
79217aaaac
commit
fa0861c770
|
|
@ -62,6 +62,7 @@ namespace Guru
|
|||
public event Action<string> OnBuyStart;
|
||||
public event Action<string, bool> OnBuyEnd;
|
||||
public event Action<string, string> OnBuyFailed;
|
||||
public event Action<string, string, bool> OnGetProductReceipt;
|
||||
|
||||
#if UNITY_IOS
|
||||
/// <summary>
|
||||
|
|
@ -509,6 +510,18 @@ namespace Guru
|
|||
PurchaseCount++; // 记录支付次数
|
||||
Debug.Log($"############ ProcessPurchase: PurchaseCount:{PurchaseCount}");
|
||||
ReportPurchaseResult(purchaseEvent); // 支付结果上报
|
||||
|
||||
var pp = purchaseEvent.purchasedProduct;
|
||||
if ( pp == null || string.IsNullOrEmpty(pp.receipt))
|
||||
{
|
||||
string msg = $"{Tag} --- Purchased product is null or has no receipt!!";
|
||||
Debug.LogError(msg);
|
||||
Crashlytics.LogException(new Exception(msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnGetProductReceipt?.Invoke(pp.definition.id, pp.receipt, pp.appleProductIsRestored);
|
||||
}
|
||||
|
||||
string productName = info?.Name ?? "NULL";
|
||||
LogI($"{Tag} --- OnPurchaseSuccess :: purchase count: {PurchaseCount} productName: {productName}");
|
||||
|
|
@ -626,6 +639,7 @@ namespace Guru
|
|||
// ----- 支付后的b_level上报逻辑
|
||||
LogI($"--- Report b_level:[{blevel}] with product id:{args.purchasedProduct.definition.id} ");
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
// Editor 不做上报逻辑
|
||||
#elif UNITY_ANDROID
|
||||
|
|
|
|||
Loading…
Reference in New Issue