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

Native Development

Reply
Contributor
pbcoder
Posts: 17
Registered: ‎07-01-2011
My Device: Playbook
My Carrier: DontKnow

"Selling Digital Goods" recipe / tutorial

Hi,

 

I just read the "Selling Digital Goods" recipe on the Blackberry Native SDK documentation website. I have one question. The code allocates memory for a purchase_params_t by calling malloc(). But there is no free() call anywhere in the sample code. Is the memory freed automatically by paymentservice_purchase()? Or is it the responsibility of the programmer to call free() (and the sample code just doesn't show it) ? Must purchase_params_t be allocated on the heap? Or can it go on the stack?

 

Thanks in advance!

Please use plain text.
Contributor
pbcoder
Posts: 17
Registered: ‎07-01-2011
My Device: Playbook
My Carrier: DontKnow

Re: "Selling Digital Goods" recipe / tutorial

[ Edited ]

One more thing... the API reference shows the paymentservice_purchase() function as:

 

int paymentservice_purchase(purchase_params_t params, const char *group_id)

 

It looks like it takes a copy of a purchase_params_t object. But the sample code shows it as taking a pointer... I'm confused...

 

"Selling Digital Goods" Recipe link: https://bdsc.webapps.blackberry.com/native/documentation/recipe_payment_1876391_11.html

 

paymentservice_purchase() API Reference link: https://bdsc.webapps.blackberry.com/native/reference/com.qnx.doc.bps.lib_ref/com.qnx.doc.bps.lib_ref...

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: "Selling Digital Goods" recipe / tutorial

According to headers params is not a pointer

int paymentservice_purchase(purchase_params_t params, const char *group_id)
Please use plain text.
Contributor
pbcoder
Posts: 17
Registered: ‎07-01-2011
My Device: Playbook
My Carrier: DontKnow

Re: "Selling Digital Goods" recipe / tutorial

Thanks BGmot!


@Blackberry/RIM, can you please update the sample code in the aforementioned recipe? It is showing incorrect usage of the payment API.

 

Thanks in advance.

Please use plain text.
Contributor
pbcoder
Posts: 17
Registered: ‎07-01-2011
My Device: Playbook
My Carrier: DontKnow

Re: "Selling Digital Goods" recipe / tutorial

btw - what is the philosophy behind passing purchase_params_t by value instead of by pointer or by constant reference?

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

Re: "Selling Digital Goods" recipe / tutorial

Hi pbcoder,

 

Feel free to log this and any other found issues directly into our external bug tracking/feature request system:

Issue Tracker

 

This will let you track the progress of the fix.

 

Cheers,

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
pbcoder
Posts: 17
Registered: ‎07-01-2011
My Device: Playbook
My Carrier: DontKnow

Re: "Selling Digital Goods" recipe / tutorial

Hi gbeukeboom,

 

Thanks for your reply. I've logged this into the Issue Tracker. If anyone wants to track its progress, you can find the issue here:

 

https://www.blackberry.com/jira/browse/DOC-49

Please use plain text.