#whizyyy_best-practices
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/1379067323553677403
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
when an invoice is created on a subscription created, it is never in draft, its directly "open".
that's correct
can you clarify:
- how are you creating the Subscriptoins? with the Subscription endpoint, Checkout Session, something else?
- what exactly do you want to change on the invoice?
- They are created from a checkout session
- The footer, for legal purposes
Here is my current code for more context:
case "invoice.created" -> {
final Invoice invoice = (Invoice) stripeObject;
if (!invoice.getStatus().equals("draft")) {
LOGGER.warn("Invoice '{}' is not in draft status, ignoring event", invoice.getId());
exchange.sendResponseHeaders(200, 0); // 200 OK
exchange.close();
return;
}
if (thereIsTaxesInThisInvoice) {
invoice.update(InvoiceUpdateParams.builder()
.setFooter(
"""
TVA non applicable โ art. 259-1 du CGI
No VAT charged โ art. 259-1 French GTC
"""
).build());
LOGGER.info("Updated invoice '{}' to include no VAT footer", invoice.getId());
}
exchange.sendResponseHeaders(200, 0);
exchange.close();
return;
}```
So I am ignoring invoices that are not in "draft", because like the documentation said "invoices can only be edited in draft"
My issue is, it is not updating the invoices generated from a subscription creation, in this case
then you could set the footer on the Customer obejct directly: https://docs.stripe.com/api/customers/update?api-version=2024-09-30.acacia#update_customer-invoice_settings-footer
then all Invoice for tha customer will include the footer, no need to update any invoice this way.
but I do not know if the customer is paying VAT in advance
the footer should only be present in invoices that doesnt have VAT
Got it
the only way to have the first invoice of the subscription in draft mode is to use Subscription Schedules: https://docs.stripe.com/billing/subscriptions/subscription-schedules
but you can't use this with Checkout Session
So what should I do?
if you really need the first invoice to be in draft, then you need to use Subscription Schedules
I wonder if the invoice's footer can be edited, even in open mode?
no that's not possible after the invoice is finalized
Thats kinda bad
actually there is this: https://docs.stripe.com/invoicing/invoice-edits