#NewtReyes-PaymentMethod
1 messages · Page 1 of 1 (latest)
That's great! feel free to come back if you have other questions
I am trying to update a payment method but I am getting the following error: You must save this PaymentMethod to a customer before you can update it.
Request ID?
Ah, it's OK I know the problem.
Basically you can't update a payment method unless it's attached to a customer
I am following this procedure:
- Create token: req_edyok7FMe6bpb7
- Create customer: req_R5khlMvRtjXVRm
- Create setupintent: req_Q6zDM8KcTCN5bM
- Try to update PM: req_9UrP65piKBUoHr
What am I missing?
Why isn't the PM getting attached to the customer?
Thought that including the customer id when creating the setup intent was enough
Let me check something one sec.
I noticed that you passed a on_behalf_of, are you setting up a payment method for a connected account?
Yes
And the customer that you passed in, was it created in that connected account?
Yes
Hmm, actually it's created in the platform, not connected account.
is that a prob?
Let us take a step back, what do you want to achieve here?
I want to be able to create a PM and update it
this is for testing an integration
I want to add some metadata to the recently created PM
and this PM is for platform or connected account?
For an express connected account
OK. Thanks for the context.
I've checked the setupIntent log, the status is still requires_confirmation, and that's why the payment method is not attached to the customer.
You should confirm (https://stripe.com/docs/api/setup_intents/confirm) the setupIntent, and the payment method will be attached to the customer if the confirmation is successful.
Alternatively, you can also set confirm=true when creating the SetupIntent (https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm), so that Stripe will attempt to confirm it when creating the SetupIntent.