#mikesmith7748
1 messages · Page 1 of 1 (latest)
Can you share more detail about this? WHere are you seeing this? Is it blocking your payments?
Yes, here's the code I have:
const clientSecret = props.clientSecret;
const stripePromise = props.stripePromise;
const appearance = {
variables: {
fontFamily: "montserrat, system-ui, sans-serif",
spacingGridRow: "20px"
}
};
const options = {
appearance,
clientSecret
};
return (
(<Elements stripe={stripePromise} options={options}>
<ElementsConsumer>
{({ stripe, elements }) => (
<ConnectedPaymentInfoStep
withAchProps={props.withAchProps}
stripe={stripe}
elements={elements}
{...props}
/>
)}
</ElementsConsumer>
</Elements>)
);
};```
This throws the cross origin error
I found out if I add clientSecret && stripePromise && before Elements, it will render but I don't want to have to do that
export const InjectedCheckoutForm = (props) => {
const clientSecret = props.clientSecret;
const stripePromise = props.stripePromise;
const appearance = {
variables: {
fontFamily: "montserrat, system-ui, sans-serif",
spacingGridRow: "20px"
}
};
const options = {
appearance,
clientSecret
};
return (
clientSecret && stripePromise && (<Elements stripe={stripePromise} options={options}>
<ElementsConsumer>
{({ stripe, elements }) => (
<ConnectedPaymentInfoStep
withAchProps={props.withAchProps}
stripe={stripe}
elements={elements}
{...props}
/>
)}
</ElementsConsumer>
</Elements>)
);
};```
This code works but I don't want to add clientSecret && stripePromise
Why not?
With the intent first flow you need that clientSecret
If you want an alternative, yo be able to render elements without a client secret, you should take a look at our deferred intent flow:
Because if the backend throws an error for Instant ACH, for example, all of the other payment methods will not render
I want it to where if one payment method fails, it just doesn't render but allk other payment methods still render
I have a combination of CardElement and PaymentElement because we haven't upgraded the deprecated CardElement yet, so they use different code