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
Developer
StevenKader
Posts: 638
Registered: ‎02-03-2010
My Device: Z10 LE

Need Help with Payment Service

Trying to do in-app purchase.  Testing dialog box comes up and I select a succes event.  The app goes into the handlePurchase()  slot but the reply is always 'not finished'.  Not sure what I am missing.  

 

void myapp::purchase() {
	//Request a purchase using the ID and SKU of the digital good.
	const PurchaseReply *reply = m_paymentManager->requestPurchase(
			"232925" , "");

	// Connect the finished() signal to a slot to handle the purchase.
	connect(reply, SIGNAL(finished()), SLOT(handlePurchase()));
}

void myapp::handlePurchase() {
	fprintf(stderr, "In Handle Purchase\n");

	bb::platform::PurchaseReply *reply = qobject_cast<
	bb::platform::PurchaseReply*>(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()) {

					fprintf(stderr, "Purchase Error\n");
					//   emit infoResponseError(reply->errorCode(), reply->errorText());

					//Emit a success signal if there were no errors.
				} else {

					fprintf(stderr, "Purchase Success\n");
					setFullVersion() ;
					//  const QString displayString = receiptToString(reply->receipt());

					//   emit purchaseResponseSuccess(displayString);
				}
			} else {
				fprintf(stderr, "REply not finished\n");
				qDebug() << "Purchase request did not finish.";
			}

			reply->deleteLater();
		}

 


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing
Please use plain text.
New Contributor
Kevin_Deamandel
Posts: 3
Registered: ‎02-21-2013
My Device: Blackberry 8520

Re: Need Help with Payment Service

Please use plain text.