#harshilbodara
1 messages · Page 1 of 1 (latest)
Hi there!
Hello
We have some doc on how to customize the Payment Element here: https://stripe.com/docs/elements/appearance-api
this is PaymentElement right?
Yes
And you can pass the appearance inside the option object when mounting the Element
<Elements stripe={stripePromise} options={options}>
as per docs, for change design we need clientSecret, without this secret code we can't render this element.
Yes you need a client secret before mounting the Element.
CardNumberElement, CardExpiryElement and CardCvcElement
those element not need to client secret right?
and there is a way to change the design without client secret?
those element not need to client secret right?
Not completely sure. Have you tried?
Yes I think it should work without the client secret in this case.
yes, this is working without secret and on submit we need to use confirmCardPayment
But the link I shared above is specifically about the Payment Element, but instead you want to use the CardNumberElement?
I'm consufed. Do you want to use PaymentElement or CardNumberElement?
For PaymentElement you have to provide a client secret.
So you create the PaymentIntent on your backend, send the client_secret to your frontend, and then mount the Payment Element.
I want to use PaymentElement with custom style.
but we not have client secret so we have use CardNumberElement for temp solution.
we used a subscription.
PaymentElement and CardNumberElement are completely different. If you plan to use PaymentElement then I recommend directly using the PaymentElement.
Then you create the subscription, which will contain an invoice and in the invoice there will be a PaymentIntent (assuming the first invoice is a non-zero amount). And send the client_secret of that PaymentIntent to the frontend.
our use case is,
we have one sign form, there is email, name, CardNumberElement and, submit button.
On submit, first we create stripe user then subscription and after we get client_secret and can sent to frontend.
means we need to render PaymentElement before client secret.
If you want to use the PaymentElement you need to change your flow:
- Start by creating the subscription
- Retrieve the
latest_invoice.payment_intent.client_secretand send it to the frontend - Then on the frontend collect the info you need (email, name, etc.) and mount the PaymentElement with the
client_secret
True, you need a customer to create the subscription. But you can always update the customer after the subscription is create. Or you could change the flow so it works in two step:
- Collect customer info and create the Customer in Stripe
- Then create subscription & collect payment information with the Payment Element
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!