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
Developer
Zymatic
Posts: 144
Registered: ‎12-18-2010
My Device: Limited Edition Z10 & Blackberry Playbook
My Carrier: Rogers Wireless

Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

[ Edited ]

Hi,

 

I currently have an app that is posted for sale in BB World that I want to add in app purchases too.  I've created my Digital Goods in the Vendor Portal and they are approved and posted for sale as well.  I have implemented the payment service code into my development version of my app.  When I try to test purchases using the sandbox method I get the "Confirm Purchase" dialog to show and it is populated with info from the Digital Good but when I press the purchase button I get an error that states "The item you requested is invalid."

 

Edit:  I get the same error if I put my app into Test mode.

 

Thanks,

Playbook Apps:
Touch Painter, LinkShrink

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

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

Hi there,

 

In order to test in app payments with BlackBerry World you need to download through BlackBerry World. Here is a blog that explains how to do this:

http://devblog.blackberry.com/2013/01/blackberry-payment-services-sandbox/

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Developer
Zymatic
Posts: 144
Registered: ‎12-18-2010
My Device: Limited Edition Z10 & Blackberry Playbook
My Carrier: Rogers Wireless

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

Thanks Garett,

 

One more question though, does that mean that if I test it and it doesn't work I need to upload a new version to app world everytime?  And if so, does it need to be signed, or can I upload an unsigned version?

 

Also,  I was getting that same error about the item being invalid when using Test mode, any thoughts on why, or what is wrong?

 

Thanks

Playbook Apps:
Touch Painter, LinkShrink

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

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

BlackBerry World only accepts signed builds. My recommendation is to test thoroughly in local mode and only use sandbox to verify all digital goods in your portal are set up correctly.

 

Test mode should never say that a digital good is invalid, it doesn't check the server so it should always assume whatever you pass is ok. If you're seeing something contrary we may need to investigate the code.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Developer
Zymatic
Posts: 144
Registered: ‎12-18-2010
My Device: Limited Edition Z10 & Blackberry Playbook
My Carrier: Rogers Wireless

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

[ Edited ]

Hi Garett,

 

I was mistaken, I wasn't getting the same error in Test mode, but I am having a problem.

 

I followed the documentation here, but when PurchaseReply::isFinished()  is called it always returns false.  I have a slot connected to the finished() signal of the PurchaseReply, and that slot function gets called but when it checks if the reply is done, it is always false.

 

Any ideas?  I can give you more specific code snippits if you'd like.  Does the Payment System require any permissions to be set in the bar-descriptor.xml?

Playbook Apps:
Touch Painter, LinkShrink

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

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

Hmmm, could be a bug. Could you remove the isFinished() check and see if everyhting completes as expected? If it does then let me know what device and OS you are using to test, I will test here and log a bug if needed.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Developer
Zymatic
Posts: 144
Registered: ‎12-18-2010
My Device: Limited Edition Z10 & Blackberry Playbook
My Carrier: Rogers Wireless

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

So I removed the check for isFinished() and it completed the transaction as I expected.  So possibily it is a bug.  I am testing on a Z10.  The SDK version I am using is 10.0.10.261 and my Z10 has OS Version 10.0.10.672 and Software Release 10.0.10.85.  Let me know if you need any more info.

 

Playbook Apps:
Touch Painter, LinkShrink

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

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

Thanks for the added details. I tested against 10.1 and the issue still appears so I have logged it internally. Please feel free to log in JIRA (linked in my sig) if you'd like to track as well.

 

For now I would suggest not checking the isFinished() call and skip right to the error check.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Contributor
ajochems
Posts: 33
Registered: ‎01-12-2011
My Device: Torch

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

Also aside from the isFinished problem i have problems with checking the existing purchases. The problems with the inapp payments have causes a lot of user having bought the full version via a digital good without the app handling it correctly. Now in a update release i want to check if users made any previous purchase to unlock the complete app version. Using the PaymentManager in Test mode i can test a purchase but i do not have the option to test previous purchases. However using the sandbox mode i am not able to get it to work. The code i use is:

 

void LogoMania::checkPreviousPurchase()
{
	qDebug() << "### Connect to payment manager";
	// Get the window group ID and pass it to the PaymentService instance.
	const QString windowGroupId = bb::cascades::Application::instance()->mainWindow()->groupId();
	m_paymentManager->setWindowGroupId(windowGroupId);
	// Set the application name so that it shows up in the purchase banner.
	m_paymentManager->setApplicationName("LogoMania");
	//Request the existing purchases from the Payment Services server.
	const ExistingPurchasesReply *reply = m_paymentManager->requestExistingPurchases(true);
	qDebug() << "### ExistingPurchasesReply - isError(): " << reply->isError() << " - isFinished(): "<<reply->isFinished();
	connect(m_paymentManager, SIGNAL(existingPurchasesFinished(bb::platform::ExistingPurchasesReply*)),SLOT(handleExistingPurchases(bb::platform::ExistingPurchasesReply*)));
}

 

And the method that should handle the result:

void LogoMania::handleExistingPurchases(bb::platform::ExistingPurchasesReply* reply)
{
	qDebug() << "### handleExistingPurchases() isError(): " << reply->isError();
	// Emit an error signal if there were errors.
	if (reply->isError()) {
		qDebug() << "### Existing Purchases response error. Code(" << reply->errorCode() << ") Text(" << reply->errorText() << ")";
		// emit error signal
		qDebug() << "### Emit Purchase Error Signal";
		emit infoResponseError(reply->errorCode(), reply->errorText());
	//Emit a success signal if there were no errors.
	} else {
		qDebug() << "### Purchase check OK";
		// update checked parameter
//		lstUserdata.insert("checkedAlreadyPurchased", true);
//		saveUserdata();
		const QList<PurchaseReceipt> receipts = reply->purchases();
		if (!receipts.isEmpty()) {
			qDebug()<<"Number of receipts: "<<receipts.size();
			QString displayString;
			Q_FOREACH(PurchaseReceipt r, receipts) {
				displayString += (receiptToString(r) + "\n");
			}
			const QString purchaseDateString = receipts.first().date().toString();
			saveFullVersionAndUnlock(purchaseDateString);
			// emit success signal
			emit purchaseResponseSuccess(purchaseDateString);
		}
	}
	reply->deleteLater();
}

 However i am not able to test this code and it is not working when i release the Application. So how do i proceed debugging this?

 

Kind Regards,

Andre

 

 

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

Re: Does the App with the Payment Service code need to be in App World to test properly in BB10 Cascades?

Purchases made in Sandbox mode are not written to the transaction database currently, so you will be unable to retrieve past purchases from the BlackBerry World server as you are trying to do in the below code:
m_paymentManager->requestExistingPurchases(true);

 

You would need to pass "false" as the parameter which will pull from the local cache, but have similar results as far as what is returned, allowing you to do full testing.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.