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
-
Create a webhook endpoint on your server (e.g.,
/webhooks/payment). -
Add its URL when creating or updating your merchant.
-
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.