Retrieve client_secret with stripe.confirmCardSetup

There is no field to retrieve the client_secret from the setupIntent or paymentIntent APIs, when using stripe.confirmCardSetup or stripe.confirmCardPayment client side.

It that something you’d need to fix or else what would be the exact syntax in the code for matching the Stripe doc below? This does not work and messes up my whole dynamic event flow function:

stripeCard.confirmSetup(’{My_ServerconnectID.data.My_createSetupIntentAPI.client_secret}’

Stripe JS:

stripe
  .confirmCardSetup('{SETUP_INTENT_CLIENT_SECRET}', {
    payment_method: {
      card: cardElement,
      billing_details: {
        name: 'Jenny Rosen',
      },
    },
  })

Pls advise your suggestion @patrick @Teodor

Anyone able to share a clue about what the recommended fix is?
I am using the mouse ‘on-click’ flow function and adding something like the following line (as suggested by @Antony before Wappler had Stripe components) messes up the whole flow code:

stripe.confirmCardPayment(dmx.parse("My_ServerconnectID.data.My_createSetupIntentAPI.client_secret"),

Any clue appreciated as I cannot progress anymore. @George any hint?

Anyone this weekend has time to suggest the right “dmx” syntax for confirmCardSetup(’{SETUP_INTENT_CLIENT_SECRET}’ in the code?

You set the client_secret on the stripe component, all other stripe component then use that secret, so no need to apply the secret in the confirm setup call.

1 Like

Noted, client_secret is active across all components.

I do get this error though when I run confirmCardSetup on-click client side: Invalid value for stripe.confirmCardSetup intent secret: value should be a client_secret string. You specified: undefined

I do generate a proper client_secret:
image

Does it need a fix or shall I adjust something in the PHP code?

Do you use the createSetup from the stripe component? It makes the client-secret available for the other components, you can listen to the setup_created event to know that it is ready and then call the confirmSetup on the stripeCard component.

Alternative you could pass it as parameter to confirmSetup, but using the stripe component to create the setup is the easiest and intended way to do it.

stripeCard.confirmSetup(My_ServerconnectID.data.My_createSetupIntentAPI.client_secret)

Thanks! That’s the working syntax I have been waiting for…
I believe the easiest way is to have an option here for “fetching” the client_secret from the server side. It is central to the whole process.

The createSetup action and setup_created event are on the Stripe component, not the Stripe Card component.

The intended way is to use the createSetup of the Stripe component and then the confirmSetup on the Stripe Card component, then the secret doesn’t need to be passed. Because we never intended to have the setup created outside the Stripe component we didn’t add the parameter to the UI, but the component optionally accepts the parameter.

1 Like