AutomationFlowsData & Sheets › Stripe Purchase Auto-Credit Rewards

Stripe Purchase Auto-Credit Rewards

Original n8n title: Unifyone — Rewards Auto-credit on Purchase

UnifyOne — Rewards Auto-Credit on Purchase. Uses httpRequest. Webhook trigger; 5 nodes.

Webhook trigger★★★★☆ complexity5 nodesHTTP Request
Data & Sheets Trigger: Webhook Nodes: 5 Complexity: ★★★★☆ Added:

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": "UnifyOne \u2014 Rewards Auto-Credit on Purchase",
  "description": "Listens for Stripe checkout.session.completed webhook events and automatically credits Rewards Keys to the purchasing user. 1 credit per $1 spent.",
  "nodes": [
    {
      "id": "stripe-webhook",
      "name": "Webhook: Stripe Event",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        200,
        300
      ],
      "parameters": {
        "path": "stripe-rewards-credit",
        "httpMethod": "POST",
        "responseMode": "responseNode"
      }
    },
    {
      "id": "filter-checkout",
      "name": "Filter: checkout.session.completed",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        420,
        300
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.body.type }}",
              "operation": "equal",
              "value2": "checkout.session.completed"
            }
          ]
        }
      }
    },
    {
      "id": "extract-data",
      "name": "Extract Purchase Data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        640,
        200
      ],
      "parameters": {
        "jsCode": "const session = $input.first().json.body.data.object;\nconst amountTotal = session.amount_total || 0;\nconst credits = Math.floor(amountTotal / 100); // 1 credit per $1\nconst userId = session.metadata?.user_id || session.client_reference_id;\nreturn [{ json: { userId, credits, sessionId: session.id, amount: amountTotal } }];"
      }
    },
    {
      "id": "credit-api",
      "name": "HTTP: Credit Rewards Keys",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        860,
        200
      ],
      "parameters": {
        "method": "POST",
        "url": "={{ $env.UNIFYONE_API_URL }}/api/trpc/rewards.adminCredit",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $env.UNIFYONE_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "json",
        "body": {
          "json": {
            "userId": "={{ $json.userId }}",
            "credits": "={{ $json.credits }}",
            "reason": "=Purchase reward: Stripe session {{ $json.sessionId }}"
          }
        }
      }
    },
    {
      "id": "respond-ok",
      "name": "Respond: OK",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1080,
        300
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "{ \"received\": true }"
      }
    }
  ],
  "connections": {
    "Webhook: Stripe Event": {
      "main": [
        [
          {
            "node": "Filter: checkout.session.completed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: checkout.session.completed": {
      "main": [
        [
          {
            "node": "Extract Purchase Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond: OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Purchase Data": {
      "main": [
        [
          {
            "node": "HTTP: Credit Rewards Keys",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP: Credit Rewards Keys": {
      "main": [
        [
          {
            "node": "Respond: OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "envVarsRequired": [
      "UNIFYONE_API_URL",
      "UNIFYONE_API_KEY"
    ]
  }
}
Pro

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

About this workflow

UnifyOne — Rewards Auto-Credit on Purchase. Uses httpRequest. Webhook trigger; 5 nodes.

Source: https://github.com/t7451/unifyone-netlify-supabase/blob/5628fb97cc7e88522c6cbe0cbdbde238ce2ba6c2/n8n-workflows/rewards-auto-credit.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

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

Data & Sheets

This premium n8n workflow harnesses the power of DataForSEO's API combined with Airtable's relational database capabilities to transform your keyword research process, providing deeper insights for co

HTTP Request, Airtable
Data & Sheets

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Airtable, HTTP Request, Google Drive +1
Data & Sheets

This workflow automates the entire lifecycle of a service-based client, combining four distinct business flows into a single view: Intake Leads: Receives a webhook from your form builder, validates th

Airtable, Notion, Google Calendar +3
Data & Sheets

It intelligently syncs confirmed sales orders from your Airtable base to QuickBooks, automatically creating new customers if they don't exist before generating a perfectly matched invoice. It then log

Airtable, QuickBooks, HTTP Request
Data & Sheets

WorkFlow 12. Uses notion, httpRequest. Webhook trigger; 35 nodes.

Notion, HTTP Request