Skip to content

Waynelynx12/shopify-webhook-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopify Webhook Handler

License Node Express Status

A production-ready Node.js server that receives, verifies, and processes Shopify webhooks in real time. Built for stores that need reliable order confirmation, payment status sync, and event-driven automation without third party app overhead.


The Problem This Solves

Most Shopify stores handle webhooks poorly. Unverified endpoints, no signature checking, no error handling. One bad actor spoofing a payload and your order logic fires on fake data. This handler eliminates that entirely.


Architecture

graph TD
    A[Shopify Store] -->|Fires Webhook| B[POST /api/webhooks]
    B --> C{Verify HMAC Signature}
    C -->|Invalid| D[401 Unauthorized]
    C -->|Valid| E[Extract Topic & Payload]
    E --> F{Route by Topic}
    F -->|orders/create| G[Handle New Order]
    F -->|orders/paid| H[Handle Payment]
    F -->|orders/cancelled| I[Handle Cancellation]
    F -->|checkouts/create| J[Handle Checkout]
    G & H & I & J --> K[200 Success Response]
Loading

Supported Webhook Events

Topic Description
orders/create Fires when a new order is placed
orders/paid Fires when payment is confirmed
orders/cancelled Fires when an order is cancelled
checkouts/create Fires when a checkout session starts

Sample Webhook Payload

Incoming Request:

{
  "headers": {
    "x-shopify-topic": "orders/paid",
    "x-shopify-hmac-sha256": "base64_encoded_signature"
  },
  "body": {
    "order_number": 1234,
    "email": "customer@example.com",
    "total_price": "149.99",
    "currency": "USD",
    "financial_status": "paid"
  }
}

Server Response:

{
  "success": true,
  "message": "Webhook processed: orders/paid"
}

Quick Start

git clone https://github.com/Waynelynx12/shopify-webhook-handler.git
cd shopify-webhook-handler
npm install
cp .env.example .env
npm run dev

Environment Variables

Variable Description
SHOPIFY_WEBHOOK_SECRET Found in Shopify Admin > Settings > Notifications
PORT Server port, defaults to 3000
SHOPIFY_ACCESS_TOKEN Your store access token

Health Check

Once running, hit this endpoint to confirm the server is live:

GET http://localhost:3000/health
{
  "status": "online",
  "service": "Shopify Webhook Handler",
  "timestamp": "2026-05-30T14:00:00.000Z"
}

Built By

Sheriff Wayne, Growth Engineer and Shopify Technical Specialist. I build native code solutions for ecommerce stores that need reliability without app dependency.

About

Lightweight Node.js handler for verifying and processing Shopify webhooks. Built for payment confirmations, order events, and real time store automation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors