post https://api.watsi.org/v1/credits
Here are some examples on how you can use the API
curl -X POST 'https://api.watsi.org/v1/credits' \
-H 'Authorization: Token token="my_token", email="my_email"' \
--data-urlencode 'customer_email=customer@myapp.com' \
--data-urlencode 'customer_name=name' \
--data-urlencode 'donation_amount=1000'
require 'uri'
require 'net/http'
require 'net/https'
charges_url = 'https://api.watsi.org/v1/charges'
params = {
customer_email: 'customer@myapp.com',
customer_name: 'Oscar Sanchez',
donation_amount: 1000
}
headers = {
'Content-Type' => 'application/json',
'Authorization' => 'Token token="my_token", email="my_email"'
}
uri = URI.parse(charges_url)
https = Net::HTTP.new(uri.host, uri.port)
#https.use_ssl = true
req = Net::HTTP::Post.new(uri.path, initheader = headers)
req.set_form_data(params)
response = https.request(req)
puts response.body