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
New Contributor
Posts: 6
Registered: ‎07-02-2013
My Device: Blackberry Z10
Accepted Solution

Problem with blackberry.payment

I hope someone can shed some light on this issue, or at least see the mistake I can't!

 

This is the first app I have developed for the Blackberry platforms.

 

I have developed an app for all platforms on the blackberry but I am getting a javascript error when it comes to making an in app purchase, all other uses of the blackberry object work fine.

 

Some details:

 

1) The feature "blackberry.payment" has been added to the config file.

2) I am using the newest builds of the webworks SDK for all platforms.

3) I used the sample code on the api docs here.

 

The problem:

 

I am getting the following error code in JavaScript, this code is being logged by my app on the device itself, downloaded from the app store.

 

"TypeError: 'undefined' is not an object"

 

And relates to the function below (Details removed)

 

try {
    blackberry.payment.purchase({ // This is showing as undefined????
        "digitalGoodID":"****",
        "digitalGoodSKU":"****",
        "digitalGoodName":"****",
        "metaData":"****",
        "purchaseAppName":"****",
        "purchaseAppIcon":null,
        "extraParameters":null
    }, spOnPaySuccess, spOnPayFailure);
} catch (e) {
    spErrorHandler(e);
    alert('Your upgrade purchase has failed!');
}

 

The error is getting thrown when the app tries to use blackberry.payment.purchase!

 

Is there something obvious I just don't see, I am used to working in JavaScript and just can't figure out why the object is coming back as undefined, when all other blackberry... objects work fine.

 

I did notice that when building the app, the command line interface mentioned it could not find blackberry.payment??

 

I hope I have made this clear and thank you in advance.

 

Kind regards

 

Seth

Retired
Posts: 71
Registered: ‎09-19-2012
My Device: No sleep til BlackBerry 10

Re: Problem with blackberry.payment

Which version of the WebWorks SDK do you have installed?

------------------------------
@grahamzibar
-_- zZZ
New Contributor
Posts: 6
Registered: ‎07-02-2013
My Device: Blackberry Z10

Re: Problem with blackberry.payment

Thank you for yuor reply.

 

These are the versions I am using:

 

1) Blackberry 10 Webworks 1.0.4.7

2) Blackberry Webworks for Tablet 2.2.0.5

3) Blackberry Webworks 2.3.1.5

 

Thnak you

Retired
Posts: 71
Registered: ‎09-19-2012
My Device: No sleep til BlackBerry 10

Re: Problem with blackberry.payment

[ Edited ]

Looks like you have an older version of the BlackBerry 10 WebWorks SDK!  I believe the latest version is 1.0.4.11.  Try installing that version from here (http://developer.blackberry.com/html5/download/) and see if that solves your problem :smileyhappy:

------------------------------
@grahamzibar
-_- zZZ
New Contributor
Posts: 6
Registered: ‎07-02-2013
My Device: Blackberry Z10

Re: Problem with blackberry.payment

Thank you, I will give that a try!

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Problem with blackberry.payment

One other thing to note is to ensure you've waited for the webworksready event before using any blackberry APIs. 


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
New Contributor
Posts: 6
Registered: ‎07-02-2013
My Device: Blackberry Z10

Re: Problem with blackberry.payment

Thank you for the help, yes already made sure any use of the blackberry object is only called when webworks loaded!

 

I download the BB10 SDK as suggested, still surprised the one I downloaded only in February this year, had an issue with the payment module.

 

Anyway, double checked my code and re-packaged the app with the latest SDK and no errors showed this time in the command line, so looking promising.

 

I submitted the app last week and got an email this morning saying it has been approved, just waiting for the update to come through so I can test it on my device.

 

Did notice a strange issue with App World though, got the email confirming the update is up for sale, when I view app world in a browser the newest versions shows, but when I access using my device, still showing the old version number, even though got an update notification on the device, still takes me to the old version??

 

Thank you for your help.

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Problem with blackberry.payment

The BlackBerry World cache on the device may take a bit of time (~24 hours) to refresh. Likely it's just a matter of time.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
New Contributor
Posts: 6
Registered: ‎07-02-2013
My Device: Blackberry Z10

Re: Problem with blackberry.payment

Thanks, I did wonder if it took time to propagate or caching was involved.

 

:smileyhappy: