Skip to content

Instantly share code, notes, and snippets.

@dmuneras
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmuneras/fc5ef1022734b07f889f to your computer and use it in GitHub Desktop.
Save dmuneras/fc5ef1022734b07f889f to your computer and use it in GitHub Desktop.
Refund deposit
#Refund deposit
deposit = Subscription.find(<id>).billing_items.reject{|item| item.amount != 1000 }.first
invoice_id = Stripe::InvoiceItem.retrieve(deposit.stripe_invoiceitem_id).invoice
charge_id = Stripe::Invoice.retrieve(invoice_id).charge
charge = Stripe::Charge.retrieve(charge_id)
refund = charge.refund(amount: deposit.amount,reason: "requested_by_customer")
@dmuneras
Copy link
Author

dmuneras commented May 7, 2015

Toco sacar utilizar un método más viejo que se llama .refund, pero en la API nueva sería

charge.refunds.create(..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment