Last active
August 29, 2015 14:20
-
-
Save dmuneras/fc5ef1022734b07f889f to your computer and use it in GitHub Desktop.
Refund deposit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Toco sacar utilizar un método más viejo que se llama .refund, pero en la API nueva sería
charge.refunds.create(..)