UNPKG

momo-payment-lib

Version:

A simple TypeScript library to integrate the MTN MoMo API for payment requests and transaction status retrieval.

42 lines (40 loc) 1.03 kB
interface MoMoKeyConfig { apiUserId: string; apiKey: string; primaryKey: string; } interface MoMoClientConfig { collectionKey: MoMoKeyConfig; remittance: MoMoKeyConfig; environment?: 'sandbox' | 'production'; } interface PaymentRequest { amount: number; currency: string; phoneNumber: string; reference: string; } interface RemittanceRequest { amount: number; currency: string; receiverNumber: string; reason: string; reference: string; } declare class MoMoClient { private collectionKey; private remittance; private environment; constructor(config: MoMoClientConfig); private getBaseUrl; private getAuthToken; requestPayment(payment: PaymentRequest): Promise<{ referenceId: string; }>; getPaymentStatus(referenceId: string): Promise<any>; sendRemittance(remittance: RemittanceRequest): Promise<{ referenceId: string; }>; getRemittanceStatus(referenceId: string): Promise<any>; } export { MoMoClient };