stripe-payments

How to use properly the override flag with Stripe CLI?


I'm using Stripe CLI to send a trigger to my local server in test mode.

By default the invoice.payment_succeeded event sets billing_reason as manual. I want to override it

stripe trigger invoice.payment_succeeded --override invoice:billing_reason="subscription_create"

But I get an error

Trigger failed: Request failed, status=400, body={
  "error": {
    "code": "parameter_unknown",
    "doc_url": "https://stripe.com/docs/error-codes/parameter-unknown",
    "message": "Received unknown parameter: billing_reason",
    "param": "billing_reason",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_Ii4TgRefeASCLd?t=1752042969",
    "type": "invalid_request_error"
  }
}

What am I doing wrong?


Solution

  • You encountered this error because billing_reason isn't a valid param for invoice creation.

    I don't think you can override billing_reason , you can only override with the params according to the API reference https://docs.stripe.com/api/invoices/create

    Alternatively you'll want to run stripe trigger customer.subscription.created to trigger a subscription creation event, which will eventually create an invoice with billing_reason="subscription_create"