blackberry/BB10-WebWorks-Framework

blackberry.payment.checkExisting() for SKU claiming virtual good not purchased

Opened this issue · 9 comments

I'm using the payment api as follows:

...
restoreVirtualGood: function() {
  var onsuccess = function(data) {
    if (data.subscriptionExists) {
      // user purchased virtual good!
    }
  };

  var onfailure = function(error) {
    // could not restore
  };

  blackberry.payment.checkExisting({ sku: 'VRTLGD-002' }, onsuccess, onfailure);
},
...

And it appears to always return false for data.subscriptionExists. I've also noticed that all examples/unit tests for blackberry.payment.checkExisting() pass an ID instead of an SKU... so I have seen no proof of this method working with an SKU. Can I have some confirmation that this method works with an SKU? Perhaps add a unit test?

I'm not sure if using an id instead will fix my problem... and I'm not sure how I can verify it without submitting to the App World. Any suggestions?

cc @rwmtse Any thoughts?

@scdowney Do you have any suggestions?

This is a defect in the underlying payment service, that is on our backlog.

Currently, checkExisting will always return false for non-subscription digital goods. The desired behavior is to return true for regular goods, true for subscription goods that are currently valid, but false otherwise.

I assume once the payment service is fixed that this API will just work appropriately? I.e. no API or client side changes required?


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

How do we check for check for existing purchased goods in the meantime? Would getExistingPurchases return regular goods or does it suffer from the same defect?

@kwallis that is correct. whenever the fix goes out, the API will work as expected.

@achan getExistingPurchases will indeed have the information, so you can use that in the meantime.

@scdowney Thank you!

What's the ideal way to test this? Should I just stub the payment service? Or is there a better way?

Unfortunately there isn't really any exact way to test that functionality. Even for sandbox mode apps, as far as I know, checkExisting won't work as expected for purchased goods/subscriptions (since in this environment purchases are not charged).

Using local/development mode, checkExisting should always return true.

In order to fully test different digital good/subscription good states, you may need to stub out to provide the desired information in checkExisting and/or getExistingPurchases responses.

Thanks. I'll carry on from here.

I'll leave it up to you guys whether you consider this issue closed or not...