#Mickey

1 messages · Page 1 of 1 (latest)

tranquil geodeBOT
tardy bolt
lavish creek
#

Yes, I've gone through this and credit notes as well

tranquil geodeBOT
lavish creek
#

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.

tardy bolt
#

So what's the problem you're facing?

lavish creek
#
  1. Create a subscription with 1 item, $49.95
  2. Cancel the subscription sometimes after that
  3. Getting the unused amount using invoices.retrieveUpcoming()
  4. 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

arctic elbow
#

Hi 👋

lavish creek
#

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

arctic elbow
#

Do you have an example Subscription ID I can look at?

#

It's much easier to work with a concrete example

lavish creek
#

sub_1MrhkeJxyI1MWs2TnllXsj1T

#

Please hold this so I am going be back after around 1 hour max

arctic elbow
#

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.