Skip to content

CreateCallbackHandlerOptions

Defined in: src/callbacks/receiver.ts:36

optional onNotFound: (req, res) => void

Defined in: src/callbacks/receiver.ts:46

Called when no route matches (default: 404).

IncomingMessage

ServerResponse

void


optional onParseError: (err, req, res) => void

Defined in: src/callbacks/receiver.ts:44

Called when body parse fails; can send custom response (default: 400 + error message).

MpesaCallbackError

IncomingMessage

ServerResponse

void


routes: Record<string, CallbackRoute<unknown>>

Defined in: src/callbacks/receiver.ts:38

Path -> route. Path should match req.url pathname (e.g. “/mpesa/stk”).


optional successBody: string | Record<string, unknown>

Defined in: src/callbacks/receiver.ts:42

Body sent on success (default “OK”). Can be string or object (sent as JSON).


optional successStatus: number

Defined in: src/callbacks/receiver.ts:40

Status code for successful handling (default 200).