개발생활/Unity Engine
Validating receipts Not found GooglePlayTangle.Data() , AppleTangle.Data();
한국인맛집
2020. 12. 18. 18:25
반응형
this code.
public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs e)
{
bool validPurchase = true; // Presume valid for platforms with no R.V.
// Unity IAP's validation logic is only included on these platforms.
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
// Prepare the validator with the secrets we prepared in the Editor
// obfuscation window.
var validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
AppleTangle.Data(), Application.identifier);
try {
// On Google Play, result has a single product ID.
// On Apple stores, receipts contain multiple products.
var result = validator.Validate(e.purchasedProduct.receipt);
// For informational purposes, we list the receipt(s)
Debug.Log("Receipt is valid. Contents:");
foreach (IPurchaseReceipt productReceipt in result) {
Debug.Log(productReceipt.productID);
Debug.Log(productReceipt.purchaseDate);
Debug.Log(productReceipt.transactionID);
}
} catch (IAPSecurityException) {
Debug.Log("Invalid receipt, not unlocking content");
validPurchase = false;
}
#endif
if (validPurchase) {
// Unlock the appropriate content here.
}
return PurchaseProcessingResult.Complete;
}
Not forund 2 Reference
GooglePlayTangle.Data()
AppleTangle..Data()
You can find it
Assets\Plugins\UnityPurchasing\generated
Copy & Paste Your Resource Folder
Done!
☆ if not found this
Unity - Manual: Receipt validation
Receipt validation Receipt validation helps you prevent users from accessing content they have not purchased. Point of validation It is best practice to validate the receipt at the point where your application’s content is distributed. Local validation:
docs.unity3d.com
반응형