Skip to main content
Samsung Developer Program

Server-to-Server Purchase Verification

After a user makes a purchase, developers can use the purchase token to visit a URL to determine whether that purchase was successfully processed by Samsung Billing.

Purchase verification is typically performed by the service app server; the following diagram illustrates this behavior. However, purchase verification can be performed directly on the service app.

OpenIAB_Integration_Interdependencies_ServerToServerVerificationDiagram.png

To perform 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 in the following example.

Shop.cs
private void OnPurchaseSucceeded (Purchase purchase) {

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

Purchase finished logsAfter a purchase, get the token included in the purchase finished logs. This option 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}

   

  1. Use the following format to append the purchaseID to the URL: 
&purchaseID=<token>
  1. The following example uses the format specified above:
https://iap.samsungapps.com/iap/appsItemVerifyIAPReceipt.as?protocolVersion=2.0&purchaseID=9954cec99a965fef6490b3fec3baf9ba7d98335a6d5blc663774c6503d442ee7
  1. Verify the URL. The link will provide verification results 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 result value descriptions, see the Samsung In-App Purchase section.

  • Was this article helpful?