#HyperGame-elements

1 messages · Page 1 of 1 (latest)

still island
#

Hey! You mean specifically using the options prop?

fleet bane
#

yep!

still island
fleet bane
#

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?

still island
#

HyperGame-elements

fleet bane
#

or do I have to prompt the user to input their email first before going to the payment page

still island
#

I'm not sure I understand the question?

fleet bane
#

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.

still island
#

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 the client_secret from associated PI/SI.
  • Confirm.
fleet bane
#

ah I see. One more question, is it possible to customise the form labels in PaymentElement?

still island
#

What specifically?

fleet bane
#

the text itself

#

like changing Card number to Card Information or something else

still island
fleet bane
#

it also looks like the text is broken at the bottom. would there also be a way to fix it?

still island
#

Can you provide somewhere I can reproduce that? I guess you're configuring some style variables that might be messing with it

fleet bane
#

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>
still island
#

Is there a link I can reproduce this at?

fleet bane
#

like an actual website link?

still island
#

Looks fine for me. Which browser are you in?

fleet bane
#

both chrome and firefox

still island
#

Bizarre, I can't replicate in either

#

Looks like a font-smoothing issue to me, looks like you're on Windows?

fleet bane
#

yep!

still island
fleet bane
#

Alright, thanks for the help! Really appreciate it!

still island
#

Np!

fleet bane
#

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

still island
#

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

fleet bane
#

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

still island
#

That's not really problematic from our perspective, I guess it's just preference

#

Personally I prefer to do it async when I handle my auth/account creation