#boris_api

1 messages ยท Page 1 of 1 (latest)

fathom owlBOT
#

๐Ÿ‘‹ 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/1382032183434416169

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

waxen wharf
#

Hi! How are you creating the Payment Element?

whole escarp
#

Using Stripe JS, via a clientSecret generated on the BE

waxen wharf
#

Can you please share the code you use to create the Payment Element?

#

wait wait

whole escarp
#
.fetchClientSecret()
.then((clientSecret: string) => {
                    const options = {
                        clientSecret,
                        locale: this.language as StripeElementLocale,
                        fonts: [
                            {
                                cssSrc: `https://fonts.googleapis.com/css2?family=${this.styles.font}&display=swap`
                            }
                        ]
                    }

                    const hideBillingDetails = this.isCanadianLocation
                    const billingDetails = this.kiosk
                        ? {}
                        : {
                              name: `${this.getFirstName} ${this.getLastName}`,
                              email: `${this.qualifyingEmail}`
                          }

                    const elements = this.stripe!.elements(options)
                    const paymentElement = elements.create(`payment`, {
                        terms: {
                            card: `never`
                        },
                        defaultValues: {
                            billingDetails
                        },
                        ...(hideBillingDetails
                            ? {}
                            : {
                                  fields: {
                                      billingDetails: {
                                          email: `never`,
                                          name: `never`
                                      }
                                  }
                              })
                    })
#

Something like this, removed some extra appearance options for simplicty

waxen wharf
#

Ok, can you explain to me your usecase here so I can better understand what exactly you're trying to accomplish?

whole escarp
#

It's meant to be a kiosk application where people can pay as much as they want, in a public setting. Problem is that Link doesn't reset after we complete a payment.

  1. Person A adds a new payment method via Stripe Payments, using Link
  2. Person A checkout is complete
  3. Application form resets (without refreshing the page)
  4. Person B starts the form, adds a new payment method via Stripe Elements. Sees the previous person (Person A's) Link account and details
waxen wharf
#

Link likely shouldn't even be made available in this scenario since it's a shared computer.

whole escarp
#

I think the company may have a contractual obligation to show Link

#

is there a way to disable it for certain Payment Elements?

waxen wharf
#

What does "certain Payment Elements" mean?

whole escarp
#

On the same app, we have an authenticated portal where we use the same clientSecret/stripe elements flow for people to add Payment methods. We want Stripe Link to show up there for sure.

But on another page, we have that public kiosk mode which also uses the same clientSecret/stripe elements flow, but here we don't want Link to show up

waxen wharf
whole escarp
#

Is that the only path? Is there no way configure that via JS on the front end?

waxen wharf
#

You'd use that path to configure it on the front end.

#

Or just set that.

whole escarp
#

Okay, I'll give those last two a try. They seem reasonable to me thanks

waxen wharf
#

The last one will do what you need, on the frontend.

#

And you're welcome. ๐Ÿ™‚

whole escarp
#

OK, this configuration on the frontend didn't work. Is the only option to go with the first approach you mentioned (on the backend creating the PI)?

const paymentElement = elements.create(`payment`, {
    terms: {
        card: `never`
    },
    wallet: {
        link: `never`
    },
#

This is my guess, but is it because the config used in the backend PI creation takes precedent over the frontend configuration?

#

I'll brb around 20 minutes for lunch