Intorduction | Validating Receipts Locally | Validating Receipts With the App Store | Receipt Fields

본 페이지는 About Receipt Validation 문서의 Validating Receipts With the App Store 부분을 번역해 놓은 페이지 입니다. 발 번역이라 이상한 부분이 있을 수 있습니다. 발견즉시 댓글을 달아 주세요.


Validating Receipts With the App Store
앱 스토어와 유효성 검사 영수증


Use a trusted server to communicate with the App Store. Using your own server lets you design your app to recognize and trust only your server, and lets you ensure that your server connects with the App Store server. It is not possible to build a trusted connection between a users device and the App store directly because you don’t control either end of that connection.

앱 스토어와 통신하기 위해 신뢰할 수있는 서버를 사용합니다. 자신의 서버를 사용하면 인식 만 서버를 신뢰하도록 응용 프로그램을 설계 할 수 있습니다, ​​당신은 서버가 앱 스토어 서버와 연결되도록 할 수 있습니다. 당신이 그 연결의 양 끝을 제어하지 않기 때문에 그것은 사용자 장치와 직접 앱 스토어간에 신뢰할 수있는 연결을 구축 할 수 없습니다.

Verifying an App Receipt
앱 영수증을 확인

Communication with the App Store is structured as JSON dictionaries, as defined in RFC 4627. To verify the receipt, perform the following steps:
RFC 4627에 정의 된 앱 스토어와의 통신은 JSON 사전으로 구성되어 있습니다.영수증을 확인하려면 다음 단계를 수행하십시오 :

  1. Retrieve the receipt data and base64 encode it (using the RFC 4648 form of base64). Use the appStoreReceiptURL method of NSBundle to locate the app’s receipt, and then read the entire file.
    수신 데이터를 base64로 (base64로의 RFC 4648 형식을 사용)로 인코딩을 검색합니다.응용 프로그램의 영수증을 찾은 다음 전체 파일을 읽을 수 NSBundle의 appStoreReceiptURL 메서드를 사용합니다.

    If the appStoreReceiptURL method is not available, you can fall back to the value of a transaction's transactionReceipt property for backward compatibility.
    appStoreReceiptURL 방법을 사용할 수없는 경우, 당신은 이전 버전과의 호환성을 위해 트랜잭션의 transactionReceipt 속성의 값으로 폴백 할 수 있습니다.

  2. Create a JSON object with a single key named receipt-data whose value is the base64-encoded receipt data. Your JSON object should look like this:
    값을 base64로 인코딩 된 수신 데이터입니다 수신 데이터라는 하나의 키와 JSON 개체를 만듭니다. 귀하의 JSON 개체는 다음과 같아야합니다 :

    {
        "receipt-data" : "(receipt bytes here)"
    }
  3. Send the JSON object to the App Store using an HTTP POST request. The URL for the store is https://buy.itunes.apple.com/verifyReceipt.
    HTTP POST 요청을 사용하여 앱 스토어에 JSON 개체를 전송합니다.저장소의 URL은 https://buy.itunes.apple.com/verifyReceipt입니다.

  4. The response received from the App Store is a JSON object with the keys status and receipt. (When validating an auto-renewable subscription, the response contains additional keys, as described in “Verifying an Auto-Renewable Subscription Receipt”). It should look something like this:
    앱 스토어에서받은 응답은 키 상태 및 영수증 JSON 개체입니다. (자동 재생 구독의 유효성을 검사 할 때, 응답은 "자동 재생 구독 수령 확인"에 설명 된 추가 키를 포함). 그것은 다음과 같이 보일 것입니다 :

    {
        "status" : 0,
        "receipt" : { (receipt here) }
    }

    If the value of the status key is 0, this is a valid receipt. If the value is anything other than 0, this receipt is invalid.
    상태 키의 값이 0 인 경우,이 유효한 영수증입니다. 값이 0 이외의 경우,이 영수증은 무효입니다.

The value of the receipt key is a JSON object that contains the receipt’s fields. For information about the fields in a receipt, see “Receipt Fields.”

영수증 키의 값은 영수증의 필드가 포함 된 JSON 개체입니다.영수증의 필드에 대한 자세한 내용은 "영수증 필드"를 참조하십시오.

Verifying an Auto-Renewable Subscription Receipt
자동 재생 구독 영수증을 확인

Verifying a receipt for an auto-renewable subscription is almost identical to the process described in “Validating Receipts With the App Store.” Your application creates a JSON object and posts it to the App Store. The JSON object for an auto-renewable subscription receipt includes a second parameter: the shared secret you created in iTunes Connect:

자동 재생 구독에 대한 영수증을 확인하기에 설명 된 프로세스와 거의 동일합니다 "앱 스토어를 통해 검증 영수증."응용 프로그램이 JSON 개체와 앱 스토어에 게시를 만듭니다. iTunes에서 생성 한 공유 비밀 연결 : 자동 재생 구독 영수증 JSON 객체는 두 번째 매개 변수를 포함

{
    "receipt-data" : "(receipt bytes here)",
    "password"     : "(shared secret bytes here)"
}

The response includes a status field that indicates whether the receipt was successfully validated.
응답 영수증의 유효성 검사가 성공적으로 완료되었는지 여부를 나타내는 상태 필드가 포함되어 있습니다.

{
    "status" : 0,
    "receipt" : { (receipt here) },
    "latest_receipt" : "(base-64 encoded receipt here)",
    "latest_receipt_info" : { (latest receipt info here) }
}

If the user’s receipt was valid and the subscription is active, the status field holds 0, and the receipt field is populated with the decoded receipt data. If your server receives a non-zero status value, use “Status codes for auto-renewable subscriptions” to interpret non-zero status codes.

사용자의 접수가 유효이고 가입이 활성 상태 인 경우, 상태 필드는 0을 보유하고 영수증 필드는 디코딩 영수증 데이터로 채워집니다. 서버가 아닌 상태 값을 수신하면 0이 아닌 상태 코드를 해석하는 "자동 갱신 구독 상태 코드"를 사용합니다.

Table 2-1  Status codes for auto-renewable subscriptions

Status Code

Description

21000

The App Store could not read the JSON object you provided.

21002

The data in the receipt-data property was malformed.

21003

The receipt could not be authenticated.

21004

The shared secret you provided does not match the shared secret on file for your account.

21005

The receipt server is not currently available.

21006

This receipt is valid but the subscription has expired. When this status code is returned to your server, the receipt data is also decoded and returned as part of the response.

21007

This receipt is a sandbox receipt, but it was sent to the production service for verification.

21008

This receipt is a production receipt, but it was sent to the sandbox service for verification.

The receipt field on the JSON object holds the parsed information from the receipt. The receipt data for an auto-renewable subscription includes some additional keys, and some other keys are used differently for subscriptions. For information about keys found in a receipt, see “Receipt Fields.”

JSON 개체의 영수증 필드는 영수증에서 구문 분석 정보를 보유하고 있습니다.자동 재생 구독에 대한 수신 데이터는 몇 가지 추가 키를 포함하고, 다른 키는 구독 다르게 사용됩니다.영수증에있는 키에 대한 자세한 내용은 "영수증 필드"를 참조하십시오.

In addition to the receipt_data field, the response may also include two other fields. If the user’s subscription is active and was renewed by a transaction that took place after the receipt your server sent to the App Store, the latest_receipt field includes a base-64 encoded receipt for the last renewal for this subscription. The decoded data for this new receipt is also provided in the latest_expired_receipt_info field. Your server can use this new receipt to maintain a record of the most recent renewal.

receipt_data 필드 또한, 응답은 다른 두 필드를 포함 할 수 있습니다.사용자의 가입이 활성화되고 서버가 앱 스토어로 전송 수령 후 일어났다 트랜잭션에 의해 갱신 된 경우, latest_receipt 필드는이 구독에 대한 최종 갱신 base-64로 인코딩 된 영수증을 포함하고 있습니다. 이 새로운 영수증에 대한 디코드 된 데이터는 latest_expired_receipt_info 필드에 제공됩니다. 서버는 가장 최근에 갱신의 기록을 유지하기 위해이 새로운 영수증을 사용할 수 있습니다.

Posted by 창업자닉군
,