我正在尝试从我的 iPhone 应用程序中实现应用程序内购买。为了验证收据,我需要向 iTunes 服务器发送一个 json 对象。我试图用 httparty 插件来做到这一点:
require 'httparty'
class ItunesVerification
include HTTParty
base_uri 'https://sandbox.itunes.apple.com'
default_params :output => 'json'
format :json
end
@result = ItunesVerification.post('/verifyReceipt', :query => {'receipt-data' => params[:receipt]})
当我这样做时,我不断得到一个...
{“状态”:21002,“异常”:“java.lang.NullPointerException”}
... 错误。我猜这是因为 json 对象的实现不正确。对象应具有以下结构: { "receipt-data" : "...." }... 由于receipt-data 中的 - 字符,它不接受作为 :receipt-data 标识符...
我该如何实现这一权利?
谢谢 Maechi