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
Posts: 14
Registered: ‎10-12-2013
My Device: BB10
My Carrier: idea

Re: in-app purchase in sand box testing problem

hi,

 

card means i prepared a separate page ,container and  then tried to purchase .I did nt directly use the card proprty of bb10.just created a page  and from  there i am trying to purchase.

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

Re: in-app purchase in sand box testing problem

Ah ok. In BlackBerry 10 a card means a page in your app is invoked from another app.

 

How are you setting up the Window Group ID in your app? It could be that the window is being drawn but not visibly which would result in this problem.

Garett
@garettBeuk
--
Goodbye everybody!
Contributor
Posts: 14
Registered: ‎10-12-2013
My Device: BB10
My Carrier: idea

Re: in-app purchase in sand box testing problem

const QString windowGroupId =
        bb::cascades::Application::instance()->mainWindow()->groupId();
    m_paymentManager->setWindowGroupId(windowGroupId);

 

this is how i created the window groupid

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

Re: in-app purchase in sand box testing problem

Ok, that looks good. I'd really need a sample app now to see what's going wrong, or you can compare your app to one of the payment samples to see what;s different. There's definitely something strange happening within the app causing the failure.

Garett
@garettBeuk
--
Goodbye everybody!
Contributor
Posts: 14
Registered: ‎10-12-2013
My Device: BB10
My Carrier: idea

Re: in-app purchase in sand box testing problem

    const PurchaseReply *reply = m_paymentManager->requestPurchase(id, sku,name,metadata);


    bool success = QObject::connect(reply,
         SIGNAL(finished()),
         this,
         SLOT(handlePurchase()));
    Q_ASSERT(success);
      Q_UNUSED(success);
    if (success) {



    } else {



  
    }

 

 

 

 

 

 

 

void Payment::handlePurchase()
{
   
    try
    {

    bb:Smiley Tonguelatform:Smiley TongueurchaseReply *reply =
        qobject_cast<bb:Smiley Tonguelatform:Smiley TongueurchaseReply*>(sender());
    Q_ASSERT(reply);

    // Check to see if the request finished.
    if (reply->isFinished()) {

        // Emit an error signal if there were errors.
        if (reply->isError()) {

            emit infoResponseError(reply->errorCode(), reply->errorText());
            qDebug() << "Purchase Request has some errors.";
        // Emit a success signal if there were no errors.
        } else {
            const QString displayString = receiptToString(reply->receipt());


           showToastMsg(displayString);
           showToastMsg("handling purchase");
            qDebug() << "Purchase successfull";
            SystemDialog *uuidDialog = new SystemDialog("OK");
                                                        uuidDialog->setTitle("Purchase Item");
                                                        uuidDialog->setBody("This item is successfully purchased");

                                                        uuidDialog->show();
                                                     dbUtil->UpdatePages(SKU);

            emit purchaseResponseSuccess(displayString);
        }
    } else {
        qDebug() << "Purchase request did not finish.";
    }

    reply->deleteLater();
    }

    catch(std::exception& ex)
    {
        throw ex;

    }
}

 

this is the code to request purchase

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

Re: in-app purchase in sand box testing problem

I would need a full sample. The code below looks fine, but it's just one piece of the puzzle

Garett
@garettBeuk
--
Goodbye everybody!