#Min.K
1 messages · Page 1 of 1 (latest)
Hi
Are you referring to this field?
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-client_reference_id
you should be listening to the event checkout.session.completed
https://stripe.com/docs/api/events/types#event_types-checkout.session.completed
So that you can get the Checkout Object with the client_Reference_id
For payment, it seems you only need to subscribe to checkout.session.completed and not the invoice.paid event.
However, for subscriptions checkout.session.completed only fires when the subscription is completed for the first time. After that, only invoice.paid is fired. Therefore, receiving two events for a subscription, checkout.session.completed and invoice.paid, is too complicated.
The recommendation is to map the associated Subscription with an internal record (via the client_reference_id)
Then when subsequent invoice.paid events fire, you can tie them to your internal record via the sub_xxx ID
@solid steeple
Thank you for answer.
But for subscriptions, when you first start paying for your subscription.
The invoice.paid event is sent first, followed by the checkout.session.completed event.
In this case, if there is no mapped data, when the invoice.paid event occurs, an HTTP 404 error is generated and Retry is performed.
If checkout.session.completed arrives later and mapping is done, then invoice.paid event is sent again, should we process payment completion then?
However, I know that the Retry interval of the Stripe webhook retransmits every hour, so this seems difficult to operate normally.
In the above scenario, what is the recommended integration method on the Stripe side?
The invoice.paid event is sent first, followed by the checkout.session.completed event.
Not always true, we don't guarantee event ordering so you need to account for that in your webhook logic
You can assume payment was successful and Subscription started if checkout.session.completed event contains payment_status: 'paid'
Then rely on invoice.paid for subsequent recurring payments
Thank you for answer.
Is Stripe's payment identifier pi_ (payment intent) correct?
Not sure what you mean by 'correct'?
The identifier of the subscription seems to start with sub_ .
I wonder if it is correct to start the payment identifier with pi_. (payment intent)
subscription identifier - sub_
payment identifier - pi_
is that right?
Yes, but I would recommend mapping the internal record (i.e. your customer) to the sub_xxx