Replies: 3 comments 3 replies
-
Each payment processor works differently, so that's probably getting pretty nuanced to a single processor? You can always add that functionality with your own webhook listeners too if you wanted a separate refund table. If it's important enough, we could add another model. Each one we add makes it harder to maintain and the intention of Pay is to keep things as simple as we can. |
Beta Was this translation helpful? Give feedback.
-
I kind of see it as being transaction related across all providers that support the idea of refunds, like double entry book keeping except in this case it doesn't need to always equal $0, but it's an idea that:
Would be an audit log of events associated to the original purchase. I was thinking this info could be useful to provide to a user in the form of an invoice. Like let's say someone purchases your Stripe course and you partially refund them $20 for whatever reason. It would be really nice to be able to render an invoice from your local DB where both the initial charge and refund become separate line items with dates, etc.. This way they could use that invoice when calculating their business write offs for taxes. Technically you could make a case that the date of the refund isn't important for that but to display an accurate UI to a user that they're using for official taxes, having the date is handy to boost confidence.
In this case Pay will also write the refund amount to the
It might be doable without a new model, just a new column on the existing Charge or Subscription models. One that shows the status of the payment which could be |
Beta Was this translation helpful? Give feedback.
-
I implemented this for Stripe in cd09ed7 🎉 Braintree, Paddle, etc will probably not receive this functionality. |
Beta Was this translation helpful? Give feedback.
-
I was playing around with Pay using the fake processor and I noticed that (1)
pay_charges
row will be created in the DB for transactions that include both a payment and refund. If you partially refund a payment 3 times, you still end up with (1) row where theamount_refunded
continues to increase.I kind of anticipated having separate rows for payments and refunds but maybe I'm overthinking things? My use case was thinking it would be nice to know the date of when each refund happened on a payment and we can't definitively depend on reading the
updated_at
time of the charge to get that information. There's also maybe the application fee being adjusted on a per refund basis (partial)?But if there were a row for each refund then we would have the complete information about each individual refund and then you could also query a charge to get it along with any optional refunds. This would potentially match what Stripe provides you when you export payments in CSV format. There's individual rows for
Paid
andRefunded
.I didn't configure the Stripe payment provider yet in this gem, perhaps it saves a list of refunds as
data
in the single charge row? I would have tested this but it wasn't super clear on how to get this gem to work with Stripe Elements for 1 off charges.Beta Was this translation helpful? Give feedback.
All reactions