#jeffnv-schedule-sub-update
1 messages ยท Page 1 of 1 (latest)
Hey bismarck!
Sure can! Take a read through https://stripe.com/docs/billing/subscriptions/subscription-schedules
Sure thing!
ooh nice, it looks like I can backdate a subscription too
could I use this to update a subscription retroactive to the beginning of the current cycle and charge them immediately?
Yes, you can do that without Subscription Schedules as well. Just need the Subscription API for that
Hrmm not exactly sure what you mean by that last part
ok so i have 2 subscription products
license, and upgrade pack
everyone has 1 license
but people can add/remove upgrade packs
minimum of 0
if on day 1 I start with zero, day 10 add 1 pack, i'd like to charge them on day 10
and on day 20 they decide they dont' want it, refund on day 20
however many they end the month with should be recurring
Hmmm
but the critical rule is that whatever change you make mid month, you pay or are refunded right then
You can't really charge here without changing the billing cycle anchor
right that's what I observed
workaround i was going to do was to have another product, an ad-hoc product that we charge them for right then
You would use one-off invoices for this
and upon success set the schedule
And add invoice items
So you create an invoice item, then create an invoice with subscription set: https://stripe.com/docs/api/invoices/create
ok! so i can invoice them for the ad-hoc non-recurring product
Right
I don't understand the subscription key
how is this related to a subscription? is it not just a customer?
It will link the invoice into the Sub
So when you view the Subscription you will see that one-off invoice as well
You don't have to do this
But if you want to keep it all together you can
oh ok, but when i query the subscription i can see the invoice
Right
yes that was a big problem i was having, after checkout completed i couldn't figure out what was purchased
i could only see that customer cus_1234 paid 1000
but for what?
Well there are various ways to solve that
๐
The most common way is to use metadata
You attach metadata to your flow to link to an order ID
So that you can reconcile with your database and handle fulfillment
Yeah so you likely want to set metadata on the Subscription. So you can do that by setting it at subscription_data.metadata: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata
This will carry the metadata down to the Sub object
and ultimately this will be posted to me in a webhook?
checkout session complete or something?
It will come through on the customer.subscription.updated webhook.
You could also set the metadata at the Checkout Session level: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata
Which would come through via checkout.session.completed
ok ok!
So just depends on what you want to listen for and how you want to handle your data
im used to just inspecting the subscription items
unfamiliar territory for me
ok you've given me lots of new tools thank you
im sure I'll be back again!
CEO want's it 'just so'
Sounds good! We'll be here