Created
November 4, 2015 13:04
-
-
Save goodfeel/18de1d44a8656b3d9754 to your computer and use it in GitHub Desktop.
Apple IAP Sandbox Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'net/https' | |
require 'uri' | |
data = "<based 64 reciept data>" | |
params = { | |
'receipt-data' => data | |
}.to_json | |
uri = URI('https://sandbox.itunes.apple.com/verifyReceipt') | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
http.use_ssl = true | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request['Content-Type'] = "application/json" | |
request['Accept'] = "application/json" | |
request.body = params | |
response = http.request(request) | |
p JSON.parse(response.body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment