#TheUchi007-events
1 messages ยท Page 1 of 1 (latest)
Hi ๐ could you clarify what you're referring to when you say "charge type"? I just want to make sure we're aligned.
Ok, so when I get to the payment_intent.succeeded event type, I can get some details on what the payment was for. It might not be charge type exactly, so I apologize if it isn't, but I do get a piece of info of what the payment was for. Whenever I buy a subscription, it returns "Subscription creation".
So my question is if I will always get that during payment_intent.succeeded, regardless of whether the subscription payment is for a new one, or renewing one
Would you mind checking what field it is that you're referring to? I'm afraid you're relying a field such as description that is an arbitrary value that is set by your integration.
Ah ok, got it. And yeah, it is the description one, sorry. Is a property named description on the event that is returning that
Is that something I have control over, all the way to payment_intent.succeeded event?
Yup, description is a field that you have control over.
If you're looking to take action for subscription based payments, then I would recommend listening to invoice.payment_succeeded instead. It will only be triggered for Invoice payments rather than all payments, and all Subscriptions will use Invoices. Additionally the Invoice object has a reference to the related Subscription.
You can use the subscription field to distinguish between Invoices related to a Subscription and ones that are not.
https://stripe.com/docs/api/invoices/object#invoice_object-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ah really? That is great! Thank you so much, I will try that!
that invoice.payment_succeeded will only be upon successful charge, right? In other words, it will only happen if a charge was successful and the payment goes through, right?
I just want to make sure it happens only when a user successfully makes a payment
Correct, invoice.payment_failed is triggered if the payment is not successful.
Awesome. I just tried it and it works super awesome! Thank you so much!
Having that subscription info in the event object really makes it so reliable to know if the payment was for a sub, or just a normal one
Thank you much!
Awesome, glad to hear that was helpful ๐