#waleed.bin.khalid

1 messages · Page 1 of 1 (latest)

thin sapphireBOT
regal rampart
#

hi

#

previously I was just creating payment intent and confirming payment from react side

#

while before I was not using stripeAccount header while creating pyament intent but Now I am adding this header

#

and it is saying pyament method required

#

I am doing apple pay/ google pay to connect account

neon socket
#

Hi, let me help you with this.

regal rampart
#

great

neon socket
#

Could you please share the PaymentIntent ID?

regal rampart
#

sure

#

pi_3OH43kQbXdHsnP2b1gDKXusl

#

?

neon socket
#

Looking...

regal rampart
#

oh sorry

neon socket
#

Why are you not confirming the PaymentIntent?

regal rampart
#

I am confirming the payment from frontend

#

lemme show you

#

const pr = stripe.paymentRequest({
countryCode,
country: "US",
currency: currencyCode === "" ? "usd" : currencyCode.toLowerCase(),
total: {
label: "Total tip amount",
amount: Number((tipAmount ? tipAmount * 100 : 0).toFixed(2)),
},
requestPayerName: true,
requestPayerEmail: true,
disableWallets: ["link"],
});

    pr.canMakePayment().then((result) => {
      if (result) {
        setPaymentRequest(pr);
        if (!result?.applePay) {
          setIsApplePayDisabled(true);
        }
      }
    });
#

First I am creating payment request like this

#

then this is how I am creating payment-intent through backend api

#

and confirming that payment as well on react side

neon socket
#

Do you see any errors?

regal rampart
#

this on stripe

#

on frontend while making payment it is showing error in payment just

neon socket
regal rampart
#

on frontend while making payment through wallet

#

it is just showing this message "there is some error with your payment just"

#

When I go to stripe connect account to track that erorr it is showing me payment method required in pyament intent

neon socket
#

Could you please show me the whole error message?

regal rampart
#

i guess this is the error message. It is occuring while confirm the payment

#

pyament intent id exists on connect account only not on merchant account

#

but I believe after creating payment intent on stripe connect account. It is trying to confirm payment on stripe merchant account not on connect account

neon socket
#

Thanks, this is very helpful.
This seems like a typical error when using Stripe-Account headers.

#

Could you please paste the pi_xxx here?

regal rampart
#

yup

#

pi_3OH4kZQbXdHsnP2b1aujZ9Wd

neon socket
regal rampart
#

lemme check

#

I have already added this stripeAccount header whole loading stripe

neon socket
#

How are you doing this exactly?

regal rampart
#

can we add stripeAccount header in

const {
error: stripeError,
paymentIntent,
} = await stripe.confirmCardPayment(
clientSecret,
{
payment_method: e.paymentMethod.id,
},
{ handleActions: false }
);

api

neon socket
#

How are you doing this now?

#

Please remove the keys from your message.

#

@regal rampart

#

const checkConnectId = () => {
if (connectAccountId !== "") {
stripePromise = loadStripe(
"pk_test_...",
{ stripeAccount: connectAccountId }
);
} else {
stripePromise = loadStripe(
"pk_test_..."
);
}
};

#

Did that for you.

#

Are you sure your code picks the first path here?

thin sapphireBOT
regal rampart
#

I am storing connect account id in reduc store

#

redux, I have card payments and wallet payments. For cards it is fine without that stripeAccount header

#

in wallet payment I do need that

#

thats why

neon socket
#

Could you please validate if it actually adds the stripeAccount header? Because it seems like the most obvious place.

regal rampart
#

how can i confirm that ?

vague kestrel
regal rampart
#

can we add stripeAcccount header while confirmPayment

#

const {
error: stripeError,
paymentIntent,
} = await stripe.confirmCardPayment(
clientSecret,
{
payment_method: e.paymentMethod.id,
},
{ handleActions: false }
);

#

in this api?

vague kestrel
#

Yes, that is how you confirm a direct charge payment intent

#

Keep in mind that the intent needs to be created using the same stripeAccount header for the confirm call to work

regal rampart
#

yes yes, intent is creating using stripeAccount header

regal rampart
#

api*

#

there ?

vague kestrel
#

Like what library is making that confirm call?

regal rampart
#

stripe js

#

react is on frontend

#

in my case I have multiple connect account. Which will be getting from backend afterward but not when react app loads in dom

#

that is why I want to add stripeAccount header in confirm api instead of loadStripe api

#

what you say

vague kestrel
regal rampart
#

At the time of initialization, what if I dont have connect account id

#

?

#

becasue there is scenario iin our application, payment giver select any user to pay. when that user selected then we can get connect id from backend related to that selected user

#

?

vague kestrel
#

I actually don't think that you can dynamically change the stripeAccount header after initializing it at first