#ludvig-checkout-event
1 messages · Page 1 of 1 (latest)
@muted merlin that's because the CLI will trigger a session for one-time payments today. It's just to simulate the event and it does the most common use-case
One thing you can try is to change the "trigger" https://github.com/stripe/stripe-cli/blob/9519f6f1/pkg/fixtures/triggers/checkout.session.completed.json
you see how it passes payment_intent_data there for one-time payments? You could tweak the whole params hash to make it for a subscription
My advice though is to just test this manually in your app and not bother with that specific flow with the CLI
Yeah the problem is that real webhooks (even in test mode) of course requires a public accessible ip/domain
But I guess thats what I have to live with
When I already have you here. Can I ask you when invoice.paid triggers?
Because I’m going to use Subscriptions for my users and when they don’t pay the subscription I need to kick them/suspend them
it triggers when an invoice is paid, but you want checkout.session.completed for the first payment
and invoice.paid for future cycles yes
https://stripe.com/docs/billing/subscriptions/webhooks details subscriptions and events in details
Ok thank you.
checkout.session.completed = Subscription started
invoice.paid = Subscription renewed
and which webhook is it if the user doesn’t pay the invoice the subscription automatically creats?
Because If that is possible then I don’t have to store the subscription end date in my db
there wouldn't be a checkout.session.completed event in that case, the Session just wouldn't work
Wdym?
and which webhook is it if the user doesn’t pay the invoice the subscription automatically creats? are you refering to this sentence?
yes
I mean if the customer doesn't pay their future invoices.
The first invoice (which starts the subscription) is already paid if the checkout.session.completed event is triggered as I've understood it
correct, then next time you'll get invoice.payment_failed. Did you look at the doc I mentioned above? It explains this https://stripe.com/docs/billing/subscriptions/webhooks#payment-failures
@muted merlin YOu can use the CLI to solve for this with the listen command and --forward-to your local development server without needing an external address exposed
That’s what I do right now. It still doesn’t solve my issue with Subscriptions data is empty in return json
Based on what I can find on the pages you sent
After you create a test checkout session in subscription mode and complete the checkout flow?
It really should have a subscription in that case
(I'm not talking about using the triggers, i mean creating a session via the API and redirecting yourself, entering a test card etc)
Right now I’m using stripe listen —forward-to localhost and stripe trigger checkout.session.completed to simulate that event.
How do you mean I can do instead? Sorry I don’t understand
right, don't use the CLI and trigger
I mean, actually create a checkout session with your code or postman, and go through the checkout flow
How do you send customers through checkout?
I have a button on my website that redirects to your stripe buy link
and then listening on webhooks from that
Using Payment Links?
However you do it, just go through that flow yourself in test mode.
Either create a test mode payment link: https://dashboard.stripe.com/test/payment-links
Or a test mode checkout session & redirect
but i mean for you to go through the checkout flow, pay/signup using the 4242 credit card (or any other success test card) and finish checkout
you will then get an event in test most which will be sent to your CLI listen and forwarded to your server
I’m doing it this way - https://stripe.com/docs/billing/subscriptions/checkout
So I should just go through the checkout process (but with the 4242 card) and everything. And then the event should appear in my stripe listen terminal?
yep, exactly!
Did that work for you? I need to step away shortly, but can hand off to a colleague if you need more help