iOS服务器端验证 - 收据类型 [英] iOS Server Side Validation - receipt types

查看:472
本文介绍了iOS服务器端验证 - 收据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试验证服务器上的购买时,我从Apple获得了两种收据格式。

I'm getting 2 kinds of receipt formats from Apple when i try to verify purchases on the server.

知道有什么区别吗?

1)

  content: {
    status: 0,
    receipt: {
      item_id: "662554154",
      original_purchase_date: "2012-10-12 08:32:12 Etc/GMT",
      purchase_date_pst: "2012-10-12 01:32:12 America/Los_Angeles",
      purchase_date: "2012-10-12 08:32:12 Etc/GMT",
      product_id: "com.example.mygame.tool1",
      bid: "com.example.mygame",
      version_external_identifier: "5647854",
      bvrs: "1.0",
      quantity: "1",
      transaction_id: "8844567822225544",
      app_item_id: "659563252",
      original_purchase_date_ms: "1350030732000",
      original_transaction_id: "8844567822225544",
      purchase_date_ms: "1350030732000",
      original_purchase_date_pst: "2012-10-12 01:32:12 America/Los_Angeles"
    }
  }

2)

content: {
  receipt: {
    in_app: [
      {
        is_trial_period: "false",
        original_purchase_date_pst: "2013-10-09 20:55:27 America/Los_Angeles",
        original_purchase_date_ms: "1386571707000",
        original_purchase_date: "2013-10-09 04:55:27 Etc/GMT",
        purchase_date_pst: "2013-10-09 20:55:27 America/Los_Angeles",
        purchase_date_ms: "1386571707000",
        purchase_date: "2013-10-09 04:55:27 Etc/GMT",
        original_transaction_id: "654888452251325",
        transaction_id: "654888452251325",
        product_id: "com.example.mygame.tool1",
        quantity: "1"
      }
    ],
    original_application_version: "1.0",
    original_purchase_date_pst: "2013-10-09 20:55:27 America/Los_Angeles",
    original_purchase_date_ms: "1386569706000",
    original_purchase_date: "2013-10-09 04:55:27 Etc/GMT",
    request_date_pst: "2013-10-09 20:55:27 America/Los_Angeles",
    request_date_ms: "1386571710087",
    request_date: "2013-10-09 04:55:27 Etc/GMT",
    download_id: 215425636588954,
    application_version: "1.0",
    bundle_id: "com.example.mygame",
    adam_id: 654225311,
    receipt_type: "Sandbox"
  },
  environment: "Sandbox",
  status: 0
}


推荐答案

在iOS 6 每个IAP(应用程序内购买)交易中在StoreKit API中有自己的收据 SKPaymentTransaction.transactionReceipt )。当您将此收据数据发送到他们的验证API时,您会收到以前的回复。

In iOS 6 each IAP (in-app purchase) transaction would have its own receipt (SKPaymentTransaction.transactionReceipt in the StoreKit API). When you send this receipt data over to their validation API, you get the former response.

在iOS 7中,Apple已开始使用他们称之为Grand Unified Receipt的内容。这意味着应用一个收据 ,其中包含有关购买应用程序本身以及IAP的信息。您使用 - [NSBundle appStoreReceiptURL] API从磁盘加载此收据数据(并且可能 SKReceiptRefreshRequest 以获取它它似乎不存在)。当您将此收据数据发送到他们的验证API时,您会得到后一个响应。

In iOS 7, Apple has started using something they call the "Grand Unified Receipt". This means that apps have one receipt that contains information about the purchase of the app itself, as well as IAPs. You use the -[NSBundle appStoreReceiptURL] API to load this receipt data from disk (and possibly SKReceiptRefreshRequest to get it if it doesn't seem to exist). When you send this receipt data over to their validation API, you get the latter response.

主要区别在于前一个收据格式代表一个IAP交易,而后者表示它们的数组(以及购买应用程序本身)。

The main difference is that the former receipt format represents one IAP transaction, while the latter represents an array of them (as well as the purchase of the application itself).

使用收据保护您的数字销售WWDC 2013会议

这篇关于iOS服务器端验证 - 收据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆