Yueyoum
Yueyoum

Reputation: 3073

IOS7 verify iap receipt, What's the in_app filed mean?

app do an iap, and send the receipt to my server, my server send it to apple's server to verify the receipt.

IOS7 has changed the return data.

Now, the return data like this:

{u'environment': u'Sandbox',                                                 
 u'receipt': {u'adam_id': 0,                                                     
              u'app_item_id': 0,                                                 
              u'application_version': u'1.0',                                    
              u'bundle_id': u'com.mztimes.sanguo.international',                 
              u'download_id': 0,                                                 
              u'in_app': [{u'is_trial_period': u'false',                         
                           u'original_purchase_date': u'2014-10-24 06:54:20 Etc/GMT',
                           u'original_purchase_date_ms': u'1414133660000',   
                           u'original_purchase_date_pst': u'2014-10-23 23:54:20 America/Los_Angeles',
                           u'original_transaction_id': u'1000000128944402',  
                           u'product_id': u'com.mztimes.sanguo.international.60gold',
                           u'purchase_date': u'2014-10-28 01:56:45 Etc/GMT', 
                           u'purchase_date_ms': u'1414461405000',                
                           u'purchase_date_pst': u'2014-10-27 18:56:45 America/Los_Angeles',
                           u'quantity': u'1',                                    
                           u'transaction_id': u'1000000128944402'},              
                          {u'is_trial_period': u'false',                         
                           u'original_purchase_date': u'2014-10-24 06:52:30 Etc/GMT',
                           u'original_purchase_date_ms': u'1414133550000',   
                           u'original_purchase_date_pst': u'2014-10-23 23:52:30 America/Los_Angeles',
                           u'original_transaction_id': u'1000000128944196',  
                           u'product_id': u'com.mztimes.sanguo.international.300gold',
                           u'purchase_date': u'2014-10-28 01:56:45 Etc/GMT', 
                           u'purchase_date_ms': u'1414461405000',                
                           u'purchase_date_pst': u'2014-10-27 18:56:45 America/Los_Angeles',
                           u'quantity': u'1',                                    
                           u'transaction_id': u'1000000128944196'},              
                          {u'is_trial_period': u'false',                         
                           u'original_purchase_date': u'2014-10-28 01:56:45 Etc/GMT',
                           u'original_purchase_date_ms': u'1414461405000',   
                           u'original_purchase_date_pst': u'2014-10-27 18:56:45 America/Los_Angeles',
                           u'original_transaction_id': u'1000000129320617',  
                           u'product_id': u'com.mztimes.sanguo.international.980gold',
                           u'purchase_date': u'2014-10-28 01:56:45 Etc/GMT', 
                           u'purchase_date_ms': u'1414461405000',                
                           u'purchase_date_pst': u'2014-10-27 18:56:45 America/Los_Angeles',
                           u'quantity': u'1',                                    
                           u'transaction_id': u'1000000129320617'}],             
              u'original_application_version': u'1.0',                           
              u'original_purchase_date': u'2013-08-01 07:00:00 Etc/GMT',         
              u'original_purchase_date_ms': u'1375340400000',                    
              u'original_purchase_date_pst': u'2013-08-01 00:00:00 America/Los_Angeles',
              u'receipt_type': u'ProductionSandbox',                             
              u'request_date': u'2014-10-28 02:50:09 Etc/GMT',                   
              u'request_date_ms': u'1414464609873',                              
              u'request_date_pst': u'2014-10-27 19:50:09 America/Los_Angeles',
              u'version_external_identifier': 0},                                
 u'status': 0}   

Look at the in_app field: the document says that:

In the JSON file, the value of this key is an array containing all in-app purchase receipts. In the ASN.1 file, there are multiple fields that all have type 17, each of which contains a single in-app purchase receipt.

In my many tests, the last element of in_app list is the receipt info what i was send to apple's server . But what are the others two element?

I send different receipt to verify, the others two element always the same.

Why this? Help me!

Upvotes: 3

Views: 1561

Answers (1)

LF-DevJourney
LF-DevJourney

Reputation: 28524

As the doc says, containing all in-app purchase receipts based on the in-app purchase transactions present in the input base-64 receipt-data. Also refer to iOS IAP in_app field in receipt and Removing in app purchases from a new version of the application(iOS)

In-App Purchase Receipt

The receipt for an in-app purchase.

ASN.1 Field Type 17

ASN.1 Field Value SET of in-app purchase receipt attributes

JSON Field Name in_app

JSON Field Value array of in-app purchase receipts

In the JSON file, the value of this key is an array containing all in-app purchase receipts based on the in-app purchase transactions present in the input base-64 receipt-data. For receipts containing auto-renewable subscriptions, check the value of the latest_receipt_info key to get the status of the most recent renewal.

In the ASN.1 file, there are multiple fields that all have type 17, each of which contains a single in-app purchase receipt.

Note: An empty array is a valid receipt.

The in-app purchase receipt for a consumable product is added to the receipt when the purchase is made. It is kept in the receipt until your app finishes that transaction. After that point, it is removed from the receipt the next time the receipt is updated - for example, when the user makes another purchase or if your app explicitly refreshes the receipt.

The in-app purchase receipt for a non-consumable product, auto-renewable subscription, non-renewing subscription, or free subscription remains in the receipt indefinitely.

Upvotes: 0

Related Questions