AutomationFlowsSlack & Telegram › Safe Refund with Outcome Contract

Safe Refund with Outcome Contract

Safe refund with outcome contract. Uses postgres, httpRequest, slack. Webhook trigger; 9 nodes.

Webhook trigger★★★★☆ complexity9 nodesPostgresHTTP RequestSlack
Slack & Telegram Trigger: Webhook Nodes: 9 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Postgres recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Safe refund with outcome contract",
  "nodes": [
    {
      "id": "webhook",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "authentication": "headerAuth",
        "path": "refund"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "idempotency",
      "name": "Claim idempotency event",
      "type": "n8n-nodes-base.postgres",
      "parameters": {
        "operation": "executeQuery",
        "query": "INSERT INTO event_ledger (event_id) VALUES ($1) ON CONFLICT (event_id) DO NOTHING RETURNING event_id"
      }
    },
    {
      "id": "audit",
      "name": "Record refund audit",
      "type": "n8n-nodes-base.postgres",
      "parameters": {
        "operation": "insert",
        "table": "refund_audit"
      }
    },
    {
      "id": "approval",
      "name": "Approve refund",
      "type": "n8n-nodes-base.if",
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.approved }}",
              "value2": true
            }
          ]
        }
      }
    },
    {
      "id": "amount",
      "name": "Limit refund amount",
      "type": "n8n-nodes-base.if",
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.amount }}",
              "operation": "smallerEqual",
              "value2": 500
            }
          ]
        },
        "currency": "USD"
      }
    },
    {
      "id": "counterparty",
      "name": "Allow refund account",
      "type": "n8n-nodes-base.switch",
      "parameters": {
        "value": "={{ $json.counterparty }}",
        "rules": [
          {
            "value": "merchant-primary"
          }
        ]
      }
    },
    {
      "id": "refund",
      "name": "Issue refund",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "parameters": {
        "method": "POST",
        "url": "https://payments.invalid/refund"
      }
    },
    {
      "id": "failure-alert",
      "name": "Notify refund failure",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "operations",
        "text": "Notify failure for refund {{ $json.event_id }}"
      }
    },
    {
      "id": "compensation",
      "name": "Compensate transaction",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://payments.invalid/reverse",
        "operation": "compensate"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Claim idempotency event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claim idempotency event": {
      "main": [
        [
          {
            "node": "Record refund audit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record refund audit": {
      "main": [
        [
          {
            "node": "Approve refund",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approve refund": {
      "main": [
        [
          {
            "node": "Limit refund amount",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Limit refund amount": {
      "main": [
        [
          {
            "node": "Allow refund account",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Allow refund account": {
      "main": [
        [
          {
            "node": "Issue refund",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Issue refund": {
      "main": [
        [],
        [
          {
            "node": "Notify refund failure",
            "type": "main",
            "index": 0
          },
          {
            "node": "Compensate transaction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionTimeout": 120,
    "errorWorkflow": "global-error-handler"
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Safe refund with outcome contract. Uses postgres, httpRequest, slack. Webhook trigger; 9 nodes.

Source: https://github.com/domfelipe/vibeflow-n8n/blob/main/examples/safe-refund.workflow.json — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

This workflow automates end-to-end research analysis by coordinating multiple AI models—including NVIDIA NIM (Llama), OpenAI GPT-4, and Claude to analyze uploaded documents, extract insights, and gene

HTTP Request, Postgres, Slack +1
Slack & Telegram

QA Platform — Jira Story to Test Workflow. Uses jiraTrigger, postgres, httpRequest, slack. Webhook trigger; 20 nodes.

Jira Trigger, Postgres, HTTP Request +1
Slack & Telegram

Automação de Chargeback - Contestação SaaS. Uses httpRequest, postgres, emailSend, slack. Webhook trigger; 14 nodes.

HTTP Request, Postgres, Email Send +1
Slack & Telegram

Advanced Workflow with Branching and Error Handling. Uses emailSend, httpRequest, postgres, slack. Webhook trigger; 12 nodes.

Email Send, HTTP Request, Postgres +1
Slack & Telegram

Flujowhatsapp. Uses @aldinokemal2104/n8n-nodes-gowa, postgres, httpRequest. Webhook trigger; 65 nodes.

@Aldinokemal2104/N8N Nodes Gowa, Postgres, HTTP Request