December 16, 2012

daliusd daliusd
Lab Rat
135 posts

Payment Service with Qt

 

Hi,

Has anyone managed to use payment service with Qt? I have managed to show payment dialog but it looks like disabled (see image). In paymentservice_purchase_request I have tried using window group id from QApplication::topLevelWidgets().first() (there is only in QtQuick app), tried creating separate window (basically copy-pasted setup_screen() from https://github.com/blackberry/NDK-Samples/blob/next/PaymentService/main.c) and it still looks disabled.

What disables that dialog?

Maybe I shouldn’t use native API and do purchases in other way?

1 reply

December 16, 2012

daliusd daliusd
Lab Rat
135 posts

I have “solved” problem myself. Instead of using native solution I have based my code on https://github.com/blackberry/Cascades-Samples/tree/master/paymentservice and it works very nice. Actually I like it better because I have to write less code and “bb::platform” code does not look cascades specific (I hope it will remain so). Just as help to others here what you should take into account by adopting this cascades solution for Qt app:

1. Don’t forget to add some extra “using namespace bb::platform” or use “bb::platform::” before specific functions.

2. Add following line to pro file: LIBS += -lbbplatform

3. If you are writing QtQuick app here is how you should set Window Group id (it works for me so I guess that’s correct way):

  1. QPlatformNativeInterface * const nativeInterface = QApplication::platformNativeInterface();
  2.  
  3. const QString windowGroupId = static_cast<const char *>(nativeInterface->nativeResourceForWidget("windowGroup", QApplication::topLevelWidgets().first()));
  4.  
  5. m_paymentManager->setWindowGroupId(windowGroupId);

If someone from RIM team is reading and has to add any corrections please do it. While it is working (for me) I don’t want incorrect solution to float around.

 
  ‹‹ BlackBerry Qt Porting Program - Submit your Porting Plan to receive a BlackBerry Dev Alpha Device      Problems importing another JavaScript library into QML ››

You must log in to post a reply. Not a member yet? Register here!