If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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

Payment Service

Reply
Contributor
thorbjrn
Posts: 11
Registered: ‎09-28-2012
My Device: Playbook
My Carrier: N/A

Payment service problem after upgrading to BB10

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.

 

Cheers,

Thorbjørn - Tactile Entertaintment

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Payment service problem after upgrading to BB10

Hi Thorbjørn,

 

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:

http://developer.blackberry.com/native/reference/com.qnx.doc.bps.lib_ref/com.qnx.doc.bps.lib_ref/top...

 

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.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
thorbjrn
Posts: 11
Registered: ‎09-28-2012
My Device: Playbook
My Carrier: N/A

Re: Payment service problem after upgrading to BB10

Hi Garett,

 

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-Development/A-Post-Mortem-Supporting-In-App-Purchases-...), but can't seem to figure out what to do on BB10.

 

Do you guys have any information on how to implement PaymentServices while using a 3rd party enviroment (like Cocos2d-x)?

 

 

Cheers,

Thorbjørn

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Payment service problem after upgrading to BB10

Hi Thorbjørn,

 

I will need to loop in an OpenGL person to see if they can help find the cause of this one. I should be back in a bit.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Payment service problem after upgrading to BB10

Hi Thorbjørn,

 

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?

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
thorbjrn
Posts: 11
Registered: ‎09-28-2012
My Device: Playbook
My Carrier: N/A

Re: Payment service problem after upgrading to BB10

Hi Garett,

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,

Thorbjørn

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Payment service problem after upgrading to BB10

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.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
thorbjrn
Posts: 11
Registered: ‎09-28-2012
My Device: Playbook
My Carrier: N/A

Re: Payment service problem after upgrading to BB10

Hi Garett,

 

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.

 

 

Cheers,

Thorbjørn

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Payment service problem after upgrading to BB10

Hi Thorbjørn,

 

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?

 

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
thorbjrn
Posts: 11
Registered: ‎09-28-2012
My Device: Playbook
My Carrier: N/A

Re: Payment service problem after upgrading to BB10

Hi Garett,

 

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):

screen_create_window_group(screen_win, get_window_group_id());

 

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.

 

 

Cheers,

Thorbjørn

 

 

 

Please use plain text.