#eunoia-subscription-shipping
1 messages · Page 1 of 1 (latest)
our service works as follows
- we take an initial request for a product and shipping options (standard, 2 day, or 1 day) during our checkout
- this request is vetted and a final set of products is approved asynchronously after the checkout
- once this request is approved, we create a Stripe subscription for the final products and charge the customer for those products, plus shipping
- we only want shipping to be applied to the first invoice of the subscription
eunoia-subscription-shipping
I can post some details of the approaches we've tried so far if it is helpful, but wondering if there is a recommended approach to this outright
We don't really have shipping on Subscriptions. The best option is to use https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items to add a one-off InvoiceItem for shipping to the first Invoice
ok great, so that is the approach we've been circling around
so initially what we tried was to respond to Stripe's invoice.created webhook.
we would look up in a record table on our end whether the created invoice is associated with a shipping charge and, if so, amend the created invoice from the subscription with an to include a new invoice item for the shipping rate
this did not work because the invoice became "uneditable" when it was generated from a subscription creation
correct the first Invoice of a Subscription is always finalized synchronously so you can't do this
we've adjusted this process now to the following:
after a checkout and set of products has been asynchronously "approved", but before we create the subscription in Stripe for those products, we first look up shipping and create an invoice item for the customer, with the understanding that that invoice item will be applied to the next invoice created for that customer. After creating the invoice item, we immediately create the corresponding subscription. The "shipping" invoice item should then get applied to the invoice
while this appears to be working, we're concerned that because the invoice item is not getting explicitly tied to an invoice or subscription, there could be a circumstance we're not foreseeing where a customer has the shipping charge applied to the wrong invoice.
yeah another Subscription could be created and pull it in or another Invoice. It's best to use what I recommended
taking a look
oh, sure - so the reason this wouldn't work as we have it designed right now is that the shipping rates are not discrete Prices in stripe - we have them stored in our own database and we were creating the invoice_items and supplying the amount and description values from our back end
otherwise we would have to create unique prices for each shipping rate for each geographic region that we support
I was looking at that yeah, so this would let us dynamically generate a price on the subscription as long as we had a parent "shipping" product
it doesn't look like we can pass through a description though? so would the line item just say "shipping" and the price, without any other context?
oh maybe we could update that after the fact on the subscription?
you can't really update it after, at least I wouldn't recommend it. You could always create a new Product just for it each time I guess
ok this has been helpful, thank you!
Sure thing!