A sample to help you develop your application
You can use the Purchase and Payment APIs to create purchase opportunities in your application. To see an implementation of the APIs that you can use in your application, open the Payment Service Sample Application. The sample application illustrates how to implement the following methods, which are necessary to receive payments in your application.
Using development mode
When you develop your application, you need to use the developmentMode property from the Payment API. This property is useful for testing your application without requiring network connections or currency. You can turn on the developmentMode property when you design and test your application so that it does not contact BlackBerry World's Payment Service server for any transactions. Instead, the API displays a simulated purchase screen, from which you can choose the result of the purchase. When you use the developmentMode property, to retrieve existing purchases, only simulated and successful purchases are returned.
Of course you should turn off the developmentMode property in production code (or you will not get paid).
Adds to the description of your digital goods.
Routes a message (msg) to the console.log().
Defines the information that your application displays on its About page.
Indicates the state of developmentMode for your application.
Retrieves a list of digital goods that are available for purchase within your application.
Displays the purchased state of each of the digital goods in your application's inventory.
Increments the total number of purchases for a given goodId in your inventory. Note that this method is specific to this sample's implementation.
Launches the BlackBerry Browser for external-target links.
Initiates the purchase of a digital good.
Sets up the application environment when your application is launched.
Retrieves the error information when the application unsuccessfully invokes a call to blackberry.payment.purchase().
Receives the related error code if an error occurs while making a purchase.
Receives an array of purchases (in the data parameter), after the application successfully invokes a call to blackberry.payment.getExistingPurchase().
After a successful call is made to blackberry.payment.purchase(), invoke this method to increment your application's inventory with the submitted payment (data).
Retrieves information about the user's past purchases with this application. The getFromLiveServer parameter is returned true if the BlackBerry device can refresh the list of purchases from BlackBerry World's Payment Service server. If it is returned false, then the current list of cached purchases should be returned immediately. Since your app will already know whether a purchase is successful, this should be used when your app first launches, to confirm that the current list of cached purchases is valid.
Adds msg to the page (targets an element with the value of the parameter id).
Toggles the developmentMode property from its current state to its complement. That is, from on to off, or off to on.