#deland_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1326058464560156692
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
# Cancel out existing invoice charge
stripe.InvoiceItem.create(
customer=customer_id,
invoice=invoice_id,
amount=-(amount_due), # Negative amount = credit to user
)
# New invoice item w/ reduced fee
stripe.InvoiceItem.create(
customer=customer_id,
invoice=invoice_id,
amount=new_total,
metadata={"info": "Update payment for recurring fee"},
)
# Finalizing triggers 'invoice.paid' where we transfer the Renter's payment to Host
stripe.Invoice.finalize_invoice(invoice_id)
What's the invoice ID?
in_1QcTPQAHIrtkyTaBK1ScZRFl
And what do you mean by "cancel out the default item line " ? is it about removing a line item?
Yeah, I spoke to Stripe Devs a while back and they advised me to just create a negative item line to "remove" an invoice item.
Ok, looks like you did it https://dashboard.stripe.com/logs/req_u3UurkRwNT7APH
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Haha i think thats the wrong link
And I don't see any other request to create a new inovice item
That's strange, it's worked for every other invoice we've had. So that's why I was wondering if there was a race conditon in the code I pasted above.
It should have created a new line, but instead it left it as $0 for the amoutn due
No, there were only 2 requests for this invoice
- req_u3UurkRwNT7APH created the negative invoice item
- req_rerdDSITK5Prso finalized it.
You'll want to check your code and figure out why it doesn't create a API request forr the new invoice item.
Hmm okay, thanks for the info. So I don't need to worry about a race conditon when I modify invoices? Should I just remove the finalize section and let Stripe auto-finalize instead?