Workflows / Stripe / charge.succeeded

Stripe Charge Succeeded Notification to Slack & Email

Use the Stripe integration by MagicBell to setup a workflow when charge.succeeded 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

  • Setup a webhook in Stripe with the URL from the last step.
  • Select the charge.succeeded event.
  • If you already have a webhook configured, make sure it includes this event.

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 charge.succeeded:

integration.stripe.charge.succeeded

Example workflow

Send a payment confirmation to the customer with a receipt link.

{
  "key": "integration.stripe.charge.succeeded",
  "steps": [
    {
      "command": "broadcast",
      "input": {
        "action_url": "{{payload.data.object.receipt_url}}",
        "content": "Thank you! Your payment of ${{payload.data.object.amount}} has been processed successfully.",
        "recipients": [
          {
            "external_id": "{{payload.data.object.customer}}"
          }
        ],
        "title": "Payment received"
      }
    }
  ]
}

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.charge.succeeded","steps":[{"command":"broadcast","input":{"action_url":"{{payload.data.object.receipt_url}}","content":"Thank you! Your payment of ${{payload.data.object.amount}} has been processed successfully.","recipients":[{"external_id":"{{payload.data.object.customer}}"}],"title":"Payment received"}}]}'

Event payload

Sample payload for the charge.succeeded event. Use liquid templates to access fields in your workflow.

{
  "api_version": "2023-10-16",
  "created": 1694108901,
  "data": {
    "object": {
      "amount": 2000,
      "amount_captured": 2000,
      "amount_refunded": 0,
      "billing_details": {
        "email": "customer@example.com",
        "name": "Jenny Rosen"
      },
      "captured": true,
      "created": 1694108901,
      "currency": "usd",
      "customer": "cus_Na6dX7aXxi11N4",
      "description": "Payment for Order #12345",
      "id": "ch_1NqIXRLkdIwHu7ixMfXbL9qY",
      "livemode": false,
      "object": "charge",
      "paid": true,
      "payment_intent": "pi_1NqIXRLkdIwHu7ixVP8MfXbL",
      "payment_method": "pm_1NqIXRLkdIwHu7ixMfXbL9qY",
      "receipt_email": "customer@example.com",
      "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTTJKVGtMa2RJd0h1N2l4",
      "refunded": false,
      "status": "succeeded"
    }
  },
  "id": "evt_1NqIXSLkdIwHu7ixGkH5Gx8v",
  "livemode": false,
  "object": "event",
  "type": "charge.succeeded"
}
View all Stripe workflows →