#Chhay-invoice
1 messages ยท Page 1 of 1 (latest)
I call API customer update to add the custom_field in order to add some information to the Invoice pdf.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You can add the invoice_settings.custom_fields to the customer before creating the subscription, so that the it'll be added to the invoice
We have created the customer while the user register.
that why, I can only use the customer update api
Before creating a subscription, you will also be able to call Customer Update API. Is there any reason why you can only update custom_fields after creating a subscription?
because of the user input form UI
the customer additional information to the invoice pdf are inside with the Checkout form
Ex:
Register Form
Email:
Pass:
FirstName:
LastName:
after the registration (has been create stripe customer), it'll redirect to the checkout form.
Checkout Form
CardNumber:
Expiry:
CVC:
CompanyName:
VATNumber:
Address:
so CompanyName, VATNumber, Address are the additional info to the invoice pdf.
Thanks for sharing the information
I'm afraid that the subscription always finalises the invoice immediately with collection_method=charge_automatically after creating a subscription
One way to delay the invoice finalisation of a subscription is to use Subscription Schedule which keep the invoice in draft state for an hour which you can update the customer field before finalising the invoice: https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing
We can't know if the invoice is successfully charge. how can we provide the user access the system then?
After the user successful charged, we will provider them to access the system.
Since we schedule the invoice around an hour to be charge.
why wouldn't you know? it will generate an invoice.paid webhook event when it's eventually paid, same as always.
I mean, we can't get the invoice.paid webhook immediately after the subscription successful. We need an hour to get the invoice.paid event.
indeed
then don't wait an hour, you can call the Finalize Invoice API directly and then attempt a payment. Depends what your requirements are.
or just do what I think I said yesterday, set your custom fields on the Customer object so they're automatically inherited to the first invoice so you don't have to try other things to delay invoice finalisation. Was there a reason that doesn't work for you?
so it means that, after we call the customer update api, we also can call the Invoice Finalize API in order to get the invoice.paid event immediately, right?
no, that only finalises the invoice, you also have to attempt to pay it after that (confirm the Invoice's PaymentIntent or call https://stripe.com/docs/api/invoices/pay)
but in general, yes, that's the overall idea