The Payment Service is flexible, and enables you to implement a variety of subscription and renewal options in your apps. For example, you can offer auto-renewing subscriptions, free renewals for a specified period of time, or reduced-rate renewals.
First download and add the payment sdk jar file to your project click here.
- Setup a 'sandbox' account using the BlackBerry App World vendor portal
- Upload your app into BlackBerry App world but don't publish it, just save it and leave it in draft state
- Also in the vendor portal, set up your digital goods (the things available for in-app purchase)
- On your BlackBerry, load App World and login with your sandbox account email address.
- Within any screen in App World press ALT+TST and enter the SKU or ID of your test app.
- You can then download the test version of your app (which is not available to anyone else)
- Once the app is downloaded and installed you will be able to test your in app payments.
private PaymentEngine engine = PaymentEngine.getInstance();
PurchaseArgumentsBuilder arguments = new PurchaseArgumentsBuilder().withDigitalGoodSku( "sku-from the appworld").withDigitalGoodName( "name of the good").withMetadata( ""name of the good") .withPurchasingAppName( "Payment Service SDK Demo" );
try
{
Purchase purchase = engine.purchase(arguments.build());
Dialog.inform("Purchase of " + purchase.getMetadata()
+ " is successful.");
}
catch (IllegalArgumentException e)
{
Dialog.inform(e.getMessage());
}
catch (PaymentException e)
{
Dialog.inform(e.getMessage());
}
No comments:
Post a Comment