#TayZ

1 messages · Page 1 of 1 (latest)

torpid harnessBOT
left patio
#

Hi there, is there reason why you don't want to listen to checkout.session.completed event?

grizzled sail
#

Hi Jack! We're using a subscription creation payment so we saw that it's triggered with an invoice.paid

grizzled sail
left patio
#

I don't see a way to retrieve the checkout session from invoice or subscription. What data you want to get from a checkout session object?

grizzled sail
#

Oh I see. I need the client_reference_id

left patio
grizzled sail
#

Ah got it thanks taking a look

#

A follow-up question, for future invoice.paid when people pay for next month's subscription

#

is payment_intent unique to a single customer?

left patio
#

Yes, in fact payment_intent is unique for each invoice that a subscription generates

grizzled sail
#

Got it thanks for confirming!

#

So if I use payment_intent to map unique payments I should be good

#

I'm getting checkout sessions using payment_intent

#

Does that mean those checkout sessions are unique too?

left patio
#

Yes, checkout sessions are unique (i.e., one checkout session generates one subscription)

grizzled sail
#

Got it awesome

#

thank you

#

So just to make sure I understand correctly:

#
  1. on invoice.paid event each month for a customer, I get the paymentIntent
  2. then I get the checkout sessions using the payment_intent
#

one strange thing I saw though on Stripe was if I click payment_intent, it maps to a lot of customers

#

I might be confusing something though, but wanted to double check!

left patio
#

2) then I get the checkout sessions using the payment_intent -> No, you can't get the checkout session from the payment_intent, because the payment_intent was created by the invoice. But you can get the checkout session for the subscription (https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-subscription), sorry I was wrong earlier, there is way to retrieve a checkout session from a subscription.

grizzled sail
#

Ah I see

#

I'm curious what this is doing stripe.checkout.sessions.list({ payment_intent: paymentIntent })

#

Theoretically I'm not supposed to be able to get the checkout sessions, so is it getting the old ones

left patio
#

That's for retrieve the payment mode checkout sessions by the payment intent that the checkout session created.

grizzled sail
#

Ah got it thanks