Open selcukbeyhan opened 1 week ago
Did you try using iaptic.com validator to see if you have the same result?
The validator is responsible for returned verified receipt, in the "collection" field (cf https://www.iaptic.com/documentation/cordova-plugin-api/interfaces/CdvPurchase.Validator.Response.SuccessPayload.html)
Hello,
Observed behavior
After the purchase is done, I revisit my app product purchase screen and want to see whether I have the product or not. However, the relevant transaction and product can be found in the localreceipt but not in the verifiedreceipt. (Although receiptsVerified is called)
Why is the product missing in the verifiedReceipts? What needs to be done for the receipt to be validated? my validator function returns OK by default for all receipts.
Each time when I navigate to my product purchase screen, the plugin is initialized and ready method registered:
Here is the code for the initialization
initializeCdvPurchasePluginEnvironment() { console.log(LOG_PREFIX, "initializeCdvPurchasePluginEnvironment is called"); this.platform.ready().then(async () => { console.log(LOG_PREFIX, "Platform is ready"); const platform = CdvPurchase.Platform.APPLE_APPSTORE;
}
Here is the log output for initialization part
⚡️ [log] - LOGPREFIX - Subscription: initializeCdvPurchasePluginEnvironment is called ⚡️ [log] - LOGPREFIX - Subscription: Platform is ready ⚡️ [log] - LOGPREFIX - Subscription: -store.when.receiptsReady- Receipts ready - receiptsReady is called [{"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"appstore.application","state":"finished","products":[{"id":"com.myapp.id"}],"platform":"ios-appstore"},{"className":"Transaction","transactionId":"2000000720186528","state":"finished","products":[{"id":"PRODUCT_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore","originalTransactionId":"2000000719786443","purchaseDate":"2024-09-20T09:01:29.000Z"}],"platform":"ios-appstore","nativeData":{"appStoreReceipt":"MII6GwYJKoZI........ ⚡️ [log] - LOGPREFIX - Subscription: -store.when.receiptsVerified- Receipts verified - receiptsVerified is called ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Plugin is initialized and ready
Here is the code section for the function where the logs are generated:
setTheProductButtonTextValues() { console.log(LOG_PREFIX, "setTheProductButtonTextValues is called");
Here are the logs:
⚡️ [log] - LOGPREFIX - Subscription: setTheProductButtonTextValues is called ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Verified Purchases: [] ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Verified Receipts: [{"className":"VerifiedReceipt","id":"com.myapp.id","sourceReceipt":{"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"appstore.application","state":"finished","products":[{"id":"com.myapp.id"}],"platform":"ios-appstore"},{"className":"Transaction","transactionId":"2000000720186528","state":"finished","products":[{"id":"PRODUCT_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore","originalTransactionId":"2000000719786443","purchaseDate":"2024-09-20T09:01:29.000Z"}],"platform":"ios-appstore","nativeData":{"appStoreReceipt":"MII6GwYJKoZIhvcN........... ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- local transactions: [{"className":"Transaction","transactionId":"appstore.application","state":"finished","products":[{"id":"com.myapp.id"}],"platform":"ios-appstore"},{"className":"Transaction","transactionId":"2000000720186528","state":"finished","products":[{"id":"PRODUCT_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore","originalTransactionId":"2000000719786443","purchaseDate":"2024-09-20T09:01:29.000Z"}] ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Product-1 in local receipts: {"className":"Transaction","transactionId":"2000000720186528","state":"finished","products":[{"id":"PRODUCT_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore","originalTransactionId":"2000000719786443","purchaseDate":"2024-09-20T09:01:29.000Z"} ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Product-2 in local receipts: undefined ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Product-3 in local receipts: undefined ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Product-1 in verified receipts: undefined ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Product-2 in verified receipts: undefined ⚡️ [log] - LOGPREFIX - Subscription: -store.ready- Product-3 in verified receipts: undefined