#whimsy_subscriptions-products

1 messages ยท Page 1 of 1 (latest)

silk moonBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1290662876809527378

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

velvet summit
#

and if we already have a subscription system in place, which uses checkout sessions and just provides line_items, how would we migrate that to products system so its least painful for users

mystic loom
#

What are you trying to do and what is not working like you expect

#

Subscriptions use Prices which refer to Products

#

In many (but not all) cases, Prices and Products can be defined ad-hoc using price_data and product_data

#

The order is generally:
1/ Create Products representing distinct goods or services you sell (Basic and Premium packages would be different products, assuming they have different features/access etc
2/ Create Prices for those products. Prices are, at minimum, a currency+amount+frequency for a given product.
3/ Create Subscriptions using those Prices for the subscription items

velvet summit
mystic loom
#

You'd use that API to create products

velvet summit
#

yes im talking about api whole time

mystic loom
#

There are separate APIs for creating products and creating prices

velvet summit
#

now it again doesnt make any sense

#

why do i have to create products, then prices, and then bind them to products

mystic loom
#

Because that's how the product and price model works

velvet summit
#

why can't i just use default_price_data on create product and be done with it?

mystic loom
#

prices refer to products

mystic loom
#

But looks like you can do that in the same request if you want, this will create a price for you for that product it appears

velvet summit
#

i mean i have like tier1 - 5$, tier2 - 10$ and if i just directly create them with 2 api calls its no worries

#

because i dont really want to deal with linking prices and stuff

#

im just confused why does price have to be made with a product, can't prices just be like for themselves, and then i link price to a product, but api requires product data when creating a price

mystic loom
#

api requires product data when creating a price
Generally I'd suggest providing a fixed product, instead of product_data

velvet summit
#

well when saying product data i mean both of those fields

mystic loom
velvet summit
#

tiers would be like different products, nothing more

mystic loom
velvet summit
#

not sure why does even price have to have product property

mystic loom
velvet summit
#

its like many-to-many relation

mystic loom
#

Its not many to many, its 1 to many

#

a price is for 1 single product. a product can have none, 1 or many prices.

velvet summit
#

well yes but to create a price you need (product/product_data), and to create a product you need (price/price_default_data) lol

mystic loom
#

create a product you need (price/price_default_data
No you don't, that an optional convenience to create a price using that product at the same time

#

you can create a product all by itself with no links to anything else

#

just like a customer

velvet summit
#

oh

#

that clears it

#

i was then tripping it says required

mystic loom
#

Where do you see that indicating it's required? If so, that seem to be a mistake I should get fixed.

velvet summit
#

upon closer look it doesnt, i was probably reading prices page the whole time, oops,

about the other thing, lets say i already have a subscription system right, and the way im making subscriptions is dynamic, so basically i use https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items (by just prodiving line_items and subscription_data), is there any way to migrate those subscrptions to a product based system?

#

when saying i use line_items, i mean i literally just specifly all

#

i would really like to switch that to product system so i just provide price of a product, but not sure how to migrate users who use old one

silk moonBOT
mystic loom
#

is there any way to migrate those subscrptions to a product based system?
Can you clarify what you mean here, or share an example? In Stripe lexicon, these items/prices would already have products defined by the product data you provided.

#

When you use price_data and/or product_data a corresponding price_123 or prod_456 object is create automatically. but it is also archived automatically so that it does not appear in your dashboard.

silk moonBOT
#

whimsy_subscriptions-products

velvet summit
#

and will anything change or

cerulean grove
velvet summit
cerulean grove
#

Depends on how what you set for proration_behavior when making the update, whether you're updating billing_cycle_anchor, and what you're referring to by "the user side".

You can use testmode and Test Clocks to test these updates and see exactly how they'll impact the lifecycle of your Subscriptions:
https://docs.stripe.com/billing/testing/test-clocks

Learn how to move Billing objects through time in test mode.

velvet summit
#

so if i set to proration_behavior to create_prorations when i update the price id for a subscription, they will be invoiced? and get a mail to pay or?

cerulean grove
#

Only under certain conditions does create_prorations result in an immediate Invoice:
https://docs.stripe.com/api/subscriptions/update#update_subscription-proration_behavior

Will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under certain conditions.
https://docs.stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment

Whether or not they get an email depends on the email settings for your account:
https://dashboard.stripe.com/settings/billing/automatic

Learn how to upgrade and downgrade subscriptions by changing the price.

velvet summit
#

hm

velvet summit
cerulean grove
#

No, you would need to implement your own logic for updating the Subscription and add an additional Subscription Item to it.

velvet summit
#

hm, you have any idea how would i do that? what i can think of is to just add the product to their subscription via api and make it directly invoice them, but that's a little unintuitive, i'd like something like checkout process

cerulean grove
#

That's exactly how I'd recommend doing it, by making a request to our API to update the Subscription with the changes you wish to make to it. If you set the proration_behavior to always_invoice as part of that update request, the customer is immediately invoiced and charged for the change.

velvet summit
#

how would they know they're charged exactly, is email notifications on by default?

#

or can i get that invoice pay link?

cerulean grove
#

Doesn't matter what the default behavior is, what matters is the email settings for your account. The link I provided earlier is to the dashboard settings page where you can view and edit your subscription-related email settings.

velvet summit
#

ah nice