{
  "schema_version": "1.0.0",
  "id": "shopify-refund-alert",
  "title": "Log Shopify refunds and tell finance",
  "category": "ecommerce",
  "difficulty": "beginner",
  "featured": false,
  "description": "Write every Shopify refund to the finance sheet with its reason and post it to the finance channel the moment it is issued.",
  "tags": [
    "shopify",
    "refunds",
    "finance",
    "google-sheets",
    "slack"
  ],
  "apps": [
    "Shopify",
    "Google Sheets",
    "Slack"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 2 steps after the trigger",
      "premium app: Shopify"
    ]
  },
  "tasks": {
    "typical": 2,
    "max": 2
  },
  "trigger": {
    "app": "Shopify",
    "event": "New Refund",
    "kind": "instant",
    "title": "New refund",
    "why": "Fires when a refund is created on any order, full or partial.",
    "config": {
      "Store": "YOUR_STORE"
    },
    "outputs": [
      "id",
      "order_id",
      "order_name",
      "refund_amount",
      "currency",
      "note",
      "customer_email",
      "restock",
      "created_at"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "log",
      "kind": "action",
      "app": "Google Sheets",
      "event": "Create Spreadsheet Row",
      "title": "Add the refund to the finance sheet",
      "why": "One row per refund with the note the staff member typed, which is the reason finance will ask about.",
      "fields": {
        "Drive": "My Google Drive",
        "Spreadsheet": "Finance",
        "Worksheet": "Refunds",
        "Columns": {
          "refunded_at": "{{trigger.created_at}}",
          "order": "{{trigger.order_name}}",
          "amount": "{{trigger.refund_amount}}",
          "currency": "{{trigger.currency}}",
          "reason": "{{trigger.note}}",
          "restocked": "{{trigger.restock}}",
          "customer": "{{trigger.customer_email}}"
        }
      },
      "outputs": [
        "id",
        "row_number"
      ]
    },
    {
      "key": "tell",
      "kind": "action",
      "app": "Slack",
      "event": "Send Channel Message",
      "title": "Post it to #finance",
      "why": "A one-line heads-up so the payout difference is never a surprise.",
      "fields": {
        "Channel": "#finance",
        "Message Text": "Refund on {{trigger.order_name}}: {{trigger.refund_amount}} {{trigger.currency}}. Reason: {{trigger.note}}. Restocked: {{trigger.restock}}. Sheet row {{log.row_number}}.",
        "Send as a bot?": "Yes",
        "Bot Name": "Zap alerts",
        "Include a link to this Zap?": "No"
      },
      "outputs": [
        "ts",
        "permalink"
      ]
    }
  ]
}
