- Home /
Offline iOS receipt validation,Offline validation of apple receipt
I have an app with an in app purchase. Once the user enters the the app, the app checks if the full version was bought. For this check I've created a method, which should check the state of the local receipts (So that I also works offline). But after looking though various forums, I keep struggling to get It to work.
Code Examples of what it tried include:
1)
ConfigurationBuilder builder =
ConfigurationBuilder.Instance (StandardPurchasingModule.Instance ());
IAppleConfiguration appleConfig = builder.Configure<IAppleConfiguration> ();
Product fullVersion = storeController.products.WithID (MyBundleID);
try {
var receiptData = System.Convert.FromBase64String (appleConfig.appReceipt);
AppleReceipt receipt = new AppleValidator (AppleTangle.Data ()).Validate (receiptData);
foreach (AppleInAppPurchaseReceipt productReceipt in receipt.inAppPurchaseReceipts) {
if (productReceipt.productID.Equals (PRODUCT_FullVersion)) {
return true;
}
}
} catch (Exception e) {
}
return false
2)
Product fullVersion =
storeController.products.WithID (MyBundleID);
if(storeController != null && IsInitialized()){
if (fullVersion != null && fullVersion.hasReceipt) {
return true;
}
}
return false;
3) I also tried it with the ProcessPurchase method of the StoreListener Class, but from what I understood, this will be called after a purchase. As I want to validate it right at the beginning, I didn't got far with it.
I know there a already many post about this problem, but after a long period searching, nothing got me quit the right understanding of the topic. As there are many out there who have a good knowledge about IAPs, I hoped that someone will be able to help me.
Thanks for all your efforts.
,I have an app with an in app purchase. Once the user enters the the app, the app checks if the full version was bought. For this check I've created a method, which should check the state of the local receipts (So that I also works offline). But after looking though various forums, I keep struggling to get It to work.
Code Examples of what it tried include:
1)
ConfigurationBuilder builder =
ConfigurationBuilder.Instance (StandardPurchasingModule.Instance ());
IAppleConfiguration appleConfig = builder.Configure<IAppleConfiguration> ();
Product fullVersion = storeController.products.WithID (MyBundleID);
try {
var receiptData = System.Convert.FromBase64String (appleConfig.appReceipt);
AppleReceipt receipt = new AppleValidator (AppleTangle.Data ()).Validate (receiptData);
foreach (AppleInAppPurchaseReceipt productReceipt in receipt.inAppPurchaseReceipts) {
if (productReceipt.productID.Equals (PRODUCT_FullVersion)) {
return true;
}
}
} catch (Exception e) {
}
return false
2)
Product fullVersion =
storeController.products.WithID (MyBundleID);
if(storeController != null && IsInitialized()){
if (fullVersion != null && fullVersion.hasReceipt) {
return true;
}
}
return false;
3) I also tried it with the ProcessPurchase method of the StoreListener Class, but from what I understood, this will be called after a purchase. As I want to validate it right at the beginning, I didn't got far with it.
I know there a already many post about this problem, but after a long period searching, nothing got me quit the right understanding of the topic. As there are many out there who have a good knowledge about IAPs, I hoped that someone will be able to help me.
Thanks for all your efforts.
Your answer
Follow this Question
Related Questions
[Help!] Fighting with Receipt Validation (iOS) 0 Answers
Validating a restore receipt with Unity IAPs 1 Answer
Google Play - IAP Purchase Server side receipt validation 0 Answers
In App Purchase - Soomla - iOS 1 Answer
Simple In App Purchase on iOS 9 Answers