I've tried several ways to validate receipts and can't seem to get past it. My latest try is this:
public void ValidateReceipt() {
bool validPurchase = false;
Product[] products = m_StoreController.products.all;
try {
CrossPlatformValidator validator = new CrossPlatformValidator (null, AppleTangle.Data (), Application.bundleIdentifier);
for (int i = 0; i < products.Length; i++) {
if (products .receipt != null) { // <--- This is always null
IPurchaseReceipt[] result = validator.Validate (products .receipt);
for (int j = 0; j < result.Length; j++) {
if (result [j].productID == kProductIDNonConsumable) {
Debug.Log(result [j].productID);
validPurchase = true;
}
}
} else {
Debug.Log("Null Value " + products.transactionID);
}
}
} catch (Exception ex) {
Debug.Log(ex.ToString ());
}
if (validPurchase) {
// SUCCESSFUL RECEIPT VALIDATION
} else {
// RECEIPT NOT VALID
}
}
The receipt is always null in this example. I've always played with...
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); string receipt = builder.Configure().appReceipt;
But again, the receipt is always null.
Has anyone gotten this working?
↧