Send json object with httparty

I am trying to implement an App purchase from my iPhone application. To check the receipt, I need to send the json object to the iTunes server. I am trying to do this using 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 this, I keep getting ...

{"status": 21002, "exception": "java.lang.NullPointerException"}

... mistake. I think this is due to improper implementation of the json object. The object must have the structure: {"receipt-data": "...."} ... because of - the symbol in the receipts-data, which it does not accept as: identifier of the receipt data ...

How do I exercise this right?

Thanks Maechi

+6
json ruby-on-rails in-app-purchase
source share
1 answer

I got a solution:

I need to write: body instead of: query! Then it is sent as a json object!

Marcus

+11
source

All Articles