#shaun-subs
1 messages · Page 1 of 1 (latest)
No, there isn't a way to attach a Payment Method to a customer from a client-side request. You can only do it from a server request
So the publishable key is purely just to tokenize the payment method? And so we would send a payment method id to the backend?
And attach it there?
It depends on what you're trying to do, a common flow is that you create a Payment Intent with customer and setup_future_usage set. Then once that Payment Intent is confirmed client side, the created Payment Method would automatically be attached to the customer - but again, you need to set customer and setup_future_usage server-side to work
If you have a flow where you're just creating the Payment Method client-side and not confirming an Intent, then yes, you'd have to first create the Payment Method client-side and send it back to your server to be attached
for our use case we're trying to create a subscription and accept payment via web?
so wondering which flow would work in that scenario
Our general recommendation is that you collect the Payment Method while you're confirming the associated Payment Intent that is associated with the first Invoice of the subscription. We go through all of that here: https://stripe.com/docs/billing/subscriptions/elements
shaun-subs