iOS verify app store purchase id by developer

ε祈祈猫儿з 提交于 2019-12-01 08:31:22

Read Verifying Store Receipts in the In-App Purchase Programming Guide. According to the documentation:

To verify the receipt, perform the following steps:

  1. Retrieve the receipt data. On iOS, this is the value of the transaction's transactionReceipt property. On OS X, this is the entire contents of the receipt file inside the application bundle. Encode the receipt data using base64 encoding.

  2. Create a JSON object with a single key named receipt-data and the string you created in step 1. Your JSON code should look like this:

    {
       "receipt-data" : "(receipt bytes here)"
    }
    
  3. Post the JSON object to the App Store using an HTTP POST request. The URL for the store is https://buy.itunes.apple.com/verifyReceipt.

  4. The response received from the App Store is a JSON object with two keys, status and receipt. It should look something like this:

    {
        "status" : 0,
        "receipt" : { (receipt here) }
    }
    

If the value of the status key is 0, this is a valid receipt. If the value is anything other than 0, this receipt is invalid.

Read the article for more details.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!