Skip to Content
DocumentationConfiguration

Configuration

Minimal configuration

cashier: key: '%env(STRIPE_KEY)%' secret: '%env(STRIPE_SECRET)%' path: cashier webhook: secret: '%env(STRIPE_WEBHOOK_SECRET)%' tolerance: 300 events: - customer.subscription.created - customer.subscription.updated - customer.subscription.deleted - invoice.payment_succeeded - invoice.payment_failed - checkout.session.completed currency: usd currency_locale: en default_subscription_type: default invoices: renderer: CashierBundle\Service\InvoiceRenderer\DompdfInvoiceRenderer default_locale: en supported_locales: ['en', 'fr'] storage: driver: local path: '%kernel.project_dir%/var/data/invoices' options: paper: letter remote_enabled: false

Doctrine

doctrine: orm: mappings: CashierBundle: type: attribute is_bundle: false dir: '%kernel.project_dir%/vendor/makfly/stripe-cashier-bundle/src/Entity' prefix: 'CashierBundle\Entity' alias: CashierBundle

Routes

cashier_webhooks: resource: '@CashierBundle/Resources/config/routes/webhook.yaml'

Important options

OptionDescription
cashier.pathBundle route prefix. Default: cashier. The webhook route will be /cashier/webhook. If changed, the Stripe secret must match the new URL.
cashier.webhook.secretStripe secret for signature verification
cashier.webhook.eventsList of Stripe events to listen to (see Webhooks)
cashier.currencyDefault currency (ISO 4217 code: usd, eur, etc.)
cashier.currency_localeBCP 47 locale for monetary formatting (fr, en, de, etc.)
cashier.default_subscription_typeDefault subscription type used for customer.subscription.* webhooks. If multiple subscription types coexist, this parameter determines which one is created automatically.
cashier.invoices.default_localeDefault invoice language
cashier.invoices.supported_localesLanguages supported by the default provider
cashier.invoices.storage.pathAbsolute path for archived PDFs

Dompdf options

OptionDefault valueDescription
paperletterPaper format (letter, a4, legal)
remote_enabledfalseAllow loading remote images (disabled for security)

intl policy

The bundle does not force ext-intl.

Behavior:

  • with intl: localized monetary formatting and dates
  • without intl: safe fallback without runtime crash

You can therefore deploy the bundle on a minimal runtime, then improve PDF rendering later by installing the extension.

Invoice customization

Rendering is customizable at three levels:

  1. the Twig template templates/bundles/CashierBundle/invoice/default.html.twig
  2. the service configured in cashier.invoices.renderer
  3. locale and translation services:
    • CashierBundle\Contract\InvoiceLocaleResolverInterface
    • CashierBundle\Contract\InvoiceTranslationProviderInterface

Alternative renderer

To use Snappy (requires knp-snappy and wkhtmltopdf):

cashier: invoices: renderer: CashierBundle\Service\InvoiceRenderer\SnappyInvoiceRenderer options: paper: letter encoding: UTF-8

Prerequisite: composer require knp-snappy/wkhtmltopdf-binary

Customers →

Last updated on