j3k0 / cordova-plugin-purchase

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

[IOS] verified event not called #1369

Closed no-toodate closed 1 year ago

no-toodate commented 1 year ago

Observed behavior

I am trying to finish a purchase on IOS (I also get this problem on Android). I use the iaptic validator.

After the window (called by order) closes, absolutely nothing happens. I do receive an event and all, but I can never finish the purchase. the verified() callback never gets called. So I can't call the finish() function.

Expected behavior

For the verified callback to work.

System Info

"plugins": { "cordova-plugin-network-information": {}, "cordova-plugin-purchase": {} }, "platforms": [ "android", "browser" ] } cordova-plugin-purchase 13.1.6 "Purchase"

Here is the code

` this.store.register(contratAEnregistrer); this.store.verbosity = this.LogLevel.DEBUG; this.store.applicationUsername = () => 'com.celib.mobile.' + this.idUtilisateurMoi;

    // this.store.validator = env.urlSITE + '/paiementmobile/validation';
    this.store.validator = 'https://validator.iaptic.com/v3/validate?appName=myappname&apiKey=myapikey';
    this.store.validator_privacy_policy = ['analytics', 'support', 'tracking', 'fraud'];

    this.store.error((erreur) => {
        console.log('ERREUR:' + erreur.code + ': ' + erreur.message);
    });

    this.store.when()
        .updated(object => {
            console.log('when updated:object: ' + JSON.stringify(object));
        })
        .approved(transaction => {
            console.log('when approved:transaction: ' + JSON.stringify(transaction));
           /* this.informationsTransaction.transaction = transaction.transactionId;
            this.informationsTransaction.purchase = transaction.purchaseId;*/
            this.store.verify(transaction);
        })
        .verified(receipt => {
            console.log('when verified:receipt: ' + JSON.stringify(receipt));
            this.informationsTransaction.transaction = receipt.sourceReceipt.transactions[0].nativePurchase.orderId;
            this.informationsTransaction.purchase = receipt.sourceReceipt.transactions[0].nativePurchase.purchaseToken;
            this.store.finish(receipt);

        })
        .finished(receipt => {
            console.log('when finished:receipt: ' + JSON.stringify(receipt));
        });

    this.store.initialize([
      this.platformStore // google play or apple Appstore
    ]);`
gklasen commented 1 year ago

Well - how did you solve this?