苹果的验证接口文档

苹果的验证接口文档

发表于3个月前(2013-09-10 12:05)   阅读( 244) | 评论( 00人收藏此文章,我要收藏
赞0

原文链接https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html#//apple_ref/doc/uid/TP40008267-CH104-SW1

苹果的验证接口文档

用户点击BUY后如果交易成功,服务器端向苹果服务器发送过程:

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

2、         创建一个JSON对象,用一个键名为收到的数据和在第1步中创建的字符串。您的JSON代码应该看起来像这样:

{

 

    "receipt-data" : "(receipt bytes here)"

 

}

 

3、         JSON对象发布到App Store使用一个HTTP POST请求。网址的商店是https://buy.itunes.apple.com/verifyReceipt的。

苹果AppStore线上的购买凭证验证地址是https://buy.itunes.apple.com/verifyReceipt ,测试的验证地址是:https://sandbox.itunes.apple.com/verifyReceipt

4、         从App Store收到的响应是一个JSON对象有两个按键,状态及签收。它应该是这个样子:

{

 

    "status" : 0,

 

    "receipt" : { (receipt here) }

 

}

       状态键(status),如果该值是0,这是一个有效的收据。如果该值是0以外,此收据是无效的。

 

 

商店收据

 

收到你发送的数据到App Store有关交易的信息进行编码。当在App Store验证收据,收据数据中的存储的数据进行解码,并在收到返回的响应键。收到的反应是一个JSON字典,包括所有的信息返回到您的应用程序在SKPaymentTransaction对象。你的服务器可以查询这些字段在购买中检索的详细信息。苹果建议你只发送到您的服务器收到数据和使用收据验证检索购买细节。由于App Store的验证收到的数据没有被篡改,从响应中获取此信息是比收据数据和交易数据传输到您的服务器更安全。

表5-1提供了一个列表,你可以用它来获取购买信息的键。许多这些键的属性相匹配上SKPaymentTransaction类。表5-1中未指定为苹果保留所有按键。

注:一些关键取决于应用程序是否被连接到App Store或沙盒测试环境。在沙箱上欲了解更多信息,请参阅“Testing a Store(测试店)。”

Table 5-1  Purchase info keys

Key

Description

quantity

The number of items purchased. This value corresponds to the quantity property of the SKPayment object stored in the transaction’s payment property.

(购买的项目数。此值对应于交易的支付属性的SKPayment对象存储的数量属性。)

product_id

The product identifier of the item that was purchased. This value corresponds to the productIdentifier property of the SKPayment object stored in the transaction’s payment property.

(所购买的产品的商品标识符。此值对应于对象存储在该交易的支付属性SKPayment productIdentifier属性。)

transaction_id

The transaction identifier of the item that was purchased. This value corresponds to the transaction’s transactionIdentifier property.

(本次交易购买的项目的标识符。此值对应至交易transactionIdentifier属性。)

purchase_date

The date and time this transaction occurred. This value corresponds to the transaction’s transactionDate property.

(本次交易发生的日期和时间。此值对应交易transactionDate属性。)

original_transaction_id

For a transaction that restores a previous transaction, this holds the original transaction identifier.

(对于一个交易,恢复以前的交易,持有原来的事务标识符。)

original_purchase_date

For a transaction that restores a previous transaction, this holds the original purchase date.

(恢复以前的交易的交易,持有的原购买日期。)

app_item_id

A string that the App Store uses to uniquely identify the application that created the payment transaction. If your server supports multiple applications, you can use this value to differentiate between them. Applications that are executing in the sandbox do not yet have an app-item-id assigned to them, so this key is missing from receipts created by the sandbox.

App Store的一个字符串,用来唯一标识应用程序创建的支付交易。如果您的服务器支持多个应用程序,你可以使用这个值来区分它们。在沙箱中执行的应用程序还没有一个应用程序项目的ID分配给他们的,所以关键是缺少从沙箱中创建的收据。)

version_external_identifier

An arbitrary number that uniquely identifies a revision of your application. This key is missing in receipts created by the sandbox.

(任意号码,唯一标识一个修改您的应用程序。这关键是缺少在沙箱中创建的收据。)

bid

The bundle identifier for the application.

(束标识符的应用程序。)

bvrs

A version number for the application.

(应用程序的版本号。)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值