11-09-2012 06:28 AM
Hi BlackBerry Support,
I recently upgraded an app I'm working on from BlackBerry Tablet OS to BlackBerry 10.
Everything still works fine, except for the payment-system - everytime I try to send a request (with paymentservice_purchase_request()), I get an error (with ID: 1).
I haven't changed anything in the payment-system, and now I can't use it all.
Is there a problem with PaymentServices at the moment, or is there something specific I need to do make the system work on BB10?
Btw I'm testing the app on a BB10 alpha device.
Thorbjørn - Tactile Entertaintment
11-12-2012 11:40 AM
Live Payment testing is not available for BlackBerry 10 at the moment. If you need to perform testing then for the moment you can use local or test mode:
A solution for live testing in BlackBerry 10 is still in the works but for now all payments are disabled for the BlackBerry 10 App World client provided for use with the Dev Alpha.
11-13-2012 04:08 AM
Thanks for your answer.
I have tried using the test mode (paymentservice_set_connection_mode(true)), but found that I can't even get this to work - there is no window(s) showing up.
The reason this is not straightforward is, that the game I'm working on is using Cocos2d-x.
I've solved this on BlackBerry Tablet OS (with a bit of help from this post: http://supportforums.blackberry.com/t5/Native-Deve
Do you guys have any information on how to implement PaymentServices while using a 3rd party enviroment (like Cocos2d-x)?
11-14-2012 01:27 PM
11-14-2012 02:30 PM
Could you provide some more details on the flow of your app? Specifically I would like to know if any errors get thrown, if so at what line?
Does the app freeze or change att all when you attempt to make a purchase?
Where the payment service calls are being called from (same thread as the BPS loop?)?
Which NDK did you use to compile your app?
11-15-2012 04:52 AM
On BlackBerry NDK 2.0 (Tablet OS), I'm able to get payment windows and completing a payment-event by doing the following (all of this is done in a seperate thread):
First I get hold of the "screen_window_t"-structure from screen.h. When using Cocos2d-x I have to retrieve this from a file called "CCEGLView".
Afterwards I call bps_initialize() and paymentservice_request_events(0), and then the function screen_create_window_group() - with parameter 1 being the "screen_window" and 2 being the function get_window_group_id() (taken from the PaymentService sample-app).
At the end I call the function paymentservice_purchase_request(), with all of a specific digital goods parameters, and parameter 8 being get_window_group_id() (and then wait for callback with bps_get_event(&event, -1)).
If I try using the same procedure on BlackBerry NDK 10.0.9.386 (again in a seperate thread), I don't get any error messages, and the function paymentservice_purchase_request() runs succesfully. I'm however unable to get any PaymentService-windows to be shown.
Thanks in advance,
11-15-2012 07:58 AM
Are you recompiling with the BlackBerry 10 NDK when testing on the Dev Alpha?
The issue may be related to this or the window ID being passed in, if it is not valid then nothing would be displayed.
It may also be a worthwhile test to try calling the payment functions from the same thread that you use to start listening to BPS events.
11-15-2012 09:48 AM
I'm not sure what you mean by "recompiling with the BlackBerry 10 NDK".
When testing the app on Dev Alpha I import the project into the newer edition of QNX Momentics (QNX® Momentics® IDE for BlackBerry® 10 Native SDK, Version: 10.0.9, Build id: v201209241008), clean everything, and then build the app again.
I also don't really understand the window ID. Is there only one, or several windows (and IDs) in a app? Does every window have a ID? And what constitues a window? Is there maybe somewhere I can read more about it?
I have already tried (several times) to do everything in the same thread.
11-15-2012 11:06 AM
A valid OpenGL window is required to be specified in order for the payment UI to get displayed, if the ID of the window being used in your app is not passed as a parameter then there won't be a way for the UI to get rendered for the end user.
There should be only one window ID. Which are you passing to the Payment APIs and how is this being retrieved from Cocos2D?
11-16-2012 07:17 AM
I get the "screen_window" from Cocos2d-x by writing:
CCEGLView* cceglView = CCDirector::sharedDirector()->getOpenGLView(); screen_window_t screen_win = cceglView->m_screenWindow;
I then create a "window group" by writing (get_window_group_id() is from the sample):
Which i pass on to the purchase request:
paymentservice_purchase_request(digital_good_id, digital_good_sku, digital_good_name, metadata, purchase_app_name, purchase_app_icon, get_window_group_id(), &request_id)
Again, this worked fine on NDK 2.0, but don't do anything on NDK 10.