Closed alexp25 closed 3 years ago
Is any progress?
I can approve: "consumables" and "subscriptions" is not working on the production. We got through the review and left users without payments.
Be caution!
I have figured it out. The store.order
method should be called immediately when initiating the purchase and not after the update event is triggered after calling store.refresh
(never triggers in production, after the products have already been registered). The store.refresh
method is called only once after registering all handlers. I've also handled all other events now (but this should not be a problem). Now the app got approved. Can only confirm for "consumables"
I have figured it out. The
store.order
method should be called immediately when initiating the purchase and not after the update event is triggered after callingstore.refresh
(never triggers in production, after the products have already been registered). Thestore.refresh
method is called only once after registering all handlers. I've also handled all other events now (but this should not be a problem). Now the app got approved. Can only confirm for "consumables"
Can You show an example (which work and which does not work)?
// this works in TestFlight and on real device, doesn't work in production (used to work)
purchaseItem(productId) {
return new Promise((resolve, reject) => {
let product = this.store.get(productId);
// helper function
waitForIAPEvent(productId, [IAPEvents.APPROVED]).then((event) => {
// register product
// ...
resolve(true);
});
// also handle other events (e.g. error, cancelled)
// ...
this.waitForIapEvent(productId, [IAPEvents.UPDATED]).then((event) => {
this.store.order(productId);
});
this.store.refresh();
});
}
// this also works in production
purchaseItem(productId) {
return new Promise((resolve, reject) => {
// helper function
waitForIAPEvent(productId, [IAPEvents.APPROVED]).then((event) => {
// register product
// ...
resolve(true);
});
// also handle other events (e.g. error, cancelled)
// ...
this.store.order(productId);
this.store.refresh();
});
}
In both cases, the initialization (store.register
) is done only once, when the app starts, registering all IAP products.
@alexp25, Hi, I have the same problem but with a subscription. The application works 100%, but the app review does not pass, they write that the application does not respond to pressing the subscription button on the iPad. If it's not difficult, can you share a complete working code or at least a helper function? Thank you!
system info
Expected behavior
IAP should work as expected during App Review
Observed behavior
App gets rejected every time because the IAP strangely does not work during App Review.
We added remote logging and here is the output of the plugin that was logged during App Review:
The in-app purchases work perfectly when tested on iOS 14.3 device and in TestFlight. Only during App Review something happens that I cannot possibly explain. Here is the message from App Review:
"We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 14.4 on Wi-Fi. Specifically, we were unable to purchase the in-app purchases. User was not able purchase IAP. No modal alert appearing for IAP purchase." (was the same with iOS 14.3)
However, I do not see any error in the logs, and it seems that the products are not even ordered? What could possibly happen, as it's the 5th time the app gets rejected for the same (unknown) reason.
[EDIT] It seems that the update event is not being triggered under the described circumstances, which explains why the
store.order
method is not even being called, as in the code I wait until the product is refreshed (updated) to make a purchase. Why does this happen only in App Review/App Store, but not on testing device?Here is a successful log (from my testing device)
Steps to reproduce
Create an app with in-app purchases and submit it for review on App Store. No other way could I reproduce the problem.