BlackBerry Payment Services: Return of the Sandbox

Adobe AIR Development

sandbox-1

By Sandbox.png: DaniDF1995 derivative work: Gregor Shapiro (Sandbox.png) [Public domain], via Wikimedia Commons

If you are a developing for BlackBerry 10 and like the idea of making money, then you have likely implemented – or at least taken a look at – the BlackBerry Payment Service. It provides integration directly with BlackBerry World to allow the sale of Digital Goods. Up until the latest software release (10.0.09.2320) there were two ways to test the Payment Service:

1) Local Mode Testing
This mode is set within the application and allows you as the developer to choose what response is returned to the application (Success or Failure, and if Failure you can also specify the reason using standard error codes). Local mode also lets you make purchases within your application, then retrieve any purchases made during the same session to let devs test out their logic for retrieving passed purchases. This is a great initial testing step for any application that would like to sell digital goods.

2) Live/Production Testing
This is really the last line of testing that should be done on an application with digital goods; submit the application to BlackBerry World along with all your digital goods, then wait for it to be approved. Once approved, you post it for sale and try making a purchase using real money and also test restoring past purchases. As this uses real money, it is really only a good idea to do as a final testing step.

The two options above leave a fair amount of room between accurate but faked testing, and testing which requires money every time it is done. On BlackBerry PlayBook OS and BlackBerry OS 7.1 and lower, there existed “sandbox” mode which was used to close the gap between the two test methods, and provide a means to test digital goods where your app actually talks to the BlackBerry World servers but it doesn’t cost you any money to do so. As of the latest software release, this functionality has been enabled and can now be used to test all of your applications that make use of the payment service whether they are in Draft mode or Live/Public.

How to test your application using a sandboxed account:

1) Make sure the BlackBerry ID that is associated with the device you are using for testing is also added to the list of sandbox user accounts in your vendor portal:

sandbox-4

2) After this is done, you should ensure that your application and any digital goods you would like to test are added to your vendor portal
3) On your BlackBerry 10 Dev Alpha, you should now enable Development Mode (Settings > Security and Privacy > Development Mode)
4) Once Development Mode is enabled, a new option becomes available in the BlackBerry World client. Launch the client on your device, then swipe down from the top bezel to bring up the application Menu and select “Settings”. In the new screen, select “Development Mode” from the list (this will only be visible if your device is in Development Mode) which will push a new screen that will let you enter the ID of your application and download it right from your vendor account. This is also a great way to test out Draft versions of your application before posting them for sale just to make 100% sure they work as you expect.

sandbox-5

Once your application is downloaded, you can then test out payments without being charged. Note that even if your application is listed as paid you will not be charged using this method.

Some important things to take into consideration and known issues when using this method:

1) In your application, you should have your code set to Live or Production mode
2) This method can only be used to download and test applications in portals where your account has been added to the sandbox accounts list
3) Any goods purchased while in sandboxed mode are not written to the transaction database currently, which means you will be unable to retrieve past goods “purchased” while in sandbox mode
4) Sandbox mode only works in a live device at the moment; it will not work in the BlackBerry 10 VM
5) You may encounter download and install errors – if this happens, then please keep trying and it should eventually succeed

For more information on payment services for the various BlackBerry 10 platforms, please refer to the following resources:

Cascades: https://developer.blackberry.com/cascades/documentation/device_platform/paymentservice/index.html
Native: http://developer.blackberry.com/native/documentation/bb10/recipe_payment_2006487_11.html
AIR: https://developer.blackberry.com/air/documentation/bb10/payment_service_air.html
Android: http://developer.blackberry.com/android/apisupport/apisupport_inapp_payments_support.html

As always, if you have any questions please feel free to post to the forums or send a message on Twitter to @BlackBerryDev or me, @garettbeukeboom.

About garett

Garett is a member of the Developer Relations team and has been with BlackBerry since 2008. He specializes in app monetization (Payment, Advertising, Analytics SDKs) and Push development. He is one of the individuals involved with the forums (gbeukeboom), Issue Tracker and can be found tweeting from @BlackBerryDev with the ^GB signature.

Join the conversation

Show comments Hide comments
+ -
blog comments powered by Disqus