php - How to Retrieve Customer's ID from Stripe after Subscription payment is Completed

one text

I was using stripe Integration Builder (https://stripe.com/docs/billing/integration-builder) for a subscription payment mode, and then there is this file create-checkout-session.php in which you can set the customer email and several other stuff.

But with this, the customer in Stripe is created at the same time the subscription he chooses is created and the payment completed. I've looked and there's webhooks in which I believe you can set it to send the Stripe Customer's ID back to the website. But is there any other simpler way to get that back? I haven't found anything similar to a function that is called when the payment of the subscription is completed (and successful).

The only other way i've thought would be to first create a customer manually using Stripe's API (https://stripe.com/docs/api/customers/create?lang=php) and then after, in the create-checkout-session.php file, setting mannually the customer's ID (https://stripe.com/docs/api/checkout/sessions/create?lang=php).

But is there a simpler way to retrieve the Customer's ID after he completes the payment and his account is created automatically in Stripe? (like a function that stripe has that is called after the user completes the payment...) So I can save the Customer's ID in a database.

Ps: I'm using PHP in the backend.

Source