Programming Guide Sep 8, 2016

Introduction

Samsung In-App Purchase (IAP) allows third party applications to use the Samsung payment service to offer items for sale inside your app. IAP provides the service as an Android package to ensure independence between applications. IAP communicates with third party applications by means of the Android Interface Definition Language (AIDL).

This method has numerous advantages, but requires specialized skills in Android to manage various processes, including linking the IAP service, linking Samsung accounts, and running the IAP package validity test.

In order to link more conveniently with IAP, a separate Helper class is provided. The third party application simply calls the method of the SamsungIapHelper class and processes the final result. The actual source code for a purchase request in IAP is as follows.

public class PurchaseActivity extends Activity implements OnPaymentListener
{
    private SamsungIapHelper    mIapHelper  = null;
    
    ...
    
    protected void onCreate( Bundle savedInstanceState )
    {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
        
        mIapHelper = SamsungIapHelper.getInstance( this, MODE );
    }
    
    public void doPurchase( View _view )
    {
        mIapHelper.startPayment(ITEM_ID, true, this );
    }
    
    @Override
    public void onPayment( ErrorVo _errorVo, PurchaseVo _purchaseVo )
    {
        // Success or failure of payment is processed here.
    }
...
}
Note

In order to link to In-App Purchase, the com.sec.android.app.billing.permission privilege is required in IAP Version 4. Modified privilege to AndroidManifest.xml as follows:

<uses-permission android:name="com.sec.android.app.billing.permission.BILLING"/>
<uses-permission android:name="android.permission.INTERNET"/>

See the attached pdf file for more information.