#aman-paymentintent-clientsecret
1 messages · Page 1 of 1 (latest)
stripe = Stripe(publishKey)
elements = stripe.elements(secretKey)
I don't get any errors till here
elements.create('payment');
but when I create the payment element it shows the error
You are not creating the stripe.elements properly. you DO NOT use the secret key there
I recommend going through this document step by step: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
let me try this thanks
Sure thing. If you run into a problem just let me know specifically what part of the doc you are at
Uncaught IntegrationError: Invalid value for elements(): clientSecret should be a client secret of the form ${id}secret${secret}. You specified: {{clientSecretVal}}.
I am getting this error when I pass the secret as
const options = {
clientSecret: '{{clientSecretVal}}',
// Fully customizable with appearance API.
appearance: {/.../},
};
Okay you are just passing a string in for clientSecret. You need to replace that with the client_secret for the Payment Intent you create in your server-side code.
isn't that the key which looks like "sk_test_51MM"
No
You should never include that on your front-end code, ever
You want the Payment Intent client_secret https://stripe.com/docs/api/payment_intents/object#payment_intent_object-client_secret
Which is what is described in the doc I linked you to
Ok, in the link it says client secret from payment intent, but to get the payment intent don't I need the payment method saved in stripe?
thanks
The Payment Intent client secret will look kind of like this: pi_3KnqXoIlCeH6bP8R1B9NT5ww_secret_YqgOOvZ4TkaJoRShvWxwFbrJN
But with different numbers/letters