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?

    !http://i.imgur.com/wJ0Zq.png!

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



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

    @QPlatformNativeInterface * const nativeInterface = QApplication::platformNativeInterface();

    const QString windowGroupId = static_cast<const char *>(nativeInterface->nativeResourceForWidget("windowGroup", QApplication::topLevelWidgets().first()));

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.