I have below code in Ruby file which is
post '/create_charge' do
# Create the charge on Stripe's servers
begin
charge = Stripe::Charge.create(
:amount => params[:amount], # this number should be in cents
:currency => "usd",
:source => params[:source],
:description => "sample"
)
rescue Stripe::StripeError => e
status 402
return log_info("Error creating charge: #{e.message}")
end
status 200
return log_info("Charge successfully created")
end
and my question is how to pass json value after creating successfully charge.
Any help is highly appreciated.
Many Thanks
If you want to return json response of the charge request, you can pass charge into body of response: