iOS 验证开发者的应用商店购买 ID

标签 ios objective-c app-store

如何从用户的订单列表中查看用户发送给我的购买 ID?

例如,他可以发送如下内容:M1VYXX7VX7(如他在应用商店的购买列表中所写)并要求退回他的购买(可能是他不小心删除了他的应用),

但是当我在代码中获取订单信息时(通过 SKPaymentTransaction),我无法访问该标识符。然后我只有 ID 看起来像:1000000020706713。

那么有什么方法可以使用应用商店发送给我的信息来验证购买 ID 吗?

谢谢。

最佳答案

阅读Verifying Store Receipts在应用程序内购买编程指南中。根据文档:

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.

阅读文章了解更多详情。

关于iOS 验证开发者的应用商店购买 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17695901/

相关文章:

ios - 我可以通过一个警告拒绝我的应用程序上传到 iOS 应用程序商店吗?

objective-c - 计算两个边界之间的值的百分比的方法

ios - 左侧的 UITableView 滚动指示器

ios - 两个几乎相同的 UITapGestureRecognizers 之一的 Action 比另一个慢得多

ios - NSInvalidArgumentException,将无法识别的选择器发送到实例的原因

ios - XCode 6 问题 - dequeueReusableCellWithIdentifier 不返回自定义单元格高度

app-store - 使用 iTunes 12.7 在 Mac 中获取 ipa 文件

ios - 未调用 handleWatchKitExtensionRequest

ios - 为什么在设备未移动时调用更新位置

ios - 我是否需要为我的每个应用程序申请证书才能在应用程序商店上发布?