Coder Social home page Coder Social logo

Comments (4)

j3k0 avatar j3k0 commented on July 24, 2024

paymentQueueRestoreCompletedTransactionsFinished is called when all transactions are finished. However, individual success of each payment is also reported through the paymentQueue:updatedTransactions: method, which is what the plugin uses.

restore has been tested ok on PhoneGap 3.1, you can check the code on test/v31-src. I will add some doc on how to run the test, and how to adapt it so you can try your own bundle id and product id.

from cordova-plugin-purchase.

futurend avatar futurend commented on July 24, 2024

It isn't working for me either.

Buying a product works as expected;
When trying to buy the same product more than once, the restore happens, as expected;

  • When restoring by calling storekit.restore() in javascript, updatedTransactions never fires in objective-c, even though the restore completes by calling paymentQueueRestoreCompletedTransactionsFinished.

It even fails, as expected, when the user gives invalid credentials, or doesn't have a product to restore.

I've been trying all sorts of variations, but have had no success in making the restore work.
My code is quite similar to the example, what could I be missing?

load: function (callback) {
    if (!storekit) {
        console.log('In-App Purchases not available');
        return;
    }
    console.log('In-App Purchases available');
    // Initialize
    storekit.init({
        debug:    true,
        ready:    IAP.onReady,
        purchase: IAP.onPurchase,
        restore:  IAP.onRestore,
        error:    IAP.onError
    });
},

onReady: function () {
    IAP.isReady = true;
    storekit.load(IAP.list, function (products, invalidIds) {
        IAP.products = products;
        IAP.loadCallback();
    });
},

onRestore: function (transactionId, productId, transactionReceipt) {
    IAP.restoreCallback(transactionId, productId, transactionReceipt);
},

restore: function (callback) {
    IAP.restoreCallback = callback;
    storekit.restore();
},

Most recent PhoneGap-InAppPurchase-iOS plugin release,
Cordova 3.1.0-0.1.0,
iOS 5.0 thru 7,
tested only in sandboxed App Store, through Xcode 5.0.

from cordova-plugin-purchase.

hellopablo avatar hellopablo commented on July 24, 2024

Yip, I'm facing this issue too. The callbacks are commented out. Additionally, they seem to be calling back the incorrect methods.

Both callbacks are prefixed with 'on' whereas in the JS they do not have that prefix. I'm not an Obj-C programmer at all but in InAppPurchase.m, uncommenting the blocks and changing lines 195 & 201 to @"window.storekit.restoreCompletedTransactionsFailed(%d)", error.code]; and NSString *js = @"window.storekit.restoreCompletedTransactionsFinished()"; respectively solves the issue.

from cordova-plugin-purchase.

Allan-Nava avatar Allan-Nava commented on July 24, 2024

I have these errors:

Error: could not load tv.sportube.sportube.single_event_seriec
2017-09-26 15:23:50.785927+0200 Sportube[3191:1521936] buy
2017-09-26 15:23:50.786077+0200 Sportube[3191:1521936] InAppPurchase[objc]: About to do IAP
2017-09-26 15:23:50.786630+0200 Sportube[3191:1521936] *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: Invalid product identifier: (null)

from cordova-plugin-purchase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.