#firebalsi
1 messages · Page 1 of 1 (latest)
Hi, let me help you with this.
I am not sure if there's an example somewhere but it should be possible.
The customer will be charged when you confirm the payment.
Are you following any guide for integrating ECE?
Hey, thank you so much. I am currently following https://stripe.com/docs/elements/express-checkout-element/accept-a-payment
You might need to ask Stripe Support to enable Subscriptions with PayPal for your account: https://support.stripe.com/?contact=true
Ah I see, this is not enable by default?
In this step, instead of creating a PaymentIntent, you create a Subscription and use latest_invoice.payment_intent.client_secret: https://stripe.com/docs/elements/express-checkout-element/accept-a-payment#create-pi
The docs say "Recurring payments - Requires approval": https://stripe.com/docs/payments/paypal
You can try doing this and if PayPal doesn't show up, you can ask Stripe Support to enable this for you.
You will also need to change mode: 'subscription' here: https://stripe.com/docs/elements/express-checkout-element/accept-a-payment#set-up-elements
Regarding this, currently in the onConfirm callback I am using stripe.subscriptions.create() function to create a subscription that would instantly charge them for the first month, with also a lot of product/subscription information.
In this onconfirm callback do I need to send back a client_secret of some sort?
When you just create a Subscription without a Payment Method, it can't charge them instantly. You will need to pass the client_secret to the frontend and confirm it. So the frontend code remains mainly the same.
Alright thank you so much, I think I understand.
So in the onConfirm callback we would have to create the payment method based on the expressCheckoutElement, then we can create a subscription using subscription.create() and we send back the "latest_invoice.payment_intent.client_secret" we just revieved after creating the subscription. Then we need to call confirmPayment and prive it with the client secret.
Would the confirmPayment function als trigger the user being redirected back to website from the wallet or would they be redirected earlier in the process already?
And does this seem correct or am I maybe missing something?
generally it would redirect them, to the return_url you pass. To be honest I haven't built this exact flow myself yet so I don't have good intuition for how the pieces would fit together
but in general the correct way to start subscriptions on Stripe is to create the Subscription first and then confirm the latest_invoice.payment_intent.client_secret on the frontend yes
Alright, thank you. Then I will test this out with the ExpressCheckout element and hopefully it will work with this element as expected