C# 在C语言中实现Apple Store收据的收据验证#

C# 在C语言中实现Apple Store收据的收据验证#,c#,in-app-purchase,C#,In App Purchase,我正在尝试为应用程序内的Apple Store购买收据实现验证收据 根据他们的网站看起来像 我需要知道的结构,你能帮我一个什么样的加密样本 你能帮帮我吗 要验证收据,请执行以下步骤: 检索收据数据。在iOS上,这是 事务的transactionReceipt属性。在OSX上,这是整个 应用程序包中的接收文件的内容。编码 使用base64编码的接收数据。使用单个 名为receipt data的键和在步骤1中创建的字符串。你的JSON 代码应该如下所示: 使用HTTP Post请求将JSON对象发布

我正在尝试为应用程序内的Apple Store购买收据实现验证收据

根据他们的网站看起来像

我需要知道的结构,你能帮我一个什么样的加密样本

你能帮帮我吗

要验证收据,请执行以下步骤:

检索收据数据。在iOS上,这是 事务的transactionReceipt属性。在OSX上,这是整个 应用程序包中的接收文件的内容。编码 使用base64编码的接收数据。使用单个 名为receipt data的键和在步骤1中创建的字符串。你的JSON 代码应该如下所示:

使用HTTP Post请求将JSON对象发布到应用商店。商店的URL为

。收到的答复 appstore是一个JSON对象,有两个键,status和receive。信息技术 应该是这样的:

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

这张收据无效


您可以将门店收据反序列化为如下类:

public class receipt
{
    public string original_purchase_date_pst { get; set; }
    public string original_transaction_id { get; set; }
    public string original_purchase_date_ms { get; set; }
    public string transaction_id { get; set; }
    public string quantity { get; set; }
    public string product_id { get; set; }
    public string bvrs { get; set; }
    public string purchase_date_ms { get; set; }
    public string purchase_date { get; set; }
    public string original_purchase_date { get; set; }
    public string purchase_date_pst { get; set; }
    public string bid { get; set; }
    public string item_id { get; set; }
}

《应用内采购编程指南》的“门店收据”部分的表5-1列出了各个字段的明细。希望有帮助

这是一个较旧版本的字段值(例如,“bid”不是较新的收据格式的一部分。但对于仍然发送/使用较旧格式收据(我们仍然有一些未触及的古老收据…)的应用程序来说,这仍然很方便。新应用程序可能需要新的“统一收据”schema。感谢您提醒我关于过去的自我。因为我现在正在更新有问题的古代应用程序。在这里可以找到描述可用json字段的文档可能毫无价值:
{
     "status" : 0,
     "receipt" : { (receipt here) } 
}
public class receipt
{
    public string original_purchase_date_pst { get; set; }
    public string original_transaction_id { get; set; }
    public string original_purchase_date_ms { get; set; }
    public string transaction_id { get; set; }
    public string quantity { get; set; }
    public string product_id { get; set; }
    public string bvrs { get; set; }
    public string purchase_date_ms { get; set; }
    public string purchase_date { get; set; }
    public string original_purchase_date { get; set; }
    public string purchase_date_pst { get; set; }
    public string bid { get; set; }
    public string item_id { get; set; }
}