#matrix-webhooks
1 messages · Page 1 of 1 (latest)
I have a checkout session for one off purchases and for subscriptions. I would like to know which event I should monitor to confirm the payment was successful. I am currently looking for invoice.paid but it is not triggered for one off purchases (only for subscription)
I have seen there is also a payment_intent.success which is triggered in both cases
what is the best practise here?
there is also a checkout session completed event
checkout.session.completed yes
you can get all the other information you might want(like the PaymentIntent object for a single payment, or the Subscription object) by expanding (https://stripe.com/docs/expand) fields on the CheckoutSession object or making API calls while handling that event
it looks like checkout.session.completed is not triggered for subscription?
it is
well, assuming you are using Checkout to create the Subscription(as opposed to calling the Subscriptions API directly)
i am using connect
i am using checkout on a connected account using direct charges
have a look at this subscription pi_3K3SMJC3gxK3y4G91E4rkscf
i cant see any checkout completed in the logs
yep as it happens on the connected account's logs/events instead
you would set up a Connect-specific webhook endpoint : https://stripe.com/docs/connect/webhooks#connect-webhooks
that endpoint will receive the checkout.session.completed events
where can I see the checkout.session.completed in my dashboard
i can see the payment intent, the
invoice.created, payment_intent.created, etc but not checkout session completed
are you looking at your dashboard of the dashboard of this connected account?
it's https://dashboard.stripe.com/test/events/evt_1K3TWRC3gxK3y4G9NdGznPFJ in any case, it's on https://dashboard.stripe.com/test/events/ , if you're looking at the connected account's dashboard
i am logged in with my account but i look at the conneted account dashbaord
Here is where i see the connected account logs
I cant see a checkout session completed
maybe scroll up? Is it that event that is cut off at the top?
fair enough, I guess it's not shown
this one is for the subscription and it is the last log. there is not checkout session completed
anyway, it 100% exists, I gave you the ID and how to access it from a webhook. If you want to see it in the dashboard you have to fully log into the account, I guess the dashboard is weird sometimes
and then go to Developers>Events there
ok
I cant find any event in Developers>Event related to this subscription (5 Dec at 21 at 21:35). I can only see my events (for example when I charge my customer without connect or when i use connect but get an application fee). In the subscription example i referecned, i am not collecting application fees
sounds like you're not viewing the dashboard of the connected account
maybe because this is all a test?
click the button in '...' menu (when looking at the connected account in your own dashboard) that I showed above
and then you'll be in their dashboard and can see their events
it's nothing to with this being in test, it all works the same in test and live mode
I get it now
now i can see all events
i need to log in in their account as my company
thanks I have learned something
anyway I don't think checkout completed is good event to confirm the user has paid, right? checkout completed just mean the payment was authorized but not paid
what is the difference between invoice.paid and payment_intent.succeeded?
does invoice.paid trigger automatically when payment_intent.succeeded?
checkout completed just mean the payment was authorized but not paid
that's not true no
checkout.session.completed is the event you want. It's triggered when the customer has finished paying on the Checkout page, the payment is complete. The doc I linked in my first reply(https://stripe.com/docs/payments/checkout/fulfill-orders describes it in detail)
one is for one when an Invoice is paid and the other is for when a PaymentIntent is paid. An Invoice might have a PaymentIntent(if the invoice requires payment; not all them do), it's the PaymentIntent that processes the payment.
if the invoice requires a payment, then yes. But sometimes an invoice can be for $0(for example a trial period or a coupon) and in that case invoice.paid happens but there's not PaymentIntent
ok very clear, thanks
the only thing I am not sure on is the checkout event. In the page you sent, it is written that the payment can fail
BUT i see it is related to certain payment methods. Shall i then assume that IF I use cards, then checkout completed == payment done?