For a successful payment, how can I find the related checkout session ID given the payment intent ID?
In that case you would just use the Checkout Session List API and pass in the Payment Intent ID for the payment_intent
parameter. That will return an array with the related Checkout Session in it.