<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BlackBerry Developer Blog &#187; digital goods</title>
	<atom:link href="http://devblog.blackberry.com/tag/digital-goods/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.blackberry.com</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jun 2013 18:00:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='devblog.blackberry.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/9ef0a66c09615fa946c4179662398878?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>BlackBerry Developer Blog &#187; digital goods</title>
		<link>http://devblog.blackberry.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://devblog.blackberry.com/osd.xml" title="BlackBerry Developer Blog" />
	<atom:link rel='hub' href='http://devblog.blackberry.com/?pushpress=hub'/>
		<item>
		<title>BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 14: In App Payment</title>
		<link>http://devblog.blackberry.com/2013/06/porting-app-payment/</link>
		<comments>http://devblog.blackberry.com/2013/06/porting-app-payment/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 09:55:58 +0000</pubDate>
		<dc:creator>garett</dc:creator>
				<category><![CDATA[Cascades]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Platform Services]]></category>
		<category><![CDATA[digital goods]]></category>
		<category><![CDATA[payment]]></category>
		<category><![CDATA[porting]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=15222</guid>
		<description><![CDATA[Do you have an application built using BlackBerry Java that makes use of the Payment Service APIs? You’ll be happy to know that Cascades support the exact same digital goods types meaning you can provide the same monetization model in BlackBerry 10; you can even use the same digital goods already in your vendor portal. [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=15222&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://rimdevblog.files.wordpress.com/2013/06/588db54f-6b93-4ff0-8f08-0efa73e9bb26.jpg"><img class="aligncenter size-full wp-image-15226" alt="TITLE_IMAGE" src="http://rimdevblog.files.wordpress.com/2013/06/588db54f-6b93-4ff0-8f08-0efa73e9bb26.jpg?w=600&#038;h=400" width="600" height="400" /></a></p>
<p>Do you have an application built using BlackBerry Java that makes use of the Payment Service APIs? You’ll be happy to know that Cascades support the exact same digital goods types meaning you can provide the same monetization model in BlackBerry 10; you can even use the same digital goods already in your vendor portal. This means less time planning how to monetize your app and less time creating and managing digital goods giving you more time and freedom to develop the rest of the app or letting you finish a few days earlier.</p>
<p><span id="more-15222"></span></p>
<h1>BlackBerry World Client</h1>
<p>In BlackBerry OS 7 and lower the Payment Service was included as a separate library which was heavily dependent on the version of BlackBerry World that was installed on the device. This meant that your application would need to query what version of BlackBerry World was installed and, if not at the version required by the library, prompt the user to upgrade the client to a newer version.</p>
<p>In BlackBerry 10 the Payment Service libraries are integrated directly into the OS and the tight coupling with the BlackBerry World client has been removed; meaning you only need to worry about developing.</p>
<h1>Vendor Portal</h1>
<p>As mentioned above the same digital goods used for BlackBerry OS 7 app releases can be used against any device/OS including BlackBerry 10. To make use of the existing digital goods you simply need to create a new BlackBerry 10 release that references the SKUs of the existing goods. If you are creating a new app altogether then you only need to create the digital goods in the same manner done for your Java apps:</p>
<p><a href="http://docs.blackberry.com/en/developers/deliverables/47831/1278466.jsp"><br />
http://docs.blackberry.com/en/developers/deliverables/47831/1278466.jsp<br />
</a></p>
<p>If your BlackBerry Java application has a good user base then I would recommend the above approach, it will allow existing users to download your new BlackBerry 10 version as soon as they upgrade, being visible right in the “My World” section of their BlackBerry World client app when they start up their new BlackBerry 10 device. You will, however, want to upload separate metadata for each platform you are targeting (screenshots, descriptions, keywords etc):</p>
<p><a href="http://devblog.blackberry.com/2012/11/blackberry-app-world-success/"><br />
http://devblog.blackberry.com/2012/11/blackberry-app-world-success/<br />
</a></p>
<h2>Environment Setup:</h2>
<p>Both BlackBerry OS 7 and 10 require an additional library to be added to the project, the difference is that in BlackBerry 7 you need to download and add the library (JAR) to your project, whereas in BlackBerry 10 you only need to reference the library that is integrated with the SDK and OS meaning less work for you and a library that stays updated as you change SDK versions.</p>
<h3><strong>Java:</strong></h3>
<p>Add the JAR to your project</p>
<p><a href="http://docs.blackberry.com/en/developers/deliverables/40131/Add_Payment_Service_library_to_build_path_1316204_11.jsp"><br />
http://docs.blackberry.com/en/developers/deliverables/40131/Add_Payment_Service_library_to_build_path_1316204_11.jsp<br />
</a></p>
<h3><strong>Cascades:</strong></h3>
<p>Add the LIB reference to your .PRO file</p>
<p><a href="https://developer.blackberry.com/cascades/documentation/device_platform/paymentservice/selling.html#pat1339516868668"><br />
https://developer.blackberry.com/cascades/documentation/device_platform/paymentservice/selling.html#pat1339516868668<br />
</a></p>
<h2>Initializing the Payment Engine/Manager:</h2>
<p>The “brains” of the payment service, where all calls are initiated, stems from one object which needs to be instantiated before any further calls can be made. Below are code snippets that show how this instantiation occurs in BlackBerry OS 7 in Java followed by BlackBerry OS 10 using Cascades APIs:</p>
<h3><strong>Java:</strong></h3>
<p>A prerequisite to using the payment service is to verify that the version of BlackBerry World client on the device is at a sufficient level and, if not, prompting for the update to be installed prior to making any payment calls.</p>
<pre>try {
 PaymentEngine.isAppWorldInstalledAndAtCorrectVersion();
} catch (AppWorldUpdateRequired e) {
 PaymentEngine.upDateAppWorld();
 System.exit(0);
}
PaymentEngine engine = PaymentEngine.getInstance();</pre>
<h3><strong>Cascades:</strong></h3>
<p>The payment service in Cascades requires information on which window group the app is using so the payment prompts can be properly drawn overtop.</p>
<pre>bb::platform::PaymentManager *m_paymentManager = new PaymentManager();
 bb::cascades::Application::instance()-&gt;mainWindow()-&gt;groupId();
m_paymentManager-&gt;setWindowGroupId(windowGroupId);</pre>
<p>The PaymentManager lets you define properties that will be displayed to the user in all purchase requests, specifically the application name and the URL of a custom icon if desired.<b></b></p>
<pre>m_paymentManager-&gt;setApplicationName("The Awesome Store");
m_paymentManager-&gt;setApplicationIconUrl(QUrl("http:///mycompany.com/100x100.png"));</pre>
<h3><strong>Test Mode:</strong></h3>
<p>Not available in BBOS</p>
<h3><strong>Cascades:</strong></h3>
<pre>PaymentManager::setConnectionMode(PaymentConnectionMode::Test);</pre>
<h1>Initiating a Purchase</h1>
<h3><strong>Java:</strong></h3>
<pre>PurchaseArgumentsBuilder arguments = new PurchaseArgumentsBuilder()
     .withDigitalGoodId( "1234" )
     .withDigitalGoodName( "My Product" )
     .withDigitalGoodSku( "Ab34t2eC" )
     .withPurchasingAppIcon( bitmapIconImageVariable ); 
     .withPurchasingAppName( "My Application" ); 
     .withMetadada( "Extra info for consumable goods" );
 try 
 {
     PurchaseResult result = engine.purchase(arguments.build());
 }
 …</pre>
<h3><strong>Cascades:</strong></h3>
<pre>const PurchaseReply *reply = m_paymentManager-&gt;requestPurchase("1234", "Ab34t2eC", "My Product", "Extra info for consumable goods");
connect(reply, SIGNAL(finished()), SLOT(handlePurchase()));</pre>
<h1>Restoring Past Purchases</h1>
<h3><strong>Java:</strong></h3>
<pre>try
 {
     ExistingPurchasesResult result = engine.getExistingPurchases(false/true);
     Purchase[] resultPurchases = result.getPurchases();
 }
 catch (PaymentException e)
 { 
 }</pre>
<h3><strong>Cascades:</strong></h3>
<pre>const ExistingPurchasesReply *reply = paymentManager-&gt;requestExistingPurchases(false/true);
connect(reply, SIGNAL(finished()), SLOT(handleExistingPurchases()));</pre>
<p>If you happen to be new to C++ and would still like to monetize your Cascades application then you will be happy to know that our Payment Services developers have created a nice sample which takes the bulk of the payment calls needed and exposes then through to QML, allowing you to make payment calls without writing a single line of C++ yourself, just copy the important parts from the sample into your own application. This sample can be gitted from here:</p>
<p><a href="https://github.com/blackberry/Cascades-Samples/tree/master/paymentservice"><br />
https://github.com/blackberry/Cascades-Samples/tree/master/paymentservice<br />
</a></p>
<p>Of course there are a few more calls available through the Payment Service in both Java and Cascades, but the above set provides a solid baseline for the main functions developers using the Payment Service should be aware of. If there is anything else you would like to know about the Payment Service, or have trouble porting the pieces from Java to Cascades, there are a few great options for support:</p>
<p>1)      Support forums: <a href="http://supportforums.blackberry.com/t5/Payment-Service/bd-p/pay_serv"><br />
http://supportforums.blackberry.com/t5/Payment-Service/bd-p/pay_serv<br />
</a></p>
<p>2)      BlackBerry Developer Twitter account: <a href="https://twitter.com/BlackBerryDev">@BlackBerryDev</a></p>
<p>3)      Garett B (Developer Relations Payment Service Expert): <a href="https://twitter.com/garettBeuk">@garettBeuk</a></p>
<p>Happy porting!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/15222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/15222/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=15222&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2013/06/porting-app-payment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75e7e69af37da351a3462a17576c2209?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gbeuk</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2013/06/588db54f-6b93-4ff0-8f08-0efa73e9bb26.jpg" medium="image">
			<media:title type="html">TITLE_IMAGE</media:title>
		</media:content>
	</item>
		<item>
		<title>Selling Android Digital Goods</title>
		<link>http://devblog.blackberry.com/2012/06/selling-android-digital-goods/</link>
		<comments>http://devblog.blackberry.com/2012/06/selling-android-digital-goods/#comments</comments>
		<pubDate>Mon, 18 Jun 2012 15:00:23 +0000</pubDate>
		<dc:creator>garett</dc:creator>
				<category><![CDATA[Android Development]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Android In-App Billing API]]></category>
		<category><![CDATA[BlackBerry Runtime for Android Applications]]></category>
		<category><![CDATA[developer beta]]></category>
		<category><![CDATA[digital goods]]></category>
		<category><![CDATA[marketplace]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=9756</guid>
		<description><![CDATA[BlackBerry® Runtime for Android Applications now supports the Android In-App Billing APIs in the recently-released 2.1.0 developer beta build.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=9756&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p style="text-align:center;"><a href="http://rimdevblog.files.wordpress.com/2012/06/5min.jpg"><img class="aligncenter  wp-image-9885" title="5min" src="http://rimdevblog.files.wordpress.com/2012/06/5min.jpg?w=576&#038;h=323" alt="TITLE_IMAGE" width="576" height="323" /></a></p>
<p>Many developers have already had great success with porting their Android™ applications to the <a href="http://www.blackberry.com/playbook" target="_new">BlackBerry® PlayBook™</a> tablet platform. This provides a great distribution channel for your applications and opens them up to a whole new audience.</p>
<p>“That’s all great”, you might say, “but how do I sell digital goods from within my application to increase my revenue stream?” I am happy to let you know that the BlackBerry® Runtime for Android Applications now supports the Android In-App Billing APIs in the recently-released 2.1.0 <a href="http://devblog.blackberry.com/2012/05/blackberry-playbook-2-1-0-beta/" target="_new">developer beta build</a>!</p>
<p><span id="more-9756"></span></p>
<p>How does it all work? Let’s start with the basics: the APIs used to make purchases in an Android application have been modified to integrate with the <a href="http://appworld.blackberry.com/" target="_new">BlackBerry App World™</a> storefront. As a developer, you can add Digital Goods in the BlackBerry App World ISV Portal and then offer them for sale in your application. The really good news? The system works with the existing BlackBerry Payment Service, meaning that you can use the same Digital Goods SKUs as used previously for Item ID in the Android payment system. The rest of the Android In-App Billing APIs will continue to function as expected, which means minimal client-side code changes. All purchases made from your Android application will appear to the end user with the exact same flow as it would in a native BlackBerry PlayBook tablet application, validated and charged via BlackBerry App World.</p>
<p>There are a few things to keep in mind when adding this functionality to your ported Android application:</p>
<ol>
<li>In order to test your in-app purchases, you will need to follow the steps outlined <a href="http://supportforums.blackberry.com/t5/BlackBerry-App-World-Development/How-To-Live-Testing-the-Payment-SDK-with-PlayBook-Applications/ta-p/1749859" target="_new">here</a></li>
<li>Only one purchase may be made at a time; concurrent transactions are not currently supported</li>
<li>Refunds are not supported from the APIs</li>
<li>Transaction responses are not signed, so they cannot be checked (see below for more information)</li>
</ol>
<h3><strong>Transaction Responses Are Not Signed</strong></h3>
<p>If your application attempts to verify the transaction response signature, then it will need a slight code tweak to disregard this value if testing on a BlackBerry PlayBook tablet or BlackBerry® 10 device. The easiest way to tell if your application is running on a BlackBerry device is to use the following code:</p>
<pre>java.lang.System.getProperty("os.name") == “qnx”</pre>
<p>If the above check is true then you should skip the transaction signature verification.</p>
<h3><strong>Terminology Dictionary</strong></h3>
<p>There are a few differences to how things will be referred to when switching to the BlackBerry App World Payment system. Below is a list of some of the most common changes:</p>
<table cellpadding="5">
<tbody>
<tr>
<td width="40%"><strong>Android</strong></td>
<td width="60%"><strong>BlackBerry</strong></td>
</tr>
<tr>
<td>ItemId</td>
<td>digitalSKU</td>
</tr>
<tr>
<td>“Managed” transactions</td>
<td>
<ul>
<li>Equivalent to what are called “Not Consumable” transactions on the BlackBerry platform</li>
<li>Can be bought only once</li>
<li>BlackBerry App World keeps track of the purchases and they will be preserved through device switches</li>
</ul>
</td>
</tr>
<tr>
<td>“Unmanaged” transactions</td>
<td>
<ul>
<li>Equivalent to what are called “Consumable” transactions on the BlackBerry platform</li>
<li>Unlike the Android Market, BlackBerry App World will keep track of purchased consumable items</li>
</ul>
</td>
</tr>
<tr>
<td>Optional “developer payload”</td>
<td>“metadata”</td>
</tr>
</tbody>
</table>
<p>That covers the basics. If you have any questions, comments or success stories, please send them our way &#8212; we’d love to hear what you have to say!</p>
<p><strong>Forums:</strong><br />
<a href="http://supportforums.blackberry.com/t5/Android-Runtime-Development/bd-p/adt" target="_new">Android Runtime Development Forum</a><br />
<a href="http://supportforums.blackberry.com/t5/BlackBerry-App-World-Development/bd-p/appworld_dev" target="_new">BlackBerry App World Development Forum</a></p>
<p><strong>Twitter®:</strong> <a href="http://twitter.com/BlackBerryDev" target="_new">@BlackBerryDev</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/9756/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/9756/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=9756&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/06/selling-android-digital-goods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75e7e69af37da351a3462a17576c2209?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gbeuk</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/06/5min.jpg" medium="image">
			<media:title type="html">5min</media:title>
		</media:content>
	</item>
	</channel>
</rss>
