140 likes | 368 Views
iOS In-App Purchases (IAP’s): Receipts. Christopher G. Prince Spastic Muffin, LLC chris@SpasticMuffin.biz. In-App Purchases (IAP’s ): Generally. Variation in pricing models E.g., freemium apps Subscriptions Apps that make you keep paying!. IAP Receipts: iOS6 vs. iOS7.
E N D
iOS In-App Purchases (IAP’s): Receipts Christopher G. Prince Spastic Muffin, LLC chris@SpasticMuffin.biz http://SpasticMuffin.biz/extra/Meetup2014
In-App Purchases (IAP’s): Generally • Variation in pricing models • E.g., freemium apps • Subscriptions • Apps that make you keep paying! http://SpasticMuffin.biz/extra/Meetup2014
IAP Receipts: iOS6 vs. iOS7 http://SpasticMuffin.biz/extra/Meetup2014
Initiating a Purchase: iOS6 and iOS7 #import <StoreKit/StoreKit.h> // product is of type SKProduct* http://SpasticMuffin.biz/extra/Meetup2014
Completing a Purchase: iOS6 and iOS7 Differs on iOS6 vs iOS7 http://SpasticMuffin.biz/extra/Meetup2014
SKPaymentTransactionStatePurchased: iOS6 http://SpasticMuffin.biz/extra/Meetup2014
First Level of iOS6 Receipt { "signature" ="AoN828yM82TVkNkyGCb7tuMbRO75WDhTDDy0nepsXzX9qw5cFPhnQ8pYm0EGTqrdIDjyhAGyk6/bg632GH60+hq0wON4fH+B1clXnTnw15PRr4f+dJNn/mrEz8jNYmOXGx+uTu7j7idEIbipHpamPyPJ3zXHpRLKFHZ2iAleJvmHAAADVzCCA1MwggI7oAMCAQICCGUUkU3ZWAS1MA0GCSqGSIb3DQEBBQUAMH8xCzAJBgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEzMDEGA1UEAwwqQXBwbGUgaVR1bmVzIFN0b3JlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA5MDYxNTIyMDU1NloXDTE0MDYxNDIyMDU1NlowZDEjMCEGA1UEAwwaUHVyY2hhc2VSZWNlaXB0Q2VydGlmaWNh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1pZCIgPSAiMTAwMDAwMDEwNjIyNTc4OCI7CgkiYnZycyIgPSAiMS4wIjsKCSJ0cmFuc2FjdGlvbi1pZCIgPSAiMTAwMDAwMDEwNjIyNTc4OCI7CgkicXVhbnRpdHkiID0gIjEiOwoJIm9yaWdpbmFsLXB1cmNoYXNlLWRhdGUtbXMiID0gIjEzOTYyMzU2ODMxMTIiOwoJInVuaXF1ZS12ZW5kb3ItaWRlbnRpZmllciIgPSAiQkFGODgzQTEtQzExNC00OEU4LThCMTktOEFEOEQ4QTM3Mzg2IjsKCSJwcm9kdWN0LWlkIiA9ICJiaXouU3Bhc3RpY011ZmZpbi5QZXR1bmlhLkFkUmVtb3ZhbFllYXJseSI7CgkiaXRlbS1pZCIgPSAiNzI3MTg5MzU4IjsKCSJiaWQiID0gImJpei5TcGFzdGljTXVmZmluLlBldHVuaWEiOwoJInB1cmNoYXNlLWRhdGUtbXMiID0gIjEzOTYyMzU2ODMxMTIiOwoJInB1cmNoYXNlLWRhdGUiID0gIjIwMTQtMDMtMzEgMDM6MTQ6NDMgRXRjL0dNVCI7CgkicHVyY2hhc2UtZGF0ZS1wc3QiID0gIjIwMTQtMDMtMzAgMjA6MTQ6NDMgQW1lcmljYS9Mb3NfQW5nZWxlcyI7Cgkib3JpZ2luYWwtcHVyY2hhc2UtZGF0ZSIgPSAiMjAxNC0wMy0zMSAwMzoxNDo0MyBFdGMvR01UIjsKfQ=="; "environment" = "Sandbox"; "pod" = "100"; "signing-status" = "0"; } http://SpasticMuffin.biz/extra/Meetup2014
Second Level of iOS6 Receipt { "original-purchase-date-pst" = "2014-03-30 20:14:43 America/Los_Angeles"; "unique-identifier" = "15c9cd86518321533ef846f5694081c807dbf047"; "original-transaction-id" = "1000000106225788"; "bvrs" = "1.0"; "transaction-id" = "1000000106225788"; "quantity" = "1"; "original-purchase-date-ms" = "1396235683112"; "unique-vendor-identifier" = "BAF883A1-C114-48E8-8B19-8AD8D8A37386"; "product-id" = "biz.SpasticMuffin.Petunia.AdRemovalYearly"; "item-id" = "727189358"; "bid" = "biz.SpasticMuffin.Petunia"; "purchase-date-ms" = "1396235683112"; "purchase-date" = "2014-03-31 03:14:43 Etc/GMT"; "purchase-date-pst" = "2014-03-30 20:14:43 America/Los_Angeles"; "original-purchase-date" = "2014-03-31 03:14:43 Etc/GMT"; } http://SpasticMuffin.biz/extra/Meetup2014
iOS7: Accessing Receipt in SKPaymentTransactionStatePurchased http://SpasticMuffin.biz/extra/Meetup2014
iOS7: Encrypted Receipts http://SpasticMuffin.biz/extra/Meetup2014
iOS7 Receipt Decryption: Device Local … • Apple: use your own code • Generally: • Decrypt PKCS7 package (e.g., using OpenSSH) • Parse ASN.1 data in receipt http://SpasticMuffin.biz/extra/Meetup2014
iOS7 Receipt: After Decryption {"status":0, "environment":"Sandbox", "receipt": {"receipt_type":"ProductionSandbox", "adam_id":0, "bundle_id":"biz.SpasticMuffin.Petunia", "application_version":"1.0", "download_id":0, "request_date":"2013-11-12 01:43:06 Etc\/GMT", "request_date_ms":"1384220586352", "request_date_pst":"2013-11-11 17:43:06 America\/Los_Angeles", "in_app":[ {"quantity":"1", "product_id":"biz.SpasticMuffin.Petunia.AdRemovalYearly", "transaction_id":"1000000092978110", "original_transaction_id":"1000000092978110", "purchase_date":"2013-11-12 01:36:49 Etc\/GMT", "purchase_date_ms":"1384220209000", "purchase_date_pst":"2013-11-11 17:36:49 America\/Los_Angeles", "original_purchase_date":"2013-11-12 01:36:49 Etc\/GMT", "original_purchase_date_ms":"1384220209000", "original_purchase_date_pst":"2013-11-11 17:36:49 America\/Los_Angeles", "is_trial_period":"false"} ] } } http://SpasticMuffin.biz/extra/Meetup2014
References http://SpasticMuffin.biz/extra/Meetup2014 http://SpasticMuffin.biz/extra/Meetup2014