#eunoia-subscription-shipping

1 messages · Page 1 of 1 (latest)

last dustBOT
harsh yew
#

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
dapper granite
#

eunoia-subscription-shipping

harsh yew
#

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

dapper granite
harsh yew
#

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

dapper granite
#

correct the first Invoice of a Subscription is always finalized synchronously so you can't do this

harsh yew
#

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.

dapper granite
#

yeah another Subscription could be created and pull it in or another Invoice. It's best to use what I recommended

harsh yew
#

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

harsh yew
#

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?

dapper granite
#

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

harsh yew
#

ok this has been helpful, thank you!

dapper granite
#

Sure thing!