iOS Receipt Validation
Validates receipt information for iOS in-app purchases.
Call Information
IAP.IOS(string receipt, string productId, string currency, double price, PlayNANOODelegate callback) {}
IAP.IOS(string receipt, string productId, string currency, double price, bool duplicateAllow, PlayNANOODelegate callback) {}
Call Information Details
Parameter | Description | Type |
---|---|---|
receipt | Receipt information | string |
productId | Product ID | string |
currency | Currency code (KRW, JPY, USD, CNY, etc.). | string |
price | Item price | double |
duplicateAllow | Allow duplicate receipt validation | boolean |
callback | Communication result | PlayNANOODelegate |
Example
If using Unity IAP Service
using PlayNANOO;
public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
void Awake()
{
plugin = Plugin.GetInstance();
}
// Unity IAP Service
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
{
plugin.IAP.IOS(args.purchasedProduct.receipt, "PRODUCT_ID", "CURRENCY", 100, (status, errorMessage, jsonString, values) => {
if (status.Equals(Configure.PN_API_STATE_SUCCESS))
{
Debug.Log(values["UserID"]);
Debug.Log(values["PackageName"]);
Debug.Log(values["OrderID"]);
Debug.Log(values["ProductID"]);
Debug.Log(values["Currency"]);
Debug.Log(values["Quantity"]);
Debug.Log(values["Price"]);
}
else
{
Debug.Log("Fail");
}
});
}
}
If not using Unity IAP Service
using PlayNANOO;
public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
void Awake()
{
plugin = Plugin.GetInstance();
plugin.IAP.IOS("RECEIPT", "PRODUCT_ID", "CURRENCY", 100, (status, errorMessage, jsonString, values) => {
if (status.Equals(Configure.PN_API_STATE_SUCCESS))
{
Debug.Log(values["UserID"]);
Debug.Log(values["PackageName"]);
Debug.Log(values["OrderID"]);
Debug.Log(values["ProductID"]);
Debug.Log(values["Currency"]);
Debug.Log(values["Quantity"]);
Debug.Log(values["Price"]);
}
else
{
Debug.Log("Fail");
}
});
}
}
Communication Result
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"UserID" : "String",
"PackageName" : "String",
"OrderID" : "String",
"ProductID" : "String",
"Currency" : "String",
"Price" : "String"
}
Communication Result
Data Key | Description | Type |
---|---|---|
UserID | User ID | string |
PackageName | App package name | string |
ProductID | Product ID | string |
OrderID | Order ID | string |
Currency | Payment Currency Code | string |
Quantity | Purchase quantity | integer |
Price | Item price | integer |
Error Information
Receipt validation failed
ErrorCode : 20000
ErrorMessage : ValidationFailException
App package name does not match
ErrorCode : 20002
ErrorMessage : NotMatchPackageNameException
Receipt has already been used
ErrorCode : 20005
ErrorMessage : ExistsReceiptException