#lobsterpizza18
1 messages · Page 1 of 1 (latest)
Yeah charge.succeeded is not really the relevant event here
but why is it triggered during subscription flow
The recommendation generally is to listen for checkout.session.completed events. However the payment_intent_data.metadata won't be available on that object/event, instead you'll want payment_intent.succeeded there
Because there was a successful Charge, sure
But the fields/parameters you're setting aren't passed to the underlying Charge object
oh does it mean it will be triggered for both flows and its ok ?
Yes whenever there is an actual payment, be that one-time or recurring, charge.succeeded will fire
thanks for helping. just trying to understand which event I can listen for one time payments and subscription ones where i can access metadata
mode: 'payment' -> payment_intent.succeeded
mode: 'subscription' -> customer.subscription.created
I've used charge.succeded for one time payments to update my SaaS backend and allow user to access it. wonder if its the correct event and what to use for subscriptions. really need that metadata 😦
ok great, let me check!
If you set subscription_data[metadata] when those key/values will be on all related invoice.* events too: https://stripe.com/docs/api/invoices/object#invoice_object-subscription_details-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok great, heaps! now i see metadata is set on those events. Can I treat payment_intent.succeeded and customer.subscription.created events as final events to allow customers access my saas application ? I mean as long as I receive these events means they paid successfully
No, .created is not indicative of a successful payment. For recurring payments you should use invoice.paid as per link I sent above
thank you will check those now. appreciate your help
just checked payment_intent.succeeded, it doesn't include metadata 😦
What's the evt_xxx ID?
evt_
Well that's because it's a mode: 'subscription' session: https://dashboard.stripe.com/test/logs/req_5t7gGSRlSloV5T
You cannot pass payment_intent_data fields on creation. Instead you'd look at the invoice.paid event
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.