Reputation: 4616
I am integrating stripe to enable the user to subscribe to a physical product shipping to the US and Canada.
I want to use the invoice.created
webhook to modify the invoice and add a shipping charge depending on the delivery address.
The problem according to stripe docs is that the first invoice is charged immediately, implying that I cannot modify it prior to the first charge as I could with the subsequent.
If this is so, then the only way around this I believe is to add plans for us and canada for each of the subscription intervals e.g product-weekly-us
, product-monthly-us
, product-weekly-ca
, product-monthly-ca
instead of just product-monthly
, product-weekly
The shipping would then be static (no line item) and part of the total.
Edit
So looking into invoices from koopajah
's answer, here is what I can work out (please confirm):
invoice.created
webhook, which you would have to inspect and ignore - would you have to track the invoice numbers? **edit: oh wait! It would be closed, so you can just check that :D **invoice.created
webhook for open invoicesUpvotes: 2
Views: 1722
Reputation: 25622
If you want to keep using Invoice Items you just have to create one for the first cycle before creating your user subscription. Then once the subscription is created the first invoice will be created and automatically pick up the Invoice Item for your current customer.
You can then create the next Invoice Items in the webhook as you planned to do.
EDIT: The steps would be something like that:
invoice
parameterUpvotes: 7