@paykernel/integration-express
v0.1.1
Published
Thin Express adapter for @paykernel/integration-http webhook handling (raw-body safe).
Maintainers
Readme
@paykernel/integration-express
Thin Express adapter for @paykernel/integration-http. Node-only.
import express from "express";
import { expressRawJson, expressWebhook } from "@paykernel/integration-express";
const app = express();
app.post("/webhooks/stripe", expressRawJson(), expressWebhook({
gateway: "stripe", client, engine, handler,
}));
app.post("/payments", express.json(), (req, res) => { ... });expressRawJson()isexpress.raw({ type: "application/json" })— use only on webhook routes.type-ishandles; charset=utf-8automatically (no custom type function needed).- Gateway-aware object-body: if
req.bodyis already a parsed object,tap/moyasar/paymob(object-HMAC gateways, seeintegration-http/src/process.ts:130) serialize viaJSON.stringifyand forward asrawBody; string-HMAC gateways (stripe,paypal,myfatoorah, etc.) fail-closed with400 { error: "invalid_webhook" }without calling the client (re-serialization would not be byte-identical). - Uses
req.headersandreq.querystring values. HandlesBuffer/string/Uint8Arraybodies (preservesBuffer.isBufferguard).
