Skip to main content

Ready to market your stellar app?

Samsung Developer Program is your gateway to app monetization success.

Learn More

Samsung Developer Program

Server-to-Server Purchase Verification

OpenIAB_Integration_Interdependencies_ServerToServerVerificationDiagram.png

After a user makes a purchase, the developers can determine whether or not the purchase was successfully processed by Samsung Billing, using the purchase token to visit a URL. Purchase verification is typically performed by the service app server (which is explained below). However, purchase verification can be performed directly on the service app.

 

Performing Server-to-Server Purchase Verification
  1. Use the verify URL:
https://iap.samsungapps.com/iap/appsItermVerifyIAPReceipt.as?protocolVersion=2.0

 

 

  1. Get the purchaseID. You can get the purchaseID from:

onPurchaseSucceeded callback (Unity Level): This is a Unity level approach. In the Shop.cs file, get the token attribute from the object Purchase purchase by using purchase.Token as shown below.

Shop.cs
private void OnPurchaseSucceeded (Purchase purchase) {

    ...
    String purchaseID = purchase.Token;
    ...
}

 

Purchase finished logs: After a purchase, get the token included in the purchase finished logs. This can be enabled and disabled in the source code using enableDebugLogging(). See the Open IAB Unity Plugin API Reference for details. For example: 

D        24718    OpenIAB-UnityPlugin  Purchase finished: IabResult: 0, 0:OK, purchase: PurchaseInfo(type:inapp): 
{"orderId":TPMTID20151104PHI2037906, "packageName":com.samsung.bostoniab, "productId":sku_plane_fuel, "purchaseTime": 
1446604114390, "purchaseState":0, "developerPayload":, "token":9954cec99a965fef6490b3fec3baf9ba7d98335a6d5blc663774c6503d442e77}

For production apps, it is recommended to disable debug logging.

 

 

  1. Append the purchaseID to the URL following the format below: 
&purchaseID=<token>

 

 

  1. The following is an example that uses the forma specified above:
https://iap.samsungapps.com/iap/appsItemVerifyIAPReceipt.as?protocolVersion=2.0&purchaseID=9954cec99a965fef6490b3fec3baf9ba7d98335a6d5blc663774c6503d442ee7

 

 

  1. Verify URL. The link will provide the results of the verification in JSON format. 

If the purchase is valid:

{
"itemId" : "57515",
"paymentId" :  "ZPMTID20131122GBI0015292",
"itemName" : "Test Pack",
"itemDesc" : "IAP Test Item. Best value!",
"purchaseDate" : "2013-11-22 04:22:36",
"paymentAmount" : "9.000",
"status" : "true",
"paymentMethod" : "CreditCard",
"mode" : "REAL",
}

 

If the purchase is invalid: 

{"status" : "false"} 

 

 

For more details about the description of result values, see the Samsung IAP Programming Guide

  • Was this article helpful?