AutomationFlowsFinance › Payment Gateway - Create Invoice

Payment Gateway - Create Invoice

Payment Gateway - Create Invoice. Uses httpRequest, logger. Webhook trigger; 7 nodes.

Webhook trigger★★★★☆ complexity7 nodesHTTP RequestLogger
Finance Trigger: Webhook Nodes: 7 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": "Payment Gateway - Create Invoice",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "create-payment",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json.headers[\"x-acl-auth-key\"]}}",
              "operation": "equal",
              "value2": "={{$env.ACL_AUTH_KEY}}"
            }
          ]
        }
      },
      "name": "Security Guard",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        200,
        0
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\"error\": \"Unauthorized\", \"message\": \"Invalid security token\"}",
        "options": {
          "responseCode": 401
        }
      },
      "name": "Reject Request",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        200,
        200
      ]
    },
    {
      "parameters": {
        "url": "https://api.nowpayments.io/v1/invoice",
        "method": "POST",
        "authentication": "headerAuth",
        "headerAuth": {
          "name": "x-api-key",
          "value": "={{$env.NOWPAYMENTS_API_KEY}}"
        },
        "jsonParameters": true,
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "price_amount",
              "value": "={{$json.body.amount}}"
            },
            {
              "name": "price_currency",
              "value": "={{$json.body.currency || 'usd'}}"
            },
            {
              "name": "order_id",
              "value": "={{$json.body.planId}}-{{$now.toFormat('yyyyMMddHHmm')}}"
            },
            {
              "name": "order_description",
              "value": "Credit Recharge: {{$json.body.planId}}"
            },
            {
              "name": "ipn_callback_url",
              "value": "={{ ($env.WEBHOOK_URL ? ($env.WEBHOOK_URL.replace(/\\/+$/, '') + '/payment-ipn') : ($env.N8N_WEBHOOK_URL ? ($env.N8N_WEBHOOK_URL.replace(/\\/+$/, '') + '/payment-ipn') : (($env.N8N_BASE_URL ? ($env.N8N_BASE_URL.replace(/\\/+$/, '') + '/webhook/payment-ipn') : '')))) }}"
            }
          ]
        }
      },
      "name": "Create Invoice",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        400,
        0
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "checkoutUrl",
              "value": "={{$json.invoice_url}}"
            },
            {
              "name": "invoiceId",
              "value": "={{$json.id}}"
            },
            {
              "name": "success",
              "value": "true"
            }
          ]
        },
        "options": {}
      },
      "name": "Format Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "message": "\ud83e\uddfe New Invoice Created: {{$json.invoiceId}} for ${{$node[\"Webhook\"].json.body.amount}}",
        "options": {
          "level": "info"
        }
      },
      "name": "Log Transaction",
      "type": "n8n-nodes-base.logger",
      "typeVersion": 1,
      "position": [
        600,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{JSON.stringify($json)}}",
        "options": {}
      },
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        800,
        0
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Security Guard",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Security Guard": {
      "main": [
        [
          {
            "node": "Create Invoice",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reject Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Invoice": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log Transaction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

Payment Gateway - Create Invoice. Uses httpRequest, logger. Webhook trigger; 7 nodes.

Source: https://github.com/Aether-Connect-Labs/AcademicChain-Ledger/blob/main/n8n/workflows/create-payment.json — original creator credit. Request a take-down →

More Finance workflows → · Browse all categories →

Related workflows

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

Finance

AP Invoice — 01 Orchestrator. Uses postgres, httpRequest, quickbooks, slack. Webhook trigger; 42 nodes.

Postgres, HTTP Request, QuickBooks +1
Finance

Tired of the standard, boring invoices from QuickBooks Online? This workflow completely automates the process of creating beautiful, custom-branded PDF invoices and emailing them directly to your clie

QuickBooks, HTTP Request, Email Send
Finance

Automated QuickBooks Invoice to Custom PDF & Email

QuickBooks, HTTP Request, Email Send
Finance

It automatically saves new QuickBooks invoice PDFs directly into Google Drive, creating a reliable backup system. For perfect organization, the workflow uses keywords from the invoice, like the client

QuickBooks, Google Drive, HTTP Request
Finance

This is the ultimate sales-to-cash automation. When a deal in Airtable is marked "Approved for Invoicing," this workflow intelligently syncs customer data across QuickBooks and Stripe (creating them i

Airtable Trigger, Stripe, QuickBooks +2