際際滷

際際滷Share a Scribd company logo
Samsung IAP

Manikantan K
Manikantan.k@samsung.com
@manikantan_k
Introduction
 In-App Purchase enables you to sell various items from
inside your applications.
 In-App Purchase is only available for Android-based
applications for Samsung Apps.
 Currently, it supports more than 60 countries with Credit
card, P-SMS, and several local payment methods.
IAP v2
New version of library was released recently. Supports
 Consumable/non-consumable/subscription
 Account based purchase management (not IMEI based)
 Supports Samsung Single Sign On.
 Increased geographic coverage US via Credit card.
 Uses AIDL (Android Interface Definition Language) for a
more seamless user experience
Consumable Vs Non consumables
CONSUMABLES
One off purchase and cannot be restored.
Eg : Medikit, life points or coins in games.
NON CONSUMABLES
Restorable and are account based.
Eg : Unlock stages in a game, premium upgrade
Subscriptions
Subscriptions are convenient for recurring periodic
purchases.
Eg : Magazines or TV shows or newspapers
A simple purchase flow Hotel Story
A simple purchase flow Hotel Story
Samsung IAP SDK
Step 1 IAP install check
 Check IAP installation
Intent serviceIntent = new Intent(
"com.sec.android.iap.service.iapService" );
Boolean flag = getPackageManager().queryIntentServices(
serviceIntent, 0 ).isEmpty()
Step 2 Samsung Account check
 Check Samsung Account on the phone
ComponentName com = new ComponentName(
"com.sec.android.iap",
"com.sec.android.iap.activity.AccountActivity" );
Intent intent = new Intent(); intent.setComponent( com );
startActivityForResult(intent, 1001);
Step 3 Bind with IAPConnector
Intent serviceIntent = new Intent(
"com.sec.android.iap.service.iapService" );
bindService( serviceIntent, mServiceConn,
Context.BIND_AUTO_CREATE );
Step 4 Setup IAPConnector
Init() must be first called before any IAP operation.
Init() setups basic account payment information
Call it on separate thread to avoid ANR.

Bundle result = mIAPConnector.init( mMode );
Step 5 Functions on IAPConnector
Call it on separate thread to avoid ANR.
Result is a Bundle along with a STATUS_CODE

Bundle itemList = mIAPConnector.getItemList( developerMode,
getPackageName(), _itemGroupId, _startIndexInList,
_endIndexInList,
_itemType );
Step 6 Purchase
Bundle bundle = new Bundle();
bundle.putString( "THIRD_PARTY_NAME", getPackageName() );
bundle.putString( "ITEM_GROUP_ID", _itemGroupId );
bundle.putString( "ITEM_ID", _itemId );

ComponentName com = new ComponentName( "com.sec.android.iap",
"com.sec.android.iap.activity.PaymentMethodListActivity" );
Intent intent = new Intent( Intent.ACTION_MAIN );
intent.addCategory( Intent.CATEGORY_LAUNCHER );
intent.setComponent( com );
intent.putExtras( bundle );
startActivityForResult( intent, 1000 );
Step 6 Purchase
Do Purchase in separate thread, to avoid ANR.
Returned result from purchase.
STATUS_CODE AND ERROR_STRING describe the outcome of
purchase.
RESULT_OBJECT is a big JSON, which includes info such as
purchaseID, purchase Date, price, item image etc.
Step 7 Unbind IAPConnector
Unbind IAPConnector and Service Connection Object.
This after all IAP operations are completed and to release the
associated resources

unbindService( mServiceConn );
Resources
http://developer.samsung.com/android/tools-sdks/In-App-Purchase-Library
Includes sample code, technical documentation and FAQ.

Manikantan K
Manikantan.k@samsung.com
@manikantan_k

More Related Content

Samsung IAP SDK

  • 2. Introduction In-App Purchase enables you to sell various items from inside your applications. In-App Purchase is only available for Android-based applications for Samsung Apps. Currently, it supports more than 60 countries with Credit card, P-SMS, and several local payment methods.
  • 3. IAP v2 New version of library was released recently. Supports Consumable/non-consumable/subscription Account based purchase management (not IMEI based) Supports Samsung Single Sign On. Increased geographic coverage US via Credit card. Uses AIDL (Android Interface Definition Language) for a more seamless user experience
  • 4. Consumable Vs Non consumables CONSUMABLES One off purchase and cannot be restored. Eg : Medikit, life points or coins in games. NON CONSUMABLES Restorable and are account based. Eg : Unlock stages in a game, premium upgrade
  • 5. Subscriptions Subscriptions are convenient for recurring periodic purchases. Eg : Magazines or TV shows or newspapers
  • 6. A simple purchase flow Hotel Story
  • 7. A simple purchase flow Hotel Story
  • 9. Step 1 IAP install check Check IAP installation Intent serviceIntent = new Intent( "com.sec.android.iap.service.iapService" ); Boolean flag = getPackageManager().queryIntentServices( serviceIntent, 0 ).isEmpty()
  • 10. Step 2 Samsung Account check Check Samsung Account on the phone ComponentName com = new ComponentName( "com.sec.android.iap", "com.sec.android.iap.activity.AccountActivity" ); Intent intent = new Intent(); intent.setComponent( com ); startActivityForResult(intent, 1001);
  • 11. Step 3 Bind with IAPConnector Intent serviceIntent = new Intent( "com.sec.android.iap.service.iapService" ); bindService( serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE );
  • 12. Step 4 Setup IAPConnector Init() must be first called before any IAP operation. Init() setups basic account payment information Call it on separate thread to avoid ANR. Bundle result = mIAPConnector.init( mMode );
  • 13. Step 5 Functions on IAPConnector Call it on separate thread to avoid ANR. Result is a Bundle along with a STATUS_CODE Bundle itemList = mIAPConnector.getItemList( developerMode, getPackageName(), _itemGroupId, _startIndexInList, _endIndexInList, _itemType );
  • 14. Step 6 Purchase Bundle bundle = new Bundle(); bundle.putString( "THIRD_PARTY_NAME", getPackageName() ); bundle.putString( "ITEM_GROUP_ID", _itemGroupId ); bundle.putString( "ITEM_ID", _itemId ); ComponentName com = new ComponentName( "com.sec.android.iap", "com.sec.android.iap.activity.PaymentMethodListActivity" ); Intent intent = new Intent( Intent.ACTION_MAIN ); intent.addCategory( Intent.CATEGORY_LAUNCHER ); intent.setComponent( com ); intent.putExtras( bundle ); startActivityForResult( intent, 1000 );
  • 15. Step 6 Purchase Do Purchase in separate thread, to avoid ANR. Returned result from purchase. STATUS_CODE AND ERROR_STRING describe the outcome of purchase. RESULT_OBJECT is a big JSON, which includes info such as purchaseID, purchase Date, price, item image etc.
  • 16. Step 7 Unbind IAPConnector Unbind IAPConnector and Service Connection Object. This after all IAP operations are completed and to release the associated resources unbindService( mServiceConn );
  • 17. Resources http://developer.samsung.com/android/tools-sdks/In-App-Purchase-Library Includes sample code, technical documentation and FAQ. Manikantan K Manikantan.k@samsung.com @manikantan_k