CLI Commands
cashier:install
Installs the minimal bundle configuration in a Symfony project.
php bin/console cashier:installEffects:
- creates missing config files
- creates missing Stripe variables in
.env - creates
var/dataandvar/data/invoices - does not overwrite existing files
Option
php bin/console cashier:install --env-file=.env.localcashier:webhook
Creates or updates a webhook endpoint on the Stripe side.
php bin/console cashier:webhook --url=https://example.com/cashier/webhookUseful options:
--disabled--api-version--show-secret
cashier:webhook:listen
Opens a local Stripe CLI listener.
php bin/console cashier:webhook:listen --forward-to=http://127.0.0.1:8000/cashier/webhookOr with --base-url to automatically build the URL:
php bin/console cashier:webhook:listen --forward-to --base-url http://localhost:8000Note: The Stripe CLI must be installed locally.
This command is used to:
- forward Stripe events to your local app
- retrieve and persist the
whsec_...secret - visually read HTTP responses through console colors
Default registered Stripe events
The cashier:webhook command creates a webhook with the following events:
customer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedcustomer.deletedinvoice.payment_succeededinvoice.payment_failedinvoice.payment_action_requiredcheckout.session.completedcheckout.session.expiredpayment_intent.succeededpayment_intent.payment_failedpayment_method.updated
cashier:report-usage
Reports usage for a metered SubscriptionItem.
# 1 = local ID (primary key) of the SubscriptionItem entity in the database
# 100 = usage quantity to report
php bin/console cashier:report-usage 1 100
# To set an absolute value rather than incrementing
php bin/console cashier:report-usage 1 100 --action=setcashier:cleanup-sessions
Warning: This command requires the
CheckoutSessionentity which is not implemented in this version.
php bin/console cashier:cleanup-sessionsPlaceholder command to clean up expired Checkout sessions.
Official init command
Until a published Flex recipe is the canonical way in your distribution, consider cashier:install as the official bundle bootstrap command.
Last updated on