c# - Apple Receipt Verifier 返回 JsonException

标签 c# asp.net ios objective-c in-app-purchase

在我的购买验证过程中有一个三方

  1. iOS 客户端
  2. ASP.NET 服务器(验证中介)
  3. 苹果服务器

iOS Client与ASP.NET Server通信方式中的JSON-RCP

验证过程是;通过网络服务发送付款收据到 ASP.NET 服务器(服务器使用 AppleReceiptVerifier 验证收据)

我有 5 个用于支付的产品标识符,其中 2 个运行良好并返回预期的响应,但其他三个像这样返回 JsonException

{
    error =     {
        errors =         (
                        {
                message = "Found String where Object was expected.";
                name = JsonException;
            }
        );
        message = "Found String where Object was expected.";
        name = JSONRPCError;
    };
    id = "<null>";
}

还有这个

{
    error =     {
        errors =         (
                        {
                message = "Missing value.";
                name = JsonException;
            }
        );
        message = "Missing value.";
        name = JSONRPCError;
    };
    id = "<null>";
}

所有产品标识符都是同一类型,只是价格不同 我不知道为什么会出现这个问题???

怎么办???

最佳答案

阅读json-rpc的规范后, 看来 params 是一个数组,试试这个:

{
  "method":"sendReceipt",
  "params" :[
    {
      "ReceiptData":"ewoJInNpZ25hdHVyZSIgPSAiQXJ....‌.",
      "PersonID":"sam@am.com"
    }
  ],
  "id":"1"
}

或者这个:

{
  "method":"sendReceipt",
  "params" :[
    "ewoJInNpZ25hdHVyZSIgPSAiQXJ....‌.",
    "sam@am.com"
  ],
  "id":"1"
}

jsonrpc 2.0 版:

{
    "jsonrpc": "2.0", 
    "method": "sendReceipt", 
    "params": 
     {
      "ReceiptData":"ewoJInNpZ25hdHVyZSIgPSAiQXJ....‌.",
      "PersonID":"sam@am.com"
     }, 
     "id": 1
}

它们都应该根据您的需要工作。

关于c# - Apple Receipt Verifier 返回 JsonException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18506047/

相关文章:

c# - Release模式下的 Visual Studio "Could not load file or assembly. Operation is not supported"错误

c# - 将表达式和 lambdas 参数传递给 F# 中的 C# 扩展方法

javascript - 替换字符串中的下划线

c# - 我的数据表的过滤器

ios - 如何链接到 Storyboard Xcode 的另一个 View

c# - 如何从包含 XMl 的字符串中获取内部 xml

c# - 使用 C# 对大型 XML 文件进行 XSLT 转换

javascript - jQuery 中的异步日志记录

ios - 使用 ios 5.1.1 时启动时的 SIGABRT

iphone - 在 iPhone 应用程序中向 PDF 文档添加按钮