j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 537 forks source link

[IOS] [SANDBOX] The product remains set to owned, even after my webhook receives notification of DID_CHANGE_RENEWAL_STATUS with Auto_renew_status set to false #1102

Closed rafaelximenes closed 3 years ago

rafaelximenes commented 3 years ago

Hello, I'm going crazy with the plugin integration in my ionic 4 project. First ... I'm not using the validator. In my logic, when the product is approved, I send the receipt and the transaction to my backend, do the validation, and if validated successfully, change the user's signature and call product.finish().

The apple url webhook is correctly pointing to my endpoint and I can access the notifications. I realized that when I make an initial purchase, my server keeps receiving renewal information 5 times, until I receive a last one of the type DID_CHANGE_RENEWAL_STATUS and with the auto_renew_status set to false. That is, it means that it was canceled by the user. However, following the storekit log on my app, I realized that it was still onwed set to true and canpurchase to false. Therefore, I cannot perform new plan subscription tests.

why is owned still set to true?

maury844 commented 3 years ago

@rafaelximenes do you have any workaround for this?

I basically have the same issue, the subscriptions that expire, are entering the "approved" state right after I register them in the app, therefore any previous subscription that the user had is "marked" as owned :confused:

rafaelximenes commented 3 years ago

@maury844 , are you using de validator? For me works only using validator. The validator inform whether expired product or not.

maury844 commented 3 years ago

@rafaelximenes how are you using the validator? I've tried sending the "approved" requests that come up at the start of the application, to be verified, but Apple's servers respond with an error, and that triggers the verification again, entering a loop

j3k0 commented 3 years ago

DID_CHANGE_RENEWAL_STATUS means the subscription won't be auto-renewed, but it might still be active until the expiry date.

The validator needs to return the subscription as expired at the end of the period so it can be purchased again.

I advise you test the integration with Fovea's receipt validation server (https://billing.fovea.cc) to check if the issue comes from your validation server.

For me works only using validator

A receipt validator is required on iOS to check the expiry date (that isn't available client side, for some reasons). without it, the app can't know if the subscription is expired or not.

adammeyer commented 3 years ago

How do you have the receipt validator checked again? I'm monitoring my http traffic and a request is never sent to the validator. Only sends a request when I attempt to purchase something new.

I have an expired subscription, but always stays "owned" and never fires the "expired" event.

j3k0 commented 3 years ago

If a subscription product is owned with an expiry date in the past, the plugin should call the validator to check for refresh. On iOS, receipt validation is done on the application product.