Testing in-app purchases

You can use two methods to test the purchase of your digital goods: Locally, with your app set to Development Mode for simulated purchases; and BlackBerry World testing, with a sandbox user account.

Testing in development mode

Setting developmentMode to True in your app allows you to use a simulated interface to locally test digital purchases in your app.

In development mode, your app doesn’t contact the Payment Service server for any transactions. When you test making a purchase, the purchase options are displayed as a dialog box. You can choose what response is returned to the application (either Success or Failure) and you can specify the reason for failures using standard error codes.

You can also view a list of successful purchases and test other activities such as requesting prices, subscription terms, and payment information.

When you tap OK, responses are populated with simulated data.

Make a purchase from a device showing Local Mode, and click the OK button to simulate a purchase.

You can use development mode to test your logic for retrieving past purchases using purchase data for transactions made in the current session. This is a great initial testing step for any application that sells digital goods.

Testing with BlackBerry World

When you add new digital goods to the BlackBerry World vendor portal you can test them while they are still in a Draft status using a sandbox user account. This is a great method for testing the purchase of your digital goods in a way that is very close to the end-user experience.

When you use a sandbox user account to purchase digital goods from BlackBerry World, you are not charged for the purchase. If you use the sandbox user account to purchase the goods or apps of another vendor, however, you will be charged for the purchase.

To create a sandbox user account, you need to have a BlackBerry World vendor portal membership and sign in with an Admin level user account.

To test the purchase of your digital goods with a sandbox user account:

  1. Sign in to the BlackBerry World vendor portal with a user account that has Admin level priviledges, and click Sandbox from the left pane.

  2. Click Add New User and complete the form using a BlackBerry ID.

    The Manage Sandbox User Accounts screen of the BlackBerry World vendor portal provides a button labeled Add New User and a table the shows the email and description of sandbox users currently included for the vendor account.

  3. Add digital goods to a new or existing app that has been added to the vendor portal.
  4. Enable Development Mode on your device by navigating to Settings > Security and Privacy > Development Mode and enabling the Use Development Mode toggle button.
  5. Start BlackBerry World on your device and swipe down from the top bezel 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.

    This Development Mode screen, where you can enter the ID of your application and download it right from your vendor account, will be visible only if your device is in Development Mode.

    Tapping the Settings icon at the upper right of the screen leads to a list of options that include Development Mode. The Development Mode screen provides a field where you can enter the Content ID or SKU of your app.

After you install your app, you can make purchases of in-app digital goods without being charged.

All purchases you make will appear on your device as actual purchases, just like the image on the right.

The Confirm Purchase dialog box provides details about the app, the purchase price and the purchase method. You can change the payment method, Cancel, or Purchase the app from this dialog box.

Here are some things to consider when you use the BlackBerry World vendor portal to test your in-app digital goods:

  • Make sure the connection mode in your app is set to Production so that your test purchases go through the BlackBerry World server.
  • Apps that are in draft can only be downloaded from BlackBerry World when you are using a sandbox user account (any other kind of user account won't work).
  • You can only retrieve past purchases 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 test purchasing an app only from a physical device, not from the BlackBerry 10 Device Simulator.
  • BlackBerry World has a cache, so there may be a delay before your new digital goods are accessible from BlackBerry World on your device.
  • You can use a sandbox user account to purchase your own apps and digital goods that are approved and for sale on the BlackBerry World storefront without being charged.
  • You don't need to remove an existing app from sale on the BlackBerry World storefront to add new digital goods in draft status, and test them 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.

Last modified: 2014-10-09

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus