#Mickey
1 messages · Page 1 of 1 (latest)
Hi there. What's the exact problem you're facing? Have you seen: https://stripe.com/docs/refunds?dashboard-or-api=api#issuing
Yes, I've gone through this and credit notes as well
But the invoice used with atomatic_tax=enabled
as mentioned via the link as:
If you’re using Stripe Tax and have automatic_tax = enabled for certain transactions, you must use credit notes to accurately shift the tax liability associated with a refund or PaymentIntent cancellation.
So what's the problem you're facing?
- Create a subscription with 1 item, $49.95
- Cancel the subscription sometimes after that
- Getting the unused amount using invoices.retrieveUpcoming()
- Use credit notes to refund the partial amount with tax
const line1 = paidInvoices.data[0].lines.data[0];
const creditNote = await stripe.creditNotes.create({
invoice: paidInvoices.data[0].id,
lines: [
{ type: 'invoice_line_item', invoice_line_item: line1.id, quantity: line1.quantity }
],
refund_amount: refundAmount,
});
Always got an error as:
Error: The sum of credit amount, refund amount and out of band amount ($56.27) must equal the credit note amount ($56.44).
This is how I calc the refundAmount
// Calculate the partial refund:
let remainCents = 0;
for (let i = 0; i < invoices.lines.data.length; i++) {
const invoiceItem = invoices.lines.data[i];
if (invoiceItem.period.start == prorationDate) {
currentProrations.push(invoiceItem);
remainCents += invoiceItem.amount;
if (invoiceItem.tax_amounts)
remainCents += invoiceItem.tax_amounts[0].amount;
}
}
const refundAmount = (remainCents < 0) ? remainCents * -1 : remainCents;
It seems to that It only accept the refundAmount exactly equals to the paid amount for that item originally
Hi 👋
Do you have an example on how to resolve this ? "If you’re using Stripe Tax and have automatic_tax = enabled for certain transactions, you must use credit notes to accurately shift the tax liability associated with a refund or PaymentIntent cancellation."
Hi Snufkin
Do you have an example Subscription ID I can look at?
It's much easier to work with a concrete example
sub_1MrhkeJxyI1MWs2TnllXsj1T
Please hold this so I am going be back after around 1 hour max
Threads will be closed after a period of inactivity but you can always re-ask your question. I would start with the Subscription ID and a crips description of the problem. I will share what I find in this thread though
This subscription was created ~3 hours ago and has not been canceled. I don't think this is a good example of what you may be trying to do so it' is hard for me to use this as an example.