#scmitton
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
would you mind sharing the resources' links that you've used for this?
Are you referring to the stripe docs? https://stripe.com/docs/js/elements_object/create
all of the ways I've found in the github issue on this topic, and the methods outlined in the stripe docs
these
I use custom fonts in my project, including them in CSS through @font-face. E. g.: @font-face{ font-family: AvenirLTStd-Roman; src: url(http://localhost:3000/webfonts/338CD6_4_0.woff2) format("...
taking a look give me a couple of minutes
Ok, update I tried a different font, and it actually worked. So maybe there's an issue with just that font.
yes maybe
that's what I was trying to figure out honestly
happy it worked out for you
Well it's not working with the font I want still. Do you have any suggestions on how to work around that?
what is the font that worked for you?
Open Sans worked, but Source Sans 3 has not
I tried loading Source Sans 3 from type kit, and it looks to have worked
actually I go it working with this
{
appearance: {
theme: 'stripe',
variables: {
fontFamily: 'Source Sans 3'
},
},
fonts: [{ cssSrc: "https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400&display=swap" }]
}
And you pass this as options to Elements? I'm using CardElement btw
Hello ๐
Afaik the Appearance API doesn't support CardElement yet ๐ฆ
The example tarzan shared is w/ Appearance API
https://stripe.com/docs/elements/appearance-api
But I can still customize by passing a styles object to CardElement? I found that on this guide: https://stripe.com/docs/payments/card-element#style-input
It says to customize fonts by initializing Elements with a font set
Yup, I'd recommend giving it a try tbh.
That's what I've been doing though, and why I was lead to my original question.
I'm passing the fonts list in the options object like so: let options = {
fonts: [{
cssSrc: "https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600&display=swap"
}]
}
export default function Checkout() {
return (
<Elements stripe={stripePromise} options={options}>
<PaymentWindow />
</Elements >
)
};
But it's not working.
that's probably because fonts isn't a valid param for card element style
https://stripe.com/docs/js/appendix/style
yes, I pass fonts to Elements in the options, like in the code snippet I shared just a message back. Then in the style for CardElement, I set fontFamily to Source Sans 3. But that font strangely is the only one not working from the fontsgoogleapi
Ah I see. my bad. I thought you were setting passing it on the wrong object. Never mind!
Give me a few..