#HyperGame-elements
1 messages · Page 1 of 1 (latest)
yep!
Got it. That example is using the CardElement: https://github.com/stripe-samples/subscription-use-cases/blob/83015a9f29bf21630b386827a2d633a8ba80952c/fixed-price-subscriptions/client/react/src/Subscribe.js#L45
Providing the client_secret upfront when initialising the Elements instance is only a requirement for the Payment Element: https://stripe.com/docs/payments/payment-element/migration?integration-path=one-time#one-time-update-elements
I am currently having the user to enter the email and payment information in the same page. However, I need to load the Elements with clientSecret first. Is there an alternative way to do it with PaymentElement?
HyperGame-elements
or do I have to prompt the user to input their email first before going to the payment page
I'm not sure I understand the question?
So basically the user would like to subscribe to a product.
User enter email and fill in PaymentElement -> Register Stripe Customer -> Create Stripe Subscription with the returned customerId -> Calls stripe#confirmPayment
As the email is on the same page as the PaymentElement, I could not load the client secret after the subscription is created.
Yeah the generally integration flow is to create the Subscription object before capturing payment details:
- Create Subscription (and Customer if necessary).
– Initiate the Payment Element with theclient_secretfrom associated PI/SI. - Confirm.
ah I see. One more question, is it possible to customise the form labels in PaymentElement?
What specifically?
I'm afraid not: https://stripe.com/docs/stripe-js/appearance-api
it also looks like the text is broken at the bottom. would there also be a way to fix it?
Can you provide somewhere I can reproduce that? I guess you're configuring some style variables that might be messing with it
I only changed the colors
Code for PaymentForm
<div className="bg-slate-800 bg-opacity-50 absolute top-0 right-0 bottom-0 left-0">
<div className="px-5 py-5 mx-auto my-auto min-w-max max-w-xl max-h-xl bg-gray-800">
<form onSubmit={handleSubmit}>
<PaymentElement />
<div className="flex justify-center">
<button className="px-10 py-2 rounded-lg bg-slate-900 text-white font-semibold">
{statusMessage}
</button>
</div>
<div>
{message}
</div>
</form>
</div>
</div>
Is there a link I can reproduce this at?
Looks fine for me. Which browser are you in?
Bizarre, I can't replicate in either
Looks like a font-smoothing issue to me, looks like you're on Windows?
yep!
My guess is its Windows specific. I would recommend creating a GH issue over on the Stripe.js repo: https://github.com/stripe/stripe-js
Alright, thanks for the help! Really appreciate it!
Np!
sorry, got one more question. Is it generally a good practice to create a customer whenever someone signs up? or should I create the customer only before he/she is ready for a purchase
Up to you really!
You might want to do it on account creation so you can persist the Stripe Customer ID with the user object in your database
yea, however, the majority of the user would not be making a purchase, so I’m thinking if it’s a good idea to create tons of customers that probably wont end up paying