#adamco
1 messages · Page 1 of 1 (latest)
Hi 👋
This error means there is a mismatch between the instantiation of Stripe.js and the payment intent
here my backend code for create paymentIntent :
await this.client.paymentIntents.create(
{
amount: stripeAmount,
customer: stripeCustomerId ?? undefined,
currency,
description,
automatic_payment_methods: {
enabled: true,
},
capture_method: "manual",
receipt_email: receiptEmail,
application_fee_amount: stripeFeeAmount,
setup_future_usage: setupFutureUsage ? "off_session" : undefined,
metadata: {
sessionId,
stripeCustomerId: stripeCustomerId ?? null,
isStandalone: isStandalone ? "true" : "false",
},
transfer_data: {
destination: this.account,
},
on_behalf_of: this.account,
}
);
So you are creating the Payment Intent on the Platform Account, correct?
Here my frontend code for the stripe payment component :
function StripeCheckoutYourOrder({ company, ...props }: StripeCheckoutProps) {
const { i18n } = useTranslation();
const [clientSecret, setClientSecret] = useState("");
useEffect(() => {
// Create PaymentIntent as soon as the page loads
if (!clientSecret) loadStripePaymentIntent();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const appearance: Appearance = {
theme: "stripe",
labels: "floating",
};
const options: StripeElementsOptions = {
clientSecret,
appearance,
locale: i18n.language as any,
};
console.log("options : ", options);
return (
<div>
{clientSecret ? (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
<Elements options={options} stripe={stripePromise} key={clientSecret}>
<CheckoutForm
company={company}
loadStripePaymentIntent={loadStripePaymentIntent}
{...props}
/>
</Elements>
) : (
<div>
<Loader />
</div>
)}
</div>
);
}
ok I will check the platform account
The Payment Intent is created on the Platform Account with the Transfer destination set to the Connected Account.
The error you are seeing is because Stripe.js which you are using to confirm that Payment Intent is being initialized for the Connected Account, which cannot confirm a payment on the Platform Account
I found the solution it was in my frontend when I initialise stripe component 🤡 thx a lot !!