iOS Receipt Verification
Verify iOS in-app purchase (IAP) receipts.
URL Check
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/iap/v20221001/unity/ios - Method:
PUT - Authentication Required: Yes
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| receipt | string | Required | Receipt information |
| product_id | string | Required | Payment product ID |
| currency | string | Required | Currency code (KRW, JPY, USD, CNY...) |
| price | string | Required | Payment amount |
| duplicate_allow | string | Required | Allow duplicate receipt verification (Y/N) |
Response Data
| Field | Type | Description |
|---|---|---|
| UserID | string | User ID |
| PackageName | string | Package name |
| OrderID | string | Order ID |
| ProductID | string | Product ID |
| Currency | string | Currency code |
| Price | string | Price |
Code Example
void UMyGame::ValidateIOSIAP(const FString& Receipt, const FString& ProductId, const FString& Currency, const FString& Price, bool bDuplicateAllow)
{
// 플레이어 정보가 포함된 요청 바디 생성
TSharedPtr<FJsonObject> Body = FPlayNANOOHelper::CreateRequestBody();
Body->SetStringField(TEXT("receipt"), Receipt);
Body->SetStringField(TEXT("product_id"), ProductId);
Body->SetStringField(TEXT("currency"), Currency);
Body->SetStringField(TEXT("price"), Price);
Body->SetStringField(TEXT("duplicate_allow"), bDuplicateAllow ? TEXT("Y") : TEXT("N"));
// JSON 문자열 변환
FString JsonBody = FPlayNANOOHelper::ToJsonString(Body);
// HTTP 요청
TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetURL(TEXT("https://service-api.playnanoo.com/iap/v20221001/unity/ios"));
Request->SetVerb(TEXT("PUT"));
FPlayNANOOHelper::SetCommonHeaders(Request, true); // 인증 토큰 포함
Request->SetContentAsString(JsonBody);
Request->OnProcessRequestComplete().BindLambda(
[](FHttpRequestPtr Req, FHttpResponsePtr Res, bool bSuccess)
{
if (bSuccess && Res.IsValid())
{
TSharedPtr<FJsonObject> JsonObject;
TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Res->GetContentAsString());
if (FJsonSerializer::Deserialize(Reader, JsonObject))
{
FString UserID = JsonObject->GetStringField(TEXT("UserID"));
FString OrderID = JsonObject->GetStringField(TEXT("OrderID"));
FString ProductID = JsonObject->GetStringField(TEXT("ProductID"));
FString ValidatedPrice = JsonObject->GetStringField(TEXT("Price"));
FString ValidatedCurrency = JsonObject->GetStringField(TEXT("Currency"));
UE_LOG(LogTemp, Log, TEXT("IAP 검증 성공 - 주문ID: %s, 상품ID: %s, 가격: %s %s"),
*OrderID, *ProductID, *ValidatedPrice, *ValidatedCurrency);
}
}
});
Request->ProcessRequest();
}
Duplicate Receipt Verification
Setting duplicate_allow to "N" prevents duplicate verification with the same receipt. In a test environment, you can set it to "Y" to allow duplicate verification.
App Store Receipt
The receipt is Base64-encoded receipt data provided by StoreKit. Receipt data can be obtained through appStoreReceiptURL.
Price Information
The price must be passed as a string representing the actual payment amount. Currency uses ISO 4217 currency codes.