#greenman-hello

1 messages · Page 1 of 1 (latest)

quaint cloud
#

What error are you seeing exactly?

#

Can you show me the snippet of code where you create this payment intent?

wicked loom
#

yes certainly

#

getting secret from server and setting it on the Elements object in React

app.get('/secret', async (req, res) => {

  const intent = await stripe.setupIntents.create({

    payment_method_types: ['card', 'klarna', 'ideal']

  })

  console.log(intent)

  res.json({secret: intent.client_secret})

})```

 submit button handler that calls confirmSetup with the Element object

const handleSubmitPayment = async () => {

console.log('submited payment element')

try {

  const { error, setupIntent } = await stripe.confirmSetup({

    elements,

    redirect: 'if_required',

   

  })

  if (error)

    console.log(error)

  else

    console.log(setupIntent)

} catch (err) {

  console.log(err)

}

}

 
Error on Terminal from the server (returned by stripe from calling setupintent creation endpoint)
  ```type: 'StripeInvalidRequestError',

  raw: {

    code: 'setup_intent_invalid_parameter',

    doc_url: 'https://stripe.com/docs/error-codes/setup-intent-invalid-parameter',

    message: 'The payment method type "klarna" is invalid. See https://stripe.com/docs/api/setup_intents/create#create_setup_intent-payment_method_types for the full list of supported payment method types.',

    param: 'payment_method_types',

    type: 'invalid_request_error',```
quaint cloud