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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
New Contributor
Posts: 3
Registered: ‎01-23-2014
My Device: Z10
My Carrier: MTel
Accepted Solution

paymentservice_purchase_request works in development, always fails in production

I'm trying to implement native support for payment services in an OpenGLES project. When I use 

 

paymentservice_set_connection_mode(true);

 

...it works like a charm, i.e. I see the dialog and can process the request and unlock features in my app.

 

However when I set:

 

paymentservice_set_connection_mode(false);

 

...and then request a purchase like this:

 

if (paymentservice_purchase_request(digital_good_id, NULL, NULL,
			NULL, NULL, NULL, get_window_group_id(), &request_id) != BPS_SUCCESS) {
	fprintf(stderr, "Error: purchase request failed: %d - %s.\n", errno, strerror(errno));
}

 

I always get "Error: purchase request failed: 2 - No such file or directory." I have this in my bbutil.h:

 

bbutil_init_egl(screen_context_t ctx, const char *group_id) {

//code omitted

   rc = screen_create_window(&screen_win, screen_ctx); if (rc) { perror("screen_create_window"); bbutil_terminate(); return EXIT_FAILURE; } rc = screen_create_window_group(screen_win, group_id); if (rc) { perror("screen_create_window group"); bbutil_terminate(); return EXIT_FAILURE; }

 

...and my get_window_group_id() function is the same as the sample in github:

 

static const char * get_window_group_id() {

	static char s_window_group_id[16] = "";

    if (s_window_group_id[0] == '\0') {
        snprintf(s_window_group_id, sizeof(s_window_group_id), "%d", getpid());
    }

    return s_window_group_id;
}

 

I initialize the screen with:

 

	if ( EXIT_SUCCESS != bbutil_init_egl ( screen_cxt, get_window_group_id () ) ) {
		fprintf ( stderr, "bbutil_init_egl failed\n" );
		terminate ();
	}

 

My application was accepted by the revision team but when I download it from AppWorld and try to buy anything it doesn't show anything. What am I doing wrong and what are the usual gotchas in such situation?

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: paymentservice_purchase_request works in development, always fails in production

Hi there,

 

First thing, you'll want to perform testing on your app prior to submitting for approval:

https://developer.blackberry.com/native/documentation/cascades/device_platform/paymentservice/testin...

 

In your app do you ever make a call to chdir()? There's a known issue where if the directory is changed the Payment Service calls will fail.

Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
Posts: 3
Registered: ‎01-23-2014
My Device: Z10
My Carrier: MTel

Re: paymentservice_purchase_request works in development, always fails in production

Yes, I figured it out myself. I'm poring an OpenGL engine to BlackBerry OS 10 that uses lua scripts and I need to chdir to the assets/lua/ folder to load the scripts. I found a way to solve the problem by invoking chdir to the main directory before requesting payment and then doing chdir again. It works like a charm.