#Corjan-setupintent

1 messages ยท Page 1 of 1 (latest)

ember rune
#

Hi there, can you share with me the setup intent ID?

broken pebble
#

seti_1K4LqPGzhgXG0QoU3Z2mqxmN

#

This object has been created with all defaults. Only added the payment_method_types field to support the ones I want

#

After doing something like this: $this->stripeClient->setupIntents->update($id, ['customer' => $customerID]); I get an exception:

The customer ... cannot be updated without also passing the payment method

#

Creating the setupintent with the same payment_method_types field and customer does work. eg:

$this->stripeClient->setupIntents->create([
'payment_method_types' => [...],
'customer' => $customerID
]);

ember rune
#

Thanks for the ID, I am able to see the request

#

the purpose of the setupIntent is to collect the payment info from the customer so that you can use this info the charge the customer later.

#

so that is why, as the error suggests, you need to update the payment_method and then customer

broken pebble
ember rune
#

Or can you tell me a use case where you want to create a setupIntent without payment_method attached to a user?

broken pebble
#

Yes, I can do that

#

The scenario is as follows:

User visits our website and want to register an account which requires immediate payment. This is done in a single form.
So the details for the account is entered and a payment method is selected. At this point I created a setupintent without a customer related to it (as the user does not exist). After submitting the form, I create the customer in Stripe, want to link that customer to the setupintent and then confirm the setupintent with the js sdk (payments element).

#

But now I need the client secret when building the payments element so I am not sure yet if there is a customer to which the setupintent can be linked

#

Therefore I need to do one of two options:

ember rune
#

How about creating the customer first, then use the customer ID when creating the setup intent?

broken pebble
#

Yes, but that is not possible when I want to complete everything in the same step. If I move the registration to a separate place and do the payment method collection in a next step - all would be good

#

The only issue is that this scenario drops conversion rates. Collecting everything in one go is better

#

But it is strange that for the setupintent endpoint, you can create using limited fields but not update with the same fields

outer plinth
#

it does seem a bit odd! But it looks like that is just how it it is(I checked and the API has worked this way since SetupIntents were introduced in 2019) and a Customer can't be passed without also passing a PaymentMethod.

broken pebble
#

Thanks! That is a good remark

#

Do you understand my scenario and have any recommendations?

#

To me it sounds like something that needs to be changed in the docs or is a bug ๐Ÿ˜‰
The update description for a setupintent implies that what I want is possible and it does work for the create

outer plinth
broken pebble
#

Cool! Unfortunately I cannot update the payments elements with that new secret

#

So then I would need to render the payments element after the user creation

outer plinth
#

or you could keep using the separate Elements instead of PaymentElement

broken pebble
#

Yes indeed! The payments element is however an update I really love from your side ๐Ÿ˜„

#

So I am going to implement that for sure

#

Much more scalable