I verify the receipt of in-app-purchases (so called consumables) for the Mac App Store on the server side. The response from Apple's servers usually looks like this:
{
"status"=>0,
"environment"=>"Production",
"receipt" =>
{
"receipt_type" => "Production",
"adam_id"=>410628904,
"bundle_id" => "com.company.product",
"application_version"=>"1.0.0",
"download_id"=>002141541230420,
"request_date"=>"2013-10-22 07:53:11 Etc/GMT",
"request_date_ms"=>"1382428391914",
"request_date_pst"=>"2013-10-22 00:53:11 America/Los_Angeles",
"original_purchase_date"=>"2011-08-22 06:05:47 Etc/GMT",
"original_purchase_date_ms"=>"1313993147000",
"original_purchase_date_pst"=>"2011-08-21 23:05:47 America/Los_Angeles",
"original_application_version"=>"1.0.0",
"in_app"=> [
{
"quantity"=>"1",
"product_id"=>"com.company.product.mac_consumable",
"transaction_id"=>"9123912391231",
"original_transaction_id"=>"51881235936908",
"purchase_date"=>"2013-10-22 07:52:06 Etc/GMT",
"purchase_date_ms"=>"1382428326000",
"purchase_date_pst"=>"2013-10-22 00:52:06 America/Los_Angeles",
"original_purchase_date"=>"2013-10-22 07:52:06 Etc/GMT",
"original_purchase_date_ms"=>"1382428326000",
"original_purchase_date_pst"=>"2013-10-22 00:52:06 America/Los_Angeles",
"bundle_id"=>"com.company.product"
}
]
}
}
But sometimes we get back information without the in_app hash set:
{
"status"=>0,
"environment"=>"Production",
"receipt" =>
{
"receipt_type" => "Production",
"adam_id"=>312621904,
"bundle_id" => "com.company.product",
"application_version"=>"1.0.0",
"download_id"=>002141541230420,
"request_date"=>"2013-10-22 07:53:11 Etc/GMT",
"request_date_ms"=>"1382428391914",
"request_date_pst"=>"2013-10-22 00:53:11 America/Los_Angeles",
"original_purchase_date"=>"2011-08-22 06:05:47 Etc/GMT",
"original_purchase_date_ms"=>"1313993147000",
"original_purchase_date_pst"=>"2011-08-21 23:05:47 America/Los_Angeles",
"original_application_version"=>"1.0.0",
"in_app"=> []
}
}
Does this mean the receipts are invalid? Should the in_app field always be populated? Or should those receipts be considered valid as well and why is the in_app information empty then?