Home Developers Setting Up Webhooks (So Inkress Can Talk Back)

Setting Up Webhooks (So Inkress Can Talk Back)

Last updated on Sep 27, 2025

Inkress isnโ€™t just waiting for you to ask questions โ€” it also likes to send updates! Webhooks are how it tells your app when important stuff happens.

Why webhooks matter

Webhooks keep your app in sync without constant polling. Youโ€™ll get notifications like:

  • ๐ŸŸข Payment succeeded

  • ๐Ÿ”ด Payment failed

  • ๐Ÿ” Refund issued

  • ๐Ÿ†• Merchant registered

How to set one up

  1. Create a webhook endpoint on your server (e.g., /webhooks/payment).

  2. Add its URL when creating or updating your merchant.

  3. Inkress will send POST requests there whenever an event fires.

Example in Node.js

import express from "express";
import jwt from "jsonwebtoken";

const app = express();
app.use("/webhooks/payment", express.raw({ type: "application/json" }));

app.post("/webhooks/payment", (req, res) => {
  try {
    const payload = JSON.parse(req.body);
    const token = payload.jwt;

    const verified = jwt.verify(token, process.env.INKRESS_WEBHOOK_SECRET);

    switch (verified.status) {
      case "paid":
        console.log("๐ŸŽ‰ Order paid:", verified.order_id);
        break;
      case "failed":
        console.log("โŒ Payment failed:", verified.reason);
        break;
    }

    res.sendStatus(200);
  } catch (e) {
    res.status(400).send("Invalid signature");
  }
});

app.listen(3000);

What to keep in mind

  • Always verify the JWT โ€” itโ€™s your proof Inkress sent it.

  • Respond quickly with a 200.

  • Webhooks may retry โ€” make your handling idempotent.

If Inkress canโ€™t reach your endpoint (timeout, 500 error, etc.), itโ€™ll retry later โ€” so make sure your URL is public and stable.