#Marroco-webhooks
1 messages ยท Page 1 of 1 (latest)
Hey Toby
I have a question Im using webhook right now in my localhost
So I use ngrok to simulate that is online, I make the stripe listen --forward-to ...
and it works perfectly with ther events
my question is, in order to make this work in my production enviroment
I need to instal CLI stripe on my server or I just run that command on my local host
and how do I know that stripe knows whitch is my webhook route and always use that for sending updates
No, for production you should not be using the CLI to listen for events. You should have an endpoint that you build that is expecting these events and is specifically built to handle them. The CLI is just an option provided to help make testing faster and easier.
Go it, so if my CLI is working I can change the keys
push to production and follow this
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
to add my endpoint
If the events are working as expected, and you move your event handling code to an endpoint, then yes you're exactly right. You'll register your endpoint, and then update your event handling code so it uses the signing secret for that endpoint.
One Question if a payment intent of a customer didnt pass, the subscription status change?
Are you referring to the behavior when a recurring payment for a Subscription fails? If so, that is dictated based on the settings in the Manage failed payments section that you configure here:
https://dashboard.stripe.com/settings/billing/automatic
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
thanks that works, what is the event for tracking the subscription status
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
here I need to select the events but I dont see subscription
They're nested under customer, I think you're looking for customer.subscription.updated
If you scroll up from here, you can see the other subscription events that are available:
https://stripe.com/docs/api/events/types#event_types-customer.subscription.updated
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
thanks! with that and the previous configuration of subs I can handle if is cancel or not
and what event I should check if I want to know witch payment intent was refused of witch customer
payment_intent.payment_failed is a good event to listen for if you want to be notified of payment failures.
Subscriptions use our Invoice objects as well, so invoice.payment_failed is also an option. It has a bit more narrow scope than the previous one I mentioned since it only applies to Invoices.
but the only problem of the payment intent is that the payment intent object doesnt have the customer ID
so I cannot know witch customer has the card problem
Hey, Toby had to step out but I am catching up on this thread and can help in a minute
If the payment intent is from a subscription, and doesn't have customer populated on it, you can probably get that info via the invoice that the payment intent is from
The paymentintent will have an invoice field with and ID like in_123, if you retrieve that invoice you should be able to get any related subscription info
Hey Pompey so in order to know with customer his card got refuse or somwthing like that
I will need to go Paymentintent->Invoice->Customer ?
or there is another way to do it faster
Can you tell me more about what info you are looking for on these failures?
I just want to have make an alert in my backoffice so if a payment for a subscription fails it will automatically alert us
to call our customer before it will automatically cancell the sub
Gotcha, invoice.payment_failed should be the event to listen to then. It will have info on the payment and the subscription that you can use