#boris_api
1 messages ยท Page 1 of 1 (latest)
๐ 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.
Hi! How are you creating the Payment Element?
Using Stripe JS, via a clientSecret generated on the BE
.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
Ok, can you explain to me your usecase here so I can better understand what exactly you're trying to accomplish?
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.
- Person A adds a new payment method via Stripe Payments, using Link
- Person A checkout is complete
- Application form resets (without refreshing the page)
- Person B starts the form, adds a new payment method via Stripe Elements. Sees the previous person (Person A's) Link account and details
Link likely shouldn't even be made available in this scenario since it's a shared computer.
I think the company may have a contractual obligation to show Link
is there a way to disable it for certain Payment Elements?
What does "certain Payment Elements" mean?
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
Use different Payment Method Configurations for the two places. https://docs.stripe.com/payments/payment-method-configurations
Is that the only path? Is there no way configure that via JS on the front end?
You'd use that path to configure it on the front end.
Or, rather, on the backend when creating the PI I guess: https://docs.stripe.com/payments/payment-method-configurations#create-payment-intent
Or just set that.
Okay, I'll give those last two a try. They seem reasonable to me thanks
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