Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios v13 store.findInVerifiedReceipts does not show updates #1402

Closed
bartushak007 opened this issue Apr 13, 2023 · 10 comments
Closed

ios v13 store.findInVerifiedReceipts does not show updates #1402

bartushak007 opened this issue Apr 13, 2023 · 10 comments

Comments

@bartushak007
Copy link

bartushak007 commented Apr 13, 2023

hey!

After a successful call to the order method for subscription and validation of the receipt, the findInVerifiedReceipts method displays the previous information state like { isExpired: true,...} but the subscription was ordered successfully. To retrieve the updated information, the app needs to be closed and reopened, after which the findInVerifiedReceipts method returns the updated information where { isExpired: false,...}.
How after purchase I can know that subscription is purchased?

method call example:
CdvPurchase.store.findInVerifiedReceipts(CdvPurchase.store.get(one_month_premium_ios))

also, this method always returns undefined on Android even if the subscription is active

@bartushak007 bartushak007 changed the title ios v13 ios v13 store.findInVerifiedReceipts does not show updates Apr 13, 2023
@j3k0
Copy link
Owner

j3k0 commented Apr 19, 2023

It should work.

Can you share some source code and more context? Do you have your own custom receipt validator? If so, can you share logs including what is sent and received from the validator?

@bartushak007
Copy link
Author

thanks for your answer.
I am trying to update the plugin from 11v to 13v

I have auto-renewal subscriptions
ios: The order method is working but the findInVerifiedReceipts method does not return the updated state right after a successful order. To get it updated I need to refresh the app

android: findInVerifiedReceipts - always returns undefined - I tried to call it after 5-second delay but it also returned undefined

initialization

document.addEventListener("deviceready", () => {
    let registerList = [];
    const store = CdvPurchase.store;
    const ProductType = CdvPurchase.ProductType;
    const Platform = CdvPurchase.Platform;
    if (window.device.platform === "iOS") {
        registerList = [
            {
                id: one_month_premium_ios,
                type: ProductType.PAID_SUBSCRIPTION,
                platform: Platform.APPLE_APPSTORE,
            },
            {
                id: three_months_premium_ios,
                type: ProductType.PAID_SUBSCRIPTION,
                platform: Platform.APPLE_APPSTORE,
            },
            {
                id: one_year_premium_ios,
                type: ProductType.PAID_SUBSCRIPTION,
                platform: Platform.APPLE_APPSTORE,
            },
        ];
    }
    if (window.device.platform === "Android") {
        registerList = [
            {
                id: premium_android,
                type: ProductType.PAID_SUBSCRIPTION,
                platform: Platform.GOOGLE_PLAY,
            },
        ];
    }
    store.register(registerList);
    store.validator = "https://validator.fovea.cc/v1/validate?appName=****&apiKey=*****";

    store
        .when()
        .approved((transaction) => {
            transaction.verify();
        })
        .verified((receipt) => {
            receipt.finish();
        })
        .finished(() => {
            // after purchase it returns previous value but when refresh app then purchase information is updated
            store.findInVerifiedReceipts(store.get(one_month_premium_ios)); 
        })
        .receiptUpdated(() => {})
        .productUpdated((p) => self.updateSubscriptionsData(p));

    store.error((err) =>
        self.updatePurchaseStateAction({
            failedMessage: err.message,
            pending: false,
            id: null,
        })
    );
    store.initialize([Platform.APPLE_APPSTORE, Platform.GOOGLE_PLAY]).then(() => {});
});

order:

const offer = window.CdvPurchase.store.get(one_month_premium_ios).offers[0]
window.CdvPurchase.store.order(offer)

@j3k0

@bartushak007
Copy link
Author

Have you ever encountered a similar problem? Or maybe you know what could be causing it @j3k0

@j3k0
Copy link
Owner

j3k0 commented May 30, 2023

@bartushak007 I know it's a late answer. Did you solved it? Maybe you should try using validator.iaptic.com instead of validator.fovea.cc?

@bartushak007
Copy link
Author

Thanks for your answer.
We have an app in production and the reason I was testing it with FOVEA was because I don't know what happens with new purchases if I change FOVEA to IAPTIC in google cloud. I mean there will be some users who will use the old version of the app

the app with those users will validate receipts with fovea
but all transactions will go to iaptic

@j3k0

@j3k0
Copy link
Owner

j3k0 commented May 30, 2023

@bartushak007 traffic for your app can be re-routed so all requests end-up in iaptic.com - Please contact support@iaptic.com to set this up.

@michaelbutler1998
Copy link

@bartushak007 did you find a solution to this, or did you have to move to Iaptic?

I have two versions of my app, one that works fine with Iaptic, and one that does not seem to work with Fovea. I was wondering before setting up Iaptic for the one I use with Fovea, if you found a resolution?

@Diex
Copy link

Diex commented Dec 22, 2023

I'm using no validation.
on android I still get: receiptsVerified: undefined at this.myStore.ready() callback.

@bartushak007
Copy link
Author

@bartushak007 did you find a solution to this, or did you have to move to Iaptic?

I have two versions of my app, one that works fine with Iaptic, and one that does not seem to work with Fovea. I was wondering before setting up Iaptic for the one I use with Fovea, if you found a resolution?

I moved to iaptick and the problem got resolved.

@MarcelSchuermann
Copy link

my subscription on apple iOS iaptic (v3) with store (v13) does not work. :(
See my post in issue #1363 - any ideas?

@j3k0 j3k0 closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants