#mathiasm8

1 messages ยท Page 1 of 1 (latest)

tidal valeBOT
hard hearth
nimble anchor
#

const creditNote = await stripe.creditNotes.create({
invoice: gymInvoice.stripeInvoiceID,
reason: reason,
memo: memo,
refund_amount: refund,
shipping_cost: {
shipping_rate: null
},
});

#

Thats how I create a creditnote

hard hearth
#

And you haven't set any shupping related things on this invoice otherwise?

nimble anchor
#

I have no shipping cost at my invoice

#

Nope

hard hearth
#

What happens if you completely leave shipping code out?

nimble anchor
#

I'm not sure if its the invoice same error

#

So it could also be the lines that causes the error

#

The line items

#

The same error occurs if I remove the shipping code.

hard hearth
#

Can you send me the ID of a request where you are getting this error? (req_123)

nimble anchor
#

'req_vUxGrFr4iyO6pN'

hard hearth
#

I'm getting the same error, wondering if one or the other is always required

#

I thought they weren't but will double check

nimble anchor
#

If line items are required I think the APi documentation needs an update ๐Ÿ™‚

#

I think it needs the lines

#

Now I get an error: The sum of credit amount, refund amount and out of band amount (350.00 kr) must equal the credit note amount (439.00 kr).

#

After I added the invoice line items

#

But why can't I credit (350) of the total invoice of 439? Can one only credit the entire invoice?

hard hearth
#

So I was just able to create a note without invoice items by providing an amount

  amount: "350",
  refund_amount: 350```
#

So I think the error may need a rework. My guess is that we use line items or shipping cost to set an amount if one is not provided

nimble anchor
#

Ahh so it needs both an amount and refund_amount?

tidal valeBOT
hard hearth
#

Correct

nimble anchor
#

It worked for me as well. Then the "Amount" in the docs might not be optional at all? ๐Ÿ˜›

hard hearth
#

I think it is that we need some total to go off of to make sure the math on the other amounts is correct. So maybe that error would more accurately say that it needs amount, lines, or shipping_cost

#

Glad it is working now!

nimble anchor
#

Ahh okay.

#

Thanks for great support once again ๐Ÿ™‚

#

Have a nice weekend.