Game Development Reference
In-Depth Information
Adding in-app purchasing for iOS devices
As with Game Center, the in-app purchase SDK supplied by Apple is written in
Objective-C, so we can't use it directly in a Marmalade project.
Again Marmalade solves this problem by wrapping up the Apple libraries into an
API called s3eIOSAppStoreBilling.
This API allows us to obtain a list of in-app products that are available for purchase
and their costs. We can then make a request to purchase a particular product and
will be notified of success or failure when Apple's servers have taken care of all the
behind-the-scenes stuff that needs to be done in order to process the payment.
Just like the original Apple implementation, there is no support for allowing a user
to automatically download extra data when a purchase has been made. Instead we
have to implement this ourselves on receipt of the purchase confirmation, which
would involve either shipping all the "unlockable" data with the original application
download or downloading it from our own server.
For more information on this API, take a look in the Marmalade documentation
by going to Marmalade API Reference | S3E API Documentation | S3E: iOS
Only | S3E iOS App Store Billing , and the example code that can be found in the
Marmalade installation at examples\s3e\s3eIOSAppStoreBilling .
Adding in-app purchasing for Android devices
Marmalade also provides a wrapper API for implementing in-app purchases on
Android called s3eAndroidMarketBilling. The naming of this API is still based on the
original name of the Android store (Android Marketplace), but it works fine with the
renamed Google Play system.
Sadly Marmalade hasn't been able to provide a single API that can target multiple
platforms, simply because the iOS and Android systems work so differently. A good
example of this is that the Google Play system does not allow us to query the list of
available products for an application. This is a really strange omission on Google's
part (especially given that you do have to set up a product list on the Google Play
servers anyway) and it means we either have to hardcode our product identifiers
into our application or provide our own server to mirror this information.
Information on this API can be found in the documentation by going to
Marmalade API Reference | S3E API Documentation | S3E: Android Only |
S3E Android Market Billing , and there is some sample code at examples\s3e\
s3eAndroidMarketBilling .
 
Search WWH ::




Custom Search