iOS in-app purchase's receipt string explained

Nimit Pattanasri picture Nimit Pattanasri · Mar 6, 2013 · Viewed 8.6k times · Source

I try to understand the receipt information obtained from iTunes server, but could not find relevant documentation.

Particularly, what's the difference among unique_identifier, unique_vendor_identifier, original_transaction_id (which is claimed, in a WWDC'12 session, to be a de facto customer id) and [[[UIDevice currentDevice] identifierForVendor] UUIDString]?

{"receipt":
    {"original_purchase_date_pst":"...",        
     "purchase_date_ms":"...", 
     "unique_identifier":"...", 
     "original_transaction_id":"...", 
     "bvrs":"...", 
     "transaction_id":"...", 
     "quantity":"...", 
     "unique_vendor_identifier":"...", 
     "item_id":"...", 
     "product_id":"...", 
     "purchase_date":"...", 
     "original_purchase_date":"...", 
     "purchase_date_pst":"...", 
     "bid":"...", 
     "original_purchase_date_ms":"..."},  
"status":0}`

I wish to store this receipt information on my server to track subscription validity. So it is better to know which id I should use as a surrogate for user identity.

Answer

Fls'Zen picture Fls'Zen · Mar 6, 2013

Your software should only rely on the fields that Apple describes in their documentation. They could remove unique_identifier or unique_vendor_identifier, change their meaning, or change their values at any time without telling you about it.

You should follow Apple's documentation in regard to verifying subscription receipts using Apple's servers before your server transmits the sbuscription content to the device.