Skip to content
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

Cannot override the fonts used in Stripe Payment Element #258

Open
thisisjamessmith opened this issue Oct 17, 2023 · 0 comments
Open

Cannot override the fonts used in Stripe Payment Element #258

thisisjamessmith opened this issue Oct 17, 2023 · 0 comments
Labels

Comments

@thisisjamessmith
Copy link

Description

The Stripe docs describe how to override the fonts used in their new Payment Element here: https://stripe.com/docs/js/elements_object/create#stripe_elements-options-fonts - however, this is not possible from Craft's Stripe plugin when using getPaymentFormHtml(). We have plenty of power to alter the design by using the appearance object, which works really well. But custom fonts do not work, not with cssSrc or a custom font source object.

Steps to reproduce

I would expect either of the following to work:

{% set stripeParams = {
    fonts: [{
        family: 'Avenir',
        src: 'url(https://my-domain.com/assets/avenir.woff)',
        weight: '500',
    }],
    appearance: {
        variables: {			
            fontFamily: 'Avenir',
            ...
        },
        ...
    }
} %}

{% set gateway = craft.commerce.gateways.getGatewayById(1) %}
{{ gateway.getPaymentFormHtml(stripeParams)|raw }}

or

{% set stripeParams = {
    fonts: [{
        cssSrc: 'https://fonts.googleapis.com/css2?family=Inter'
    }],
    appearance: {
        variables: {
            fontFamily: 'Inter',
            ...
        },
        ...
    }
} %}

{% set gateway = craft.commerce.gateways.getGatewayById(1) %}
{{ gateway.getPaymentFormHtml(stripeParams)|raw }}

Additional info

  • Craft CMS version: 4.5.6.1
  • Craft Commerce version: 4.3.0
  • Stripe for Craft Commerce version: 4.0.0
  • PHP version: 8.1
  • Database driver & version: MySQL 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant