#adamco

1 messages · Page 1 of 1 (latest)

muted palmBOT
pulsar badge
#

Hi 👋

This error means there is a mismatch between the instantiation of Stripe.js and the payment intent

solid vigil
#

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,
      }
    );
pulsar badge
#

So you are creating the Payment Intent on the Platform Account, correct?

solid vigil
#

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>
  );
}
solid vigil
pulsar badge
#

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

solid vigil
#

I found the solution it was in my frontend when I initialise stripe component 🤡 thx a lot !!