I’m trying to implement the in App purchase from within my iPhone app. To verify the receipt I need to send a json object to the iTunes server. Im trying to do this with the httparty plugin:
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]})
When I do so, I keep getting a…
{“status”:21002, “exception”:”java.lang.NullPointerException”}
… error. I guess this is because of the not right implementation of the json object. The Object should have the structure: { “receipt-data” : “….” }… because of the – character in receipt-data it dosn’t accept as :receipt-data identifyer…
How do I have to implement that right?
Thanks
Maechi
I got the solution:
I have to write :body instead of :query! Then it gets sent as a json object!
Markus