#Pravin-confirmCardPayment
1 messages · Page 1 of 1 (latest)
I am passing the paymentIntents client secret
still confirm payment call is failing for me
the Stripe object you're using should be instantiated with the Stripe Account header if the PI was created that way
I have instantiated stripe object like this const stripe = Stripe('*************');
I am working on plain javascript code
paymentIntent = await stripe.confirmCardPayment(client_secret, {
payment_method : paymentMethod.paymentMethod.id,
})
do you have the PI id? pi_xxx
yes I have payment intent ID
below is the confirm call code I am using
paymentIntent = await stripe.confirmCardPayment(client_secret, {
payment_method : paymentMethod.paymentMethod.id,
})
I meant could you please share it?
sure
the pi_xxx
sorry for the late reply
this is my curl for the confirm payment
curl 'https://api.stripe.com/v1/payment_intents/pi_3L8LyaPSc6y6Wd9J0Zw4T4DL/confirm'
-H 'authority: api.stripe.com'
-H 'accept: application/json'
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8'
-H 'content-type: application/x-www-form-urlencoded'
-H 'origin: https://js.stripe.com'
-H 'referer: https://js.stripe.com/'
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="102", "Google Chrome";v="102"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "macOS"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-site'
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36'
--data-raw 'payment_method=pm_1L8LyXAlnu7mVSWlMkBugCeU&expected_payment_method_type=card&use_stripe_sdk=true&key=&client_secret=*'
--compressed
I see that you made a successful confirmation
the idea is the you need to have 2 Stripe objects on the front
the one for the Platform
and the one for the Connected account
no the confirm payment call is failing for me
I understand
can you please help me how to configure 2 stripe objects in the Javascript code
I'm investigating could you please hold on a minute
sure
what key are you using on the Stripe object in the front end? the Connected account's public key?
yes
when you created the PI you created it using your Platform's secret key
which is pk_test_*******
I did not create the account public key
we are having web application running in react and we are using the key and I am using the same to connect from Java script code
pk_test_**********
I am able to make payments in the react code web application
it is in production as well
you need to create the PI and confirm it using the same combination of keys/Stripe-Account header
meaning if you generated the PI using the Platform's secret key, you have to confirm using the Platform's public key
if you generated the PI using the Platform's secret key with a StripeAccount Header for the connected key (destination charges), then you need to instantiate a Stripe object on the front with the public key of the Platform and the Stripe Account header and use that object to confirm the PI
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!