iOS 영수증 검증
iOS 인앱결제에 따른 영수증 정보를 검증한다.
호출 정보
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) {}
호출 상세 정보
파라미터 | 설명 | 타입 |
---|---|---|
receipt | 영수증 정보 | string |
productId | 결제 상품 아이디 | string |
currency | 화폐 코드 (KRW, JPY, USD, CNY...). | string |
price | 결제 금액 | double |
duplicateAllow | 영수증 중복 검증 허용 여부 | boolean |
callback | 통신 결과 | PlayNANOODelegate |
예제
유니티 IAP 서비스를 사용하는 경우
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");
}
});
}
}
유니티 IAP 서비스를 사용하지 않는 경우
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");
}
});
}
}
통신 결과
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"UserID" : "String",
"PackageName" : "String",
"OrderID" : "String",
"ProductID" : "String",
"Currency" : "String",
"Price" : "String"
}
통신 결과 상세 정보
데이터키 | 설명 | 타입 |
---|---|---|
UserID | 사용자 식별 아이디 | string |
PackageName | 앱 패키지명 | string |
ProductID | 결제 상품 아이디 | string |
OrderID | 주문 아이디 | string |
Currency | 결제 화폐 코드 | string |
Quantity | 구매 수량 | integer |
Price | 결제 상품 금액 | integer |
에러 정보
영수증 검증에 실패한 경우
ErrorCode : 20000
ErrorMessage : ValidationFailException
어플리케이션 패키지명이 일치하지 않는 경우
ErrorCode : 20002
ErrorMessage : NotMatchPackageNameException
이미 사용된 영수증인 경우
ErrorCode : 20005
ErrorMessage : ExistsReceiptException