j3k0 / cordova-plugin-purchase

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

[IOS] [TestFlight] Buy/Restore problem with 2 devices #1554

Open hooliapps opened 1 month ago

hooliapps commented 1 month ago

Hello

I'm tring to test In App Purchases update with TestFlight with 1 iphone and 1 ipad (same email icloud).

  1. On iPhone (OK)

    • I buy the auto-renew purchase
    • Activation is OK
    • I delete the app, then reinstall
    • When i start Store, the buy is auto re-activated: OK
  2. On the ipad (not ok)

    • I start store, nothing
    • I click Restore purchase, nothing
    • I click "Buy" button, then i see a message : I already own the subscription, and i cannot buy it anymore / neither restore

Do you know please if this problem can be due to TestFlight ? Or plugin ?

Code:

function initStore() { storeUrl = iapFoveaValidator; CdvPurchase.store.validator = storeUrl; CdvPurchase.store.register([{.... products CdvPurchase.store.ready(function() { console.log('CdvPurchase.store.ready()'); }); }

CdvPurchase.store.when().approved(function(transaction) {

    console.log('CdvPurchase.store.when().approved(transaction)');

    if (isIOS) {
        if (transaction.products && transaction.products[0] && transaction.products[0].id === '%THEID%') {
            transaction.finish();
            return;
        }
        if (transaction.state === 'approved') {
            transaction.verify();
        }
    }
    else {
        transaction.verify();
    }

});

function storeRestorePurchases() { CdvPurchase.store.restorePurchases(); }