Skip to content

Instantly share code, notes, and snippets.

@crifat
Last active September 17, 2017 15:48
Show Gist options
  • Save crifat/d673b2ffa0fc25cb91cdac49b5d9ebdb to your computer and use it in GitHub Desktop.
Save crifat/d673b2ffa0fc25cb91cdac49b5d9ebdb to your computer and use it in GitHub Desktop.
Refund a Stripe Charge
Stripe.api_key = ENV['STRIPE_CONNECT_SECRET_KEY']
begin
ch = Stripe::Charge.retrieve(self.charge_id)
r = ch.refunds.create(:amount => (self.amount * 100).to_i, :reverse_transfer => true, :refund_application_fee => true)
rescue => e
errors[:base] << e.message
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment