Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 17
Registered: ‎01-25-2013
My Device: None
My Carrier: Rogers
Accepted Solution

can't seem to check for existing purchases

Hey guys, I have two quick questions/issues...

 

1) How do you usually test the blackberry.payment api? I've tried using devmode but I've noticed the behavior is not quite 100% the same as production.

 

2) I seem to be having problems checking whether a user has purchased a virtual good. I'm doing the following:

 

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

 

setting developmentMode = true seems to work fine... but when I try this with my app in the BlackBerry World it seems to constantly think I haven't made the purchase. I tried purchasing the virtual good with my own account and verified that checkExisting() doesn't think I've purchased the good.

 

Has anyone else done something similar?

Contributor
Posts: 17
Registered: ‎01-25-2013
My Device: None
My Carrier: Rogers

Re: can't seem to check for existing purchases

btw, my onsuccess is like this:

 

var onsuccess = function(data) {
  if (data.subscriptionExists) {

  ...

  }

}

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: can't seem to check for existing purchases

1) Use dev mode to make sure your JavaScript works. Then start testing via production SKUs with dev mode turned off.

 

2) Are you testing your production digital good using a sandbox account?  If so please note the following

 

"3) Any goods purchased while in sandboxed mode are not written to the transaction database currently, which means you will be unable to retrieve past goods “purchased” while in sandbox mode"

 From http://devblog.blackberry.com/2013/01/blackberry-payment-services-sandbox/

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Contributor
Posts: 17
Registered: ‎01-25-2013
My Device: None
My Carrier: Rogers

Re: can't seem to check for existing purchases

1) I tested with devmode and my JS works as expected. But I can't test with devmode off because I cannot make purchases from an app not installed from BlackBerry World. Am I doing something wrong?

 

2) I purchased the digital good on a non-sandboxed account... I also received emails from users of my app complaining that they couldn't restore their purchase.

 

For context, here's the actual code I use to check for existing purchase:

 

https://github.com/achan/snooby/blob/master/js/support.js#L20

 

One thing I noticed was that all the examples and unit tests for checkExisting() pass an ID instead of the SKU... In my latest code, I now pass the ID. I'm not sure if this will fix it as I haven't submitted it to BlackBerry World yet.

 

Contributor
Posts: 17
Registered: ‎01-25-2013
My Device: None
My Carrier: Rogers

Re: can't seem to check for existing purchases

In case anyone is wondering, there's currently a bug in the WebWorks payment api that will return false for any non-subscription goods for checkExisting().

 

The temporary solution is to use getExistingPurchases().

 

https://github.com/blackberry/BB10-WebWorks-Framework/issues/638