Testing in-app purchases
You can test purchase and payment transactions in your app by using: local testing, which simulates purchases, and BlackBerry World sandbox testing, which sends transactions to the BlackBerry World server but doesn’t charge you.
You can test your app in production mode in BlackBerry World, but your purchases are charged to your account.
You can learn more about each of these methods in the following diagrams:
Payment Options are not available in the System Settings of the BlackBerry 10 Device Simulator. You can test payment transactions locally on the simulator. You can't test payment transactions in production mode on the simulator.
If you are developing a Cascades app, you can use a simulated interface to test in-app purchases by setting your connection mode to PaymentConnectionMode::Test.
When you are testing, your app doesn't contact the BlackBerry World server for any transactions that you make. When you test in-app purchases, the purchase options are displayed in a dialog box.
You can choose the response that is returned to the application (either Success or Failure) and you can specify the reason for failure by selecting a standard error code.
You can view a list of successful purchases and test other requests such as requesting prices, subscription terms, and payment information.
When you tap OK, responses are populated with simulated data that the Payment Service generates.
In Test or local mode, you can use the purchase data from the transactions you make in the current test session, to test the logic for retrieving past purchases. This technique is a great initial testing step for any application that sells digital goods.
Testing in the BlackBerry World sandbox
You can use the BlackBerry World sandbox to test in-app purchases. When you use a sandbox user account to purchase digital goods from BlackBerry World, your app sends transactions to the BlackBerry World server but doesn’t charge you when you make a purchase. The sandbox closely resembles the BlackBerry World storefront, so it’s a great way to test purchases in your app. To learn more about using the BlackBerry World storefront and the vendor portal for BlackBerry World, see the BlackBerry World documentation.
You can test a new app in the sandbox before it is offered for sale in the BlackBerry World storefront. Or you can add new digital goods to an existing app that is for sale in the storefront, and test the purchase of these new digital goods. There is no requirement that the app that you are testing is in a draft or approved state.
Create a BlackBerry World vendor portal membership and log in with an Admin level user account. To learn how to create a vendor portal account, see Managing vendor portal accounts.
Create a sandbox user account. To learn more, see Testing apps with a sandbox user account.
Add apps and digital goods to the vendor portal. To learn more, see Adding apps to BlackBerry World.
BlackBerry World has a cache, so when you add your app and your digital goods to the vendor portal there might be a delay before they are visible in BlackBerry World on your device.
After you create a sandbox user account and add your apps to the vendor portal, you can start testing your apps and digital goods on BlackBerry World. Here's what you need to do with your app and your BlackBerry 10 device to get started.
On your device, swipe down from the top of the screen and tap Settings > Security and Privacy > Development Mode. Tap the Use Development Mode toggle button to turn on Development Mode.
Start BlackBerry World on your device and swipe down from the top of the screen to display the application menu.
Tap Settings > Development Mode, then enter the ID or SKU of your app and tap Load to download your app from your vendor account.
The Development Mode screen, where you can enter the ID of your application and download it right from your vendor account, is visible only if your device is in Development Mode.
After you install your app, you can make purchases in your app without being charged, even if your app is listed as a paid app.
All the purchases you make appear as actual purchases, just like the image on the right.
If your app and the digital goods offered in your app are loaded into the BlackBerry World sandbox, you aren't charged for any of the purchases made in your app. If you make purchases from other paid applications, you are charged as usual.
You must set the connection mode to Production or network to use the sandbox so that the BlackBerry World server is used to complete transactions.
You can download and test apps in BlackBerry World only if your vendor account is added to the sandbox accounts list in the vendor portal.
You can download apps in draft status only from BlackBerry World when you use a sandbox user account (any other user account doesn't work).
You don't need to remove an existing app from the BlackBerry World storefront to add new digital goods in draft status and test it with a sandbox user account.
If you add a new app (meta data) and digital goods to the BlackBerry World vendor portal, you must also add a release (application data) in order to test the download and purchase of the digital goods.
When you add your app and your digital goods to the vendor portal, there may be a delay before they are visible in BlackBerry World on your device.
You can retrieve past purchases only for the current test session. Digital goods that are purchased in a draft status are not written to the transaction database, so when you end the test session the cache is cleared.
You can use the sandbox to test apps running only on a physical device. The sandbox does not support the BlackBerry 10 Device Simulator.
Last modified: 2014-11-17