@borapesa/pesa

Classes

ClassDescription
BasePaymentProviderAbstract base class every provider adapter must implement.
PesaErrorBase error class for all Bora Pesa errors.
PesaNetworkErrorThrown when a provider API is unreachable or returns a network error.
PesaProviderErrorThrown when the provider returns an error response (provider error).
PesaUnsupportedErrorThrown when a provider does not implement an optional operation.
PesaValidationErrorThrown when payload validation fails (client error).
PesaWebhookErrorThrown when a webhook fails signature verification.
SQLiteAdapterSQLite event store adapter powered by better-sqlite3.

Interfaces

InterfaceDescription
CancelOrderPayloadPayload for cancelling a pending or in-progress order.
CancelOrderResultResult returned after cancelling a payment order.
CreateOrderPayloadPayload for creating a payment order.
DisbursePayloadPayload for sending a disbursement (B2C / wallet-out).
DisburseResultResult returned after initiating a disbursement.
ListOrdersParamsParameters for listing payment orders.
ListOrdersResultResult returned when listing orders.
NameLookupResultResult of a name lookup — resolves the account holder name for a phone number or bank account before disbursing.
OrderResultResult returned after initiating a payment.
PaymentEventNormalized payment event — the source of truth for all payment activity.
PesaConfigConfiguration passed to createPesa.
PesaDatabaseAdapterDatabase adapter interface for the event store.
PesaHandlerTargetMinimal interface for the pesa instance that the handler needs. Defined here (not imported from pesa.ts) to avoid circular dependencies.
PesaInstanceFully configured payments SDK instance — returned by createPesa.
PesaPluginPlugin lifecycle hooks.
PreviewResultResult of a preview / dry-run validation before committing an action.
RefundResultResult returned after initiating a refund.
RequestContextContext passed to beforeRequest hooks. Allows plugins to inspect and modify the outgoing request.
ResponseContextContext passed to afterResponse hooks. Allows plugins to inspect the provider response and decide on retries.

Type Aliases

Type AliasDescription
CurrencySupported currencies.
MobileNetworkSupported mobile money networks for disbursement (B2C payouts).
PaymentEventTypeEvent types emitted after webhook verification and persistence.
PaymentStatusPayment lifecycle statuses.
ProviderNameAll supported payment providers.
TZSAmountTZS amount as a whole integer. 15000 = TZS 15,000.

Functions

FunctionDescription
createPesaThe single entry point for the entire Bora Pesa SDK.
createPesaHandlerCreates a generic fetch-like handler that can be mounted on any framework.
validateCreateOrderPayloadValidate a CreateOrderPayload before forwarding to the provider. Throws PesaValidationError on invalid input.
validateDisbursePayloadValidate a DisbursePayload before forwarding to the provider. Throws PesaValidationError on invalid input.

On this page