#maks.piechota
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Yes in that case you would receive Subscription related webhooks
There are a number of different webhook events associated with Subscriptions so you can remain informed of changes to a customer's subscription
So if I want to fill up my users account with some tokens, every time the subscription fee is charged, then I should look for what? invoice.paid webhook?
The invoice.paid webhook event will be fired each time an Invoice is successfully paid. This event will return the Invoice object so you examine it to find the Customer ID as well as the billing_reason, while will help you keep track of manual invoices, new subscriptions, and subscription renewals
ok great
I can see the stripe's customer gets created when checkout is successful, but how would I identify which user of my system this webhook corresponds to?
I can see I can pass some reference to createCheckoutSession
but I will get this info only in checkout.successs webhook
can I create the user manually and assign my custom reference id to this object?
That depends on how you configure Checkout. You can pass the customer_email parameter and the Customer object that gets created in Stripe will have that email
and then query for it
oh ok, this makes sense
but still
can I assign some custom reference to the stripe customer obj?
Not during the Checkout flow. But you can create the Customer before the Checkout Session and then use the Stripe Customer ID when creating the Checkout Session
yes
this is the idea
but can I query for the stripe customer using my id?
not the stripe customerId
You can filter the Customer List API by email https://stripe.com/docs/api/customers/list
or you can use the Search API and filter on a metadata value, like custom Customer reference: https://stripe.com/docs/api/customers/search
ok
but if I provide my own email
to the checkout session
like you have suggested
then I will receive this email value
in every consecutive webhook
that whould be enough
ok that was constructive
thanks!
another question
why CLI command
stripe trigger checkout.session.completed
creates some products in my stripe account? And how do I delete them permanently so I don't receive them in the listProducts call
This is because a Checkout Session requires a product. The trigger will create all the necessary objects in order to trigger the event
can I configure it to use one of the existing?
If you want to write your own fixtures, which determine what the CLI does. You can read about using your own fixtures here: https://stripe.com/docs/cli/fixtures
You can delete them https://stripe.com/docs/api/products/delete
Well, wait you can only delete a Product if it has no price associated with it
But I think the fixture creates a Price for the Product
These are all created in your account in test mode.
ok can I delete the price and then the product manually, using dashboard?
or api only?
You cannot delete the Price
You can clear all test data in one shot but that is the only option
Through the dashboard here: https://dashboard.stripe.com/test/developers
ok I see
ok
can you explain me one more thing
the difference between invoice.paid and invoice.payment_succeeded
Invoice paid includes payments that did not go through Stripe. Payment succeeded is for payments processed through Stripe
Any invoice you mark as paid_out_of_band