Android Receipt Validation
Validates receipt information for Android in-app purchases.
Call Information
// Unity IAP를 사용하는 경우
IAP.Android(string receipt, PlayNANOODelegate callback) {}
IAP.Android(string receipt, bool duplicateAllow, PlayNANOODelegate callback) {}
// Unity IAP를 사용하지 않는 경우
IAP.Android(string receipt, string skuDetails, string signature, PlayNANOODelegate callback) {}
IAP.Android(string receipt, string skuDetails, string signature, bool duplicateAllow, PlayNANOODelegate callback) {}
Call Details
| Parameter | Description | Type |
|---|---|---|
| receipt | Table code | string |
| skuDetails | Android product information | string |
| signature | Android Signature | string |
| duplicateAllow | Allow duplicate receipt validation | boolean |
| callback | Communication result | PlayNANOODelegate |
Source Code
using PlayNANOO;
public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
void Awake()
{
plugin = Plugin.GetInstance();
}
// Unity IAP를 사용하는 경우
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
{
plugin.IAP.Android(args.purchasedProduct.receipt, (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"]);
Debug.Log(values["PurchaseState"]);
}
else
{
Debug.Log("Fail");
}
});
}
// Unity IAP를 사용하지 않는 경우
public void AndroidValidate()
{
string receipt = "string";
string skuDetails = "string";
string signature = "string";
plugin.IAP.Android(receipt, skuDetails, signature, (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"]);
Debug.Log(values["PurchaseState"]);
}
else
{
Debug.Log("Fail");
}
});
}
}
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"UserID" : "String",
"PackageName" : "String",
"OrderID" : "String",
"ProductID" : "String",
"Currency" : "String",
"Quantity" : "Integer",
"Price" : "String",
"PurchaseState" : "String"
}
Response Details
| Data Key | Description | Type |
|---|---|---|
| UserID | User identifier ID | String |
| PackageName | App package name | String |
| ProductID | Payment product ID | String |
| OrderID | Order ID | String |
| Currency | Payment currency code | String |
| Quantity | Purchase quantity | integer |
| Price | Product price | integer |
| PurchaseState | Validation resultpurchase : Successful purchasewait : Processing in progresscancel : Validation failed | String |
Handling wait status
If the status is wait, please send a re-validation request.
Error Information
When receipt validation fails ErrorCode : 20000 ErrorMessage : ValidationFailException
When the application package name does not match ErrorCode : 20002 ErrorMessage : NotMatchPackageNameException
When the receipt has already been used ErrorCode : 20005 ErrorMessage : ExistsReceiptException