#crazyPixel-question

1 messages · Page 1 of 1 (latest)

gaunt dust
#

Hi!

#

Ask your question here and I'm happy to help.

sturdy field
#

Hi @gaunt dust thanks! I've just started with stripe and I'm trying to understand a few things related to the integration part

#

I have a web app with 3 different plans where the first is free

#

I created products with prices for the other 2 plans on stripe and started working on the integration

#

since a customer on my app can already be registered I can simply create the client entity on my backend correct?

#

I mean for an already registered client I can collect all the necessary metadata to send back to the client for the user to pay through stripe checkout

gaunt dust
#

Yep that works fine

sturdy field
#

OK, now for something I can't really get

#

I have different limits within every plan

#

What happen when a subscription term ends? in my case a month

#

stripe tries to charge the client again and simply uses the provided webhook to notify me with results?

#

I'm asking this because I'm trying to understand how to reset different limits attached to plan. I think that I can simply do it when I get notified from stripe but I'm not sure

#

also what happen if the user upgrade or downgrade his plan? the same webhook is activated?

lime relic
#

Hi, I'm stepping in for @gaunt dust Gimme a sec to catch up

sturdy field
#

np, thanks alot!

lime relic
#

What do you mean by

I have different limits within every plan

sturdy field
#

Different rate limits

#

So for example the free plan will have 1k requests the starter plan have something like 10k and the premium 1m

#

requests as in requests to server to get data

lime relic
#

So to answer the Webhook question, yes both changes to the subscription will trigger the event you referenced.

sturdy field
#

And a new subscription creation will also trigger the same event?

lime relic
#

Slightly different to notify you a new subscription was created

#

Since you said you are just getting started, have you had a chance to play around with the Stripe CLI?

sturdy field
#

Also - is it more common to also create my free plan as a product so upgrade is done via the same webhook? and - is there a better way to do tiered based plans in stripe?

lime relic
sturdy field
#

Not yet, I'm still going over the docs

#

so mostly reading

lime relic
#

Well you are already discussing webhooks a fair amount so i thought I'd recommend playing around with it. It will allow you to stream webhook events to your local development environment and trigger events manually when you want to test how they behave

sturdy field
#

I'll def give it a go

#

about plan change - is it common to create free plan also in stripe (as a product)? and is there a better way to create tiered plan in stripe? like aggregating different products under something or something similar to it?

lime relic
sturdy field
#

I'll look into that

#

but it looks like it's based on volume or unit, my plans kinda have a "built structure" so to speak

#

like -
free - 1k requests, 10 objects, 1 user
starter - 10k requests, 100 objects, 3 users
premium - 1m requests, 1000 objects, 20 users

lime relic
#

Okay then that is something you would need to manage on your end and use distinct Price objects in Stripe for each tier. We try to cover the general use cases but can't cover them all

sturdy field
#

I see

#

ok thanks a lot!

#

so just to iterate - on subscription renewal and subscription creation I'll get the event of "customer.subscription.updated"

lime relic
#

On subscription creation you'll get a customer.subscription.created event firing

sturdy field
#

So the one I mentioned is only fired when the subscription is renewed (at the end of the last term)

#

?

lime relic
#

No, it's fired any time the subscription is modified

sturdy field
#

oh whoops my bad - the "invoice.created" is the one to be sent once the subscription is renewed

lime relic
#

This is where I recommend you play around with the Stripe CLI and both stripe listen and stripe trigger. You can trigger these events and see how many other webhook events fire as a result.

#

It's really useful to see what data you are going to receive