#gabriel_savedpm-link
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/1306370569452654663
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
I forgot to mention that I am testing on Stripe's Dev environment.
Example of my Stripe Payment elements implementation in React:
`const StripePaymentElementsProvider = ({
sessionToken,
children,
}: StripePaymentElementsProviderProps) => {
const theme = useTheme();
const elementsOption = {
clientSecret: setupIntendSecretId,
appearance: {
variables: {
fontFamily: ${themeConfig.fonts.hankenGrotesk.family}, sans-serif,
colorPrimary: theme.backgroundPositive.val,
colorText: theme.primaryA.val,
fontSize3Xs: ${themeConfig.fonts.hankenGrotesk.size.true}px,
},
},
currency: 'ussd',
};
return (
<Elements stripe={stripePromise} options={elementsOption}>
{/* In some children component: */}
<PaymentElement
options={{
layout: 'tabs',
defaultValues: {
billingDetails: {
email: billingDetails.email,
name: billingDetails.firstName + ' ' + billingDetails.lastName,
phone: billingDetails.phone || '',
},
},
}}
/>
</Elements>
);
};
export default StripePaymentElementsProvider;
`
Hello, thanks for the info. Is the sessionToken in your code from a Customer Session? If so, I would expect the saved PMs to show up again. The only steps that I am aware of that are required are having PMs with allow_redisplay set properly and then the customer session
No that's not a Stripe Session Id, it's actually the Setup Intent client secret (seti_1QKnzhC8l6n3Jm54hkpkS20B_secret_RDESPmglF0FkFXdyak6HGis7Ej9pPLx).
I named it sessionToken for people that are not familiar with Stripe API understand that this token is required to initialize the Stripe Elements
Gotcha, so you will also want to create a customer session and pass its client secret to the elements instance along with that intent's client secret.
https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements#enable-saving-the-payment-method-in-the-payment-element
https://docs.stripe.com/api/customer_sessions/object
Interesting... I will try that, thanks