Skip to main content
FintechSDK is the main class you interact with. It wraps a provider instance created by ProviderFactory and exposes the two core methods: pay() and registerIpn().

Constructor

ProviderType | string
required
The provider to use. Use ProviderType enum values: ProviderType.pesapal or ProviderType.clickpesa. String values ("pesapal", "clickpesa") are also accepted and matched case-insensitively.
object
required
Provider-specific configuration object. Must include baseUrl and the required credentials for the chosen provider. See ProviderFactory for the full list of required fields per provider.
Throws: "Invalid configuration: Missing required fields for [Provider]" if any required config fields are absent.

sdk.pay()

Initiates a USSD push payment. For PesaPal, the ipnId is merged into the payload as notification_id. For ClickPesa, data is sent directly without modification.
any
required
Payment payload. The required fields depend on the provider — see the provider-specific guides for payload structure.
string
IPN ID returned by registerIpn(). Required for PesaPal payments. Not used by ClickPesa.
Returns: Provider response object. Shape varies by provider. Throws: "Payment request failed: ..." on error.

sdk.registerIpn()

Registers an IPN (Instant Payment Notification) URL with the provider. Currently only supported by PesaPal — calling this method with a ClickPesa instance throws an error.
string
required
Publicly accessible URL that the provider will call when a payment status changes. Must be HTTPS in production.
"GET" | "POST"
required
HTTP method the provider uses when delivering notifications. Defaults to "GET" in FintechSDK.
Returns: The ipn_id string returned by PesaPal. Pass this value as the second argument to sdk.pay(). Throws: "IPN registration not supported by this provider" when called with a ClickPesa instance.
Register your IPN URL once at application startup and store the returned ipnId. You do not need to re-register on every payment request.