Skip to main content
Samsung Developer Program

Set Up Your Android App - App Server IAP Interface

Your Android app and app server can implement enhanced purchase verification, and can get the current status of purchased subscription items.

Enhanced Verification of In-App Item Purchases

IAP Helper enables in-app item purchase verification that involves only your Android app. IAP Helper and IAP Server enable enhanced purchase verification to reduce malicious purchases, which involves your Android app and app server.

During a successful in-app item purchase and payment transaction, Samsung IAP assigns a unique purchaseId . Your Android app receives the purchase ID and additional purchase and in-app item information in the PurchaseVo object of the onPaymentListener interface.

However in certain scenarios, your Android app may not receive the PurchaseVo object (for example, due to network issues) even though the purchase and payment transaction was successful. Your Android app can get the same fundamental purchase information by making a getOwnList() request to get theOwnedProductVo object of the OnGetOwnedListListener interface. 

SamsungIAP_v5_Architecture_ClientServerPurchaseVerification.png
 

We recommend that your Android app and app server perform enhanced server verification of in-app item purchases. Your app server or Android app can verify an in-app item purchase by using getPurchaseReceipt() response information and PurchaseVo or OwnedListVo object information.

Your Android app must provide the purchase ID to your app server using a method that is independent of Samsung IAP. If your app server is going perform the verification, then your Android app must provide the necessary information to your app server.

Your app server specifies the ID in a getPurchaseReceipt() request, which returns information about the in-app item and the purchase and payment transaction.

Your app server or Android app can verify the item purchase. 

Note: The diagram above is based on your Android app performing the verification.

Enhanced server verification can be based on the following and other data:

getPurchaseReceipt()
Response
Condition PurchaseVo and OwnedProductVo
Objects
status is 'true'  
paymentId
purchaseDate
paymentAmount
matches mPaymentId
mPurchaseDate
mItemPrice
 
mode is 'REAL'  

 

 

Get the Status of a Purchased Subscription Item

IAP Helper and IAP Server enable getting the current subscription status (active or expired) of a subscription item purchased by the user, which involves your Android app and app server.

SamsungIAP_v5_Architecture_SubscriptionStatus.png

 

Although the item ID is registered in Seller Office and is specified in startPayment() requests, it is also provided in the PurchaseVo object of the onPaymentListener interface in the OwnedListVo object of the onGetOwnedListListener interface.

Note: The subscription item must have been purchased prior to your app server making a getSubscriptionStatus() request.

Your Android app must provide the ID of the in-app item to your app server using a method that is independent of Samsung IAP. Your app server specifies the item ID in a getSubscriptionStatus() request, which returns information about the in-app item, including:

  • subscriptionStatus=ACTIVE when the item's subscription is current.
  • subscriptionStatus=CANCEL when the item's subscription has expired.

Your app server or Android app can take action based on the current status of the subscription. 

Note: The diagram above is based on your Android app using the status to take action.

For more details, see getSubsriptionStatus().

 

  • Was this article helpful?