#sai-rez_error
1 messages Ā· Page 1 of 1 (latest)
š Welcome to your new thread!
ā²ļø We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
ā±ļø We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
š This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1266355680483479626
š Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- sai-rez_code, 32 minutes ago, 13 messages
The answer is right there in the error:
This is determined by the
setupFutureUsageyou provided when creating theelementsobject on your client
https://docs.stripe.com/js/elements_object/create_without_intent#stripe_elements_no_intent-options-setupFutureUsage
The issue is I have configured it which is strange, with mode setup the confirmation token has setup_future_usage set correctly, but not with mode payment. My code is below, am i missing something?
`const paymentIntentOptions = {
mode: 'payment',
amount: paymentIntent?.amount,
setupFutureUsuage: 'off_session',
paymentMethodTypes: paymentIntent?.payment_method_types,
} as StripeElementsOptions;
const setupIntentOptions = {
mode: 'setup',
currency: plansState[0]?.currency ?? 'gbp',
setupFutureUsuage: 'off_session',
} as StripeElementsOptions;
const stripeOptions =
doesNeedPaymentIntent && paymentIntent ? paymentIntentOptions : setupIntentOptions;
return (
stripeOptions && (
<ElementsStripeWrapper options={stripeOptions}>
<PaymentDetailsWithElements paymentIntentFromWrapper={paymentIntent} />
</ElementsStripeWrapper>
)
);`
What does <ElementsStripeWrapper> component look like?
It's just a simple wrapper around the Elements component
`const ElementsStripeWrapper: React.FC<Props> = ({ children, options = {} }) => {
const { appData } = useContext(AppContext);
const [stripePromise] = useState(() =>
loadStripe(appData.stripeKey, { locale: getLang() as StripeElementLocale }),
);
return stripePromise ? (
<Elements
stripe={stripePromise}
options={{
...options,
fonts: [
{
src: "url('https://fonts.googleapis.com/css?family=Roboto:400,500&display=swap')",
family: 'Roboto Regular',
weight: '400',
},
],
loader: 'always',
}}
>
{children}
</Elements>
) : null;
};`
Ah, there's a typo: setupFutureUsuage
That's why it's not working in your payment options
Well actually, a typo in both lol
np at all
Yup tested now and it's working š¤¦āāļø sorry again