Just My Life & My Work

四年前(2014年)實作過應用內購買 (In App Purchase),經歷讓人三溫暖的刺激感,終於跟偉大的後台工程師JK,攜手合作打造出給幼兒使用的iOS App,那可是要在美國運行的呢!

[iOS] IAP 驗證發票 (IAP Verify Receipt).png

如今要再次研究Apple金流部分,IAP 驗證發票 (IAP Verify Receipt)是個必經程序,那我可以怎麼驗證購買真實性?

在IAP交易成功後記錄發票資料(Receipt Data)

receipt-data: The base64 encoded receipt data.

未來就是要拿receipt-data去反查發票詳細內容!

我實際使用Postman測試Sandbox環境的receipt-data,真的能成功取回呢!

Sandbox Post URL: https://sandbox.itunes.apple.com/verifyReceipt

參考Input:

{“receipt-data":"eyJzaWduYXR1cmUiID0gIkFoaHEwbmFxaG01ci8wSUNuYk9hVThCeVBLNkRja2ZsanRCMDNnZUh4dk0ybEVjVkdqK2NVM1lnWGZ0RkZCZ2lFYkR1NGdoYXFVWFRqRzlpc25Zeit6VWFhTXRUZDJ6YnNLbFhIMitzYm1ZaC9tY2M2eWt3dVFkaFZsOWZKYkxNaFVXWHNTUlIxVlVjQlE4TkxjVGg5ZHNXOTVTREcxdG9DQk45cWM0L01CZlVBQUFEVnpDQ0ExTXdnZ0k3b0FNQ0FRSUNDQnVwNCtQQWhtL0xNQTBHQ1NxR1NJYjNEUUVCQlFVQU1IOHhDekFKQmdOVkJBWVRBbFZUTVJNd0VRWURWUVFLREFwQmNIQnNaU0JKYm1NdU1TWXdKQVlEVlFRTERCMUJjSEJzWlNCRFpYSjBhV1pwWTJGMGFXOXVJRUYxZEdodmNtbDBlVEV6TURFR0ExVUVBd3dxUVhCd2JHVWdhVlIxYm1WeklGTjBiM0psSUVObGNuUnBabWxqWVhScGIyNGdRWFYwYUc5eWFYUjVNQjRYRFRFME1EWXdOekF3TURJeU1Wb1hEVEUyTURVeE9ERTRNekV6TUZvd1pERWpNQ0VHQTFVRUF3d2FVSFZ5WTJoaGMyVlNaV05sYVhCMFEyVnlkR2xtYVdOaGRHVXhHekFaQmdOVkJ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TWdNVFk2TXpJNk1qY2dSWFJqTDBkTlZDSTdDZ2tpY0hWeVkyaGhjMlV0WkdGMFpTMXdjM1FpSUQwZ0lqSXdNVFV0TVRFdE1qTWdNRGc2TXpJNk1qY2dRVzFsY21sallTOU1iM05mUVc1blpXeGxjeUk3Q2draWIzSnBaMmx1WVd3dGNIVnlZMmhoYzJVdFpHRjBaU0lnUFNBaU1qQXhOUzB4TVMweU15QXhOam96TWpveU55QkZkR012UjAxVUlqc0tmUT09IjsiZW52aXJvbm1lbnQiID0gIlNhbmRib3giOyJwb2QiID0gIjEwMCI7InNpZ25pbmctc3RhdHVzIiA9ICIwIjt9″}

參考Output:

{
“receipt": {
“original_purchase_date_pst": “2015-11-23 08:32:27 America/Los_Angeles",
“purchase_date_ms": “1448296347138″,
“unique_identifier": “e47425df7fb6ab8c3c7e5730c3a7eb5b6563823d",
“original_transaction_id": “1000000181492557″,
“bvrs": “3″,
“transaction_id": “1000000181492557″,
“quantity": “1″,
“unique_vendor_identifier": “5C275B5A-3E66-4026-9523-845B225755FC",
“item_id": “1061557484″,
“product_id": “purchaser.consumableFeature",
“purchase_date": “2015-11-23 16:32:27 Etc/GMT",
“original_purchase_date": “2015-11-23 16:32:27 Etc/GMT",
“purchase_date_pst": “2015-11-23 08:32:27 America/Los_Angeles",
“bid": “com.es.Purchaser",
“original_purchase_date_ms": “1448296347138″
},
“status": 0
}

現在要請後台工程師來實現,每一天去反查發票,來知道用戶訂閱(Subscription)期限為何!

參考:

廣告

發表留言

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

w

連結到 %s

標籤雲

%d 位部落客按了讚: