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.

Revisions

  1. Rifatul Islam Chayon revised this gist Mar 5, 2017. No changes.
  2. Rifatul Islam Chayon revised this gist Mar 5, 2017. No changes.
  3. Rifatul Islam Chayon created this gist Mar 5, 2017.
    8 changes: 8 additions & 0 deletions stripe_refund.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    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