For custom checkout you need:
Server side:
Create a server action.
Add a Create Payment Intent Template:
Setup its options - amount, currency and enable Automatic Payment Methods:
Done, save the server action
On your page
Add the server action component and select the one you just created, with the payment intent inside:
Add Stripe Elements component. Add your Key and set the Flow to With Intent. For client secret we need to get the value from the server action:
Pick the client_secret
returned:
Add the Stripe Payment element. Set its properties:
And add regular button, that will be used as a pay button. On click add to it an inline flow:
In the flow add Stripe > Confirm Payment step:
Enter a Return URL, this can be static or dynamic.
After a payment you will be redirected to your Return URL like this:
https://localhost/some_page.html?payment_intent=pi_3PVXBhGRWPyyxDyv1SP24qu1&payment_intent_client_secret=pi_3PVXBhAAAAyyxDyv1SP24qu1_secret_6gimxDFcKjBkJBBB9ubKDqGp2&redirect_status=succeeded
That's pretty much it.