#mathiasm8
1 messages ยท Page 1 of 1 (latest)
Shipping cost is a separate parameter https://stripe.com/docs/api/credit_notes/create#create_credit_note-shipping_cost
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
Interesting the docs say "REQUIRED IF SHIPPING COST SHOULD BE INCLUDED FOR CREDIT NOTE" https://stripe.com/docs/api/credit_notes/create#create_credit_note-shipping_cost
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
And you haven't set any shupping related things on this invoice otherwise?
What happens if you completely leave shipping code out?
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.
Can you send me the ID of a request where you are getting this error? (req_123)
'req_vUxGrFr4iyO6pN'
I'm getting the same error, wondering if one or the other is always required
I thought they weren't but will double check
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?
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
Ahh so it needs both an amount and refund_amount?
Correct
It worked for me as well. Then the "Amount" in the docs might not be optional at all? ๐