You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to create a checkout page with PaymentElement, and all went well with clientSecret. Everything works as expected.
Now I want to allow my customers to save and retrieve their payment methods. According to the official guide, I need to create CustomerSession which returns customerSessionClientSecret that'll be used on the frontend side to enable the feature.
The Problem
When supplying customerSessionClientSecret directly to <Elements>, it didn't work as expected. There's no check button for saving payment method for future use.
Things I've tried.
Supply customerSessionClientSecret directly to like so.
Doesn't work. I believe because does not have the property customerSessionClientSecret so nothing happens.
Call stripe.elements() to initialize elements variable. The payment form didn't render, and the following error is shown in the browser console.
Code
Here's my code of the payment page. The idea is that I fetch a payment object that contains clientSecret and customerSessionClientSecret and supply it to <Elements>. The expected result is that the payment form should be shown with save payment details like the following image.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
Background
I tried to create a checkout page with PaymentElement, and all went well with
clientSecret
. Everything works as expected.Now I want to allow my customers to save and retrieve their payment methods. According to the official guide, I need to create CustomerSession which returns
customerSessionClientSecret
that'll be used on the frontend side to enable the feature.The Problem
When supplying
customerSessionClientSecret
directly to<Elements>
, it didn't work as expected. There's no check button for saving payment method for future use.Things I've tried.
Supply
customerSessionClientSecret
directly to like so.Doesn't work. I believe because does not have the property
customerSessionClientSecret
so nothing happens.Call
stripe.elements()
to initializeelements
variable. The payment form didn't render, and the following error is shown in the browser console.Code
Here's my code of the payment page. The idea is that I fetch a payment object that contains
clientSecret
andcustomerSessionClientSecret
and supply it to<Elements>
. The expected result is that the payment form should be shown with save payment details like the following image.Thanks in advance for your help. :)
Beta Was this translation helpful? Give feedback.
All reactions