UNPKG

@yengapay/nodejs-sdk

Version:

Official Node.js SDK for YengaPay - Accept mobile money payments and send payouts in West Africa

66 lines (64 loc) 1.86 kB
import { Environment } from './types'; import { Payout } from './modules/payout'; import { DirectPayment } from './modules/direct-payment'; /** * YengaPay SDK Client with Fluent Interface * * @example * ```typescript * const client = new YengaPayClient() * .withApiBaseURL('https://api.yengapay.com') // Optional, defaults to production * .withApiKey('your-api-key') * .withGroupId('your-group-id') * .withProjectId('your-project-id'); * * // Use Direct Payment * const payment = await client.directPayment.init({ amount: 1000 }); * * // Use Payout * const payout = await client.payout.create({ amount: 500, destNumber: '+22670123456', paymentMethod: 'ORANGE_MONEY' }); * ``` */ export declare class YengaPayClient { private config; private _directPayment?; private _payout?; constructor(); /** * Set the API base URL * @param url - Base URL for API requests (e.g., 'https://api.yengapay.com/api') */ withApiBaseURL(url: string): this; /** * Set the environment (automatically sets the base URL) * @param env - Environment ('production', 'staging', 'development') */ withEnvironment(env: Environment): this; /** * Set the API key for authentication * @param apiKey - Your YengaPay API key */ withApiKey(apiKey: string): this; /** * Set the group ID * @param groupId - Your YengaPay group ID */ withGroupId(groupId: string): this; /** * Set the project ID * @param projectId - Your YengaPay project ID */ withProjectId(projectId: string): this; /** * Get Direct Payment module */ get directPayment(): DirectPayment; /** * Get Payout module */ get payout(): Payout; /** * Validate that all required configuration is set */ private validateConfig; }