-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to pass options to stripe.elements() #33
Comments
Ping here, any ideas or direction on this? We want to be able to use custom fonts with Stripe Elements, which require the ability to pass initialization options. |
We managed to use custom fonts by passing them in the style object, same way detailed here: https://github.com/code-corps/ember-stripe-elements#block-usage-with-options |
@jackhair Can you share a snippet of the code you used to get this working? We're trying to utilize a Typekit font, so we need to pass in the stylesheet for it to load similar to https://gist.github.com/matthooks/03d7c741cd48789a140b1503193b0b6c |
@PixelJanitor That is pretty much what we did. I'll give a brief overview. Bear in mind we're pulling from master branch, as we couldn't use the individual fields without this PR: #26 Component containing stripe form: options: {
style: {
base: {
fontFamily: '"Custom Font Name", Helvetica, sans-serif'
}
}
},
init() {
this._super(...arguments);
let elements = this.get('stripe').elements({
fonts: [{
cssSrc: 'https://example.com/stylesheet.css',
}]
});
this.set('cardElements', elements);
}, Component template: {{#stripe-card-number id="cardnumber" elements=cardElements options=options change=(action (mut stripeElement)) as |stripeElement stripeError|}}
...
{{/stripe-card-number}} |
Just an update to @jackhair's comment here that you should be able to use version |
Hey guys! As you can read in the documentation https://github.com/code-corps/ember-stripe-elements#block-usage-with-options, it can be possible to pass options object to component context but then why options object is always initialized as "{}" on init hook
|
@idgm81 haven't tried it, have you confirmed it doesn't work? If so, maybe open a separate issue and/or submit a PR? |
Actually @idgm81 you're right that it does look like a bug. I'll fix now. |
Great @lindyhopchris , I also found that style object at
|
Hello! Thanks for creating this addon, it's awesome.
Is there a way to pass the
options
hash on init tostripe.elements(options)
? This is different than the per-element options hash.https://stripe.com/docs/stripe-js/reference#stripe-elements
I believe the init is this line: https://github.com/code-corps/ember-stripe-elements/blob/0.3.0/addon/components/stripe-element.js#L16
The text was updated successfully, but these errors were encountered: