Skip to main content

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

ParameterTypeRequiredDescription
receiptstringRequiredReceipt information
product_idstringRequiredPayment product ID
currencystringRequiredCurrency code (KRW, JPY, USD, CNY...)
pricestringRequiredPayment amount
duplicate_allowstringRequiredAllow duplicate receipt verification (Y/N)

Response Data

FieldTypeDescription
UserIDstringUser ID
PackageNamestringPackage name
OrderIDstringOrder ID
ProductIDstringProduct ID
CurrencystringCurrency code
PricestringPrice

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.