Workflows / Stripe / checkout.session.expired

Stripe Checkout Expired Notification to Slack & Email

Use the Stripe integration by MagicBell to setup a workflow when checkout.session.expired triggers in Stripe.

Connect Stripe to MagicBell to receive events and trigger workflows. This guide uses the MagicBell CLI.

Add the Stripe integration

Save your Stripe webhook signing secret in MagicBell. See Stripe webhooks.

magicbell integration save_stripe \
  --data '{"webhook_signing_secret":"whsec_xxx"}'

Copy the ID from the response and use it to build your webhook URL:

https://api.magicbell.com/v2/integrations/stripe/webhooks/incoming/{id}

Setup the webhook

Add a workflow

Create a workflow that triggers automatically when Stripe sends this event.

Workflow key

Use this key to trigger the workflow when Stripe sends a checkout.session.expired:

integration.stripe.checkout.session.expired

Example workflow

Notify customers when their checkout session expires, then alert the sales team after 1 hour for follow-up.

{
  "key": "integration.stripe.checkout.session.expired",
  "steps": [
    {
      "command": "broadcast",
      "input": {
        "action_url": "{{payload.data.object.cancel_url}}",
        "content": "Your checkout session for ${{payload.data.object.amount_total}} has expired. Please try again if you'd like to complete your purchase.",
        "recipients": [
          {
            "external_id": "{{payload.data.object.customer}}"
          }
        ],
        "title": "Your checkout session expired"
      }
    },
    {
      "command": "wait",
      "input": {
        "duration": 3600
      }
    },
    {
      "command": "broadcast",
      "input": {
        "content": "Customer abandoned checkout for ${{payload.data.object.amount_total}}. Session ID: {{payload.data.object.id}}",
        "overrides": {
          "providers": {
            "slack": {}
          }
        },
        "recipients": [
          {
            "external_id": "sales-team"
          }
        ],
        "title": "Abandoned checkout"
      }
    }
  ]
}

Save with the CLI

Use the MagicBell CLI to save this workflow to your project. You can also use the Workflows API endpoint instead.

magicbell workflow save \
  --data '{"key":"integration.stripe.checkout.session.expired","steps":[{"command":"broadcast","input":{"action_url":"{{payload.data.object.cancel_url}}","content":"Your checkout session for ${{payload.data.object.amount_total}} has expired. Please try again if you'd like to complete your purchase.","recipients":[{"external_id":"{{payload.data.object.customer}}"}],"title":"Your checkout session expired"}},{"command":"wait","input":{"duration":3600}},{"command":"broadcast","input":{"content":"Customer abandoned checkout for ${{payload.data.object.amount_total}}. Session ID: {{payload.data.object.id}}","overrides":{"providers":{"slack":{}}},"recipients":[{"external_id":"sales-team"}],"title":"Abandoned checkout"}}]}'

Event payload

Sample payload for the checkout.session.expired event. Use liquid templates to access fields in your workflow.

{
  "account": "",
  "api_version": "2025-08-27.basil",
  "context": "",
  "created": 1764060900,
  "data": {
    "object": {
      "adaptive_pricing": {
        "enabled": true
      },
      "after_expiration": null,
      "allow_promotion_codes": null,
      "amount_subtotal": 3000,
      "amount_total": 3000,
      "automatic_tax": {
        "enabled": false,
        "liability": null,
        "provider": null,
        "status": null
      },
      "billing_address_collection": null,
      "branding_settings": {
        "background_color": "#230f65",
        "border_style": "rounded",
        "button_color": "#ffdb00",
        "display_name": "Development",
        "font_family": "default",
        "icon": {
          "file": "file_1S546QIvz5j75CdbhyW2uqVd",
          "type": "file"
        },
        "logo": {
          "file": "file_1S546QIvz5j75CdbFySManCB",
          "type": "file"
        }
      },
      "cancel_url": "https://httpbin.org/post",
      "client_reference_id": null,
      "client_secret": null,
      "collected_information": null,
      "consent": null,
      "consent_collection": null,
      "created": 1764060900,
      "currency": "usd",
      "currency_conversion": null,
      "custom_fields": [],
      "custom_text": {
        "after_submit": null,
        "shipping_address": null,
        "submit": null,
        "terms_of_service_acceptance": null
      },
      "customer": null,
      "customer_creation": "if_required",
      "customer_details": null,
      "customer_email": null,
      "discounts": [],
      "expires_at": 1764147299,
      "id": "cs_test_a12NLNRTDZfLWpqJK716dbCpf1VlrrdwgWswtgrbaVKecbAFs0NEFCT5i4",
      "invoice": null,
      "invoice_creation": {
        "enabled": false,
        "invoice_data": {
          "account_tax_ids": null,
          "custom_fields": null,
          "description": null,
          "footer": null,
          "issuer": null,
          "metadata": {},
          "rendering_options": null
        }
      },
      "livemode": false,
      "locale": null,
      "metadata": {},
      "mode": "payment",
      "object": "checkout.session",
      "origin_context": null,
      "payment_intent": null,
      "payment_link": null,
      "payment_method_collection": "if_required",
      "payment_method_configuration_details": {
        "id": "pmc_1S546XIvz5j75CdbcYv3orKl",
        "parent": null
      },
      "payment_method_options": {
        "card": {
          "request_three_d_secure": "automatic"
        }
      },
      "payment_method_types": [
        "card"
      ],
      "payment_status": "unpaid",
      "permissions": null,
      "phone_number_collection": {
        "enabled": false
      },
      "recovered_from": null,
      "saved_payment_method_options": null,
      "setup_intent": null,
      "shipping_address_collection": null,
      "shipping_cost": null,
      "shipping_options": [],
      "status": "expired",
      "submit_type": null,
      "subscription": null,
      "success_url": "https://httpbin.org/post",
      "total_details": {
        "amount_discount": 0,
        "amount_shipping": 0,
        "amount_tax": 0
      },
      "ui_mode": "hosted",
      "url": null,
      "wallet_options": null
    },
    "previous_attributes": null
  },
  "id": "evt_1SXI1YIvz5j75CdbonrX4yFl",
  "livemode": false,
  "object": "event",
  "pending_webhooks": 3,
  "request": {
    "id": "req_pZHnJjTZvWuOZP",
    "idempotency_key": "09c1a782-437c-4b10-b83b-ac2c11bf1f11"
  },
  "type": "checkout.session.expired"
}
View all Stripe workflows →