iOS的开发者通过验证的应用程序商店购买ID [英] iOS verify app store purchase id by developer

查看:172
本文介绍了iOS的开发者通过验证的应用程序商店购买ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检查这是由用户从他的命令列表发送给我购买的id?

How can I check purchase id which was sent by user to me from his orders list?

例如,他可以发送这样的:M1VYXX7VX7(写在他的采购在AppStore的名单),并要求退回他购买(可他不小心删除了自己的应用程序),

For example, he can send something like: M1VYXX7VX7 (as written in his purchases list in appstore) and ask to return his purchase (may be he had deleted his app accidentally),

但是,当我得到我的code内(通过 SKPaymentTransaction )的订单信息我必须说标识符的访问。那么只有ID我有看起来像:1000000020706713

But when I get order information inside of my code (through SKPaymentTransaction) I have no access to that identifier. Then only ID i have looks like: 1000000020706713.

那么,有没有验证,使用购买的ID信息,它是由应用程序商店发送给我的任何方式?

So is there any ways to validate that purchase ID using information which was sent to me by app store?

感谢。

推荐答案

读<一个href=\"https://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html#//apple_ref/doc/uid/TP40008267-CH104\">Verifying购物小票中的应用内购买编程指南中。根据文档:

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

要核实收据,请执行以下步骤:

To verify the receipt, perform the following steps:


      
  1. 检索数据的接收。在iOS上,这是交易的transactionReceipt属性的值。在OS X,这是在应用程序包内的收据文件的全部内容。恩code。使用base64编码数据的接收。

  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.

创建您在步骤1中创建了一个名为收据数据单键和字符串的JSON对象您的JSON code应该是这样的:

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)"
}


  

  • 发布使用HTTP POST请求的JSON对象到App Store。为专卖店的网址是<一个href=\"https://buy.itunes.apple.com/verifyReceipt\">https://buy.itunes.apple.com/verifyReceipt.

    从App Store收到的反应是有两个按键,状态和收到的JSON对象。它应该是这个样子:

    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) }
    }
    


  •   

    如果状态键的值是0,这是一个有效的收据。如果该值不为0的,这收据是无效的。

    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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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