UNPKG

nakapay-sdk

Version:

Node.js SDK for the NakaPay API to integrate Bitcoin Lightning payments.

102 lines 2.72 kB
/** * NakaPay Node.js SDK * A lightweight wrapper around the NakaPay API for Node.js applications */ export interface PaymentRequestOptions { amount: number; description: string; destinationWallet: string; metadata?: Record<string, any>; expiresIn?: number; } export interface Business { id: string; name: string; email: string; lightningAddress: string; webhookUrl?: string; webhookEvents?: string[]; createdAt: string; updatedAt: string; } export interface WebhookOptions { url: string; events: string[]; } export interface PaymentStatus { status: 'pending' | 'completed' | 'failed' | 'expired'; } export interface PaymentRequest { id: string; amount: number; description: string; status: string; invoice: string; destinationWallet: string; expiresAt: string; metadata?: Record<string, any>; createdAt: string; updatedAt: string; } export declare class NakaPay { private apiKey; private baseUrl; private client; /** * Initialize the NakaPay client * @param apiKey Your NakaPay API key * @param options Configuration options */ constructor(apiKey: string, options?: { baseUrl?: string; }); /** * Create a new payment request * @param options Payment request options * @returns Payment request details */ createPaymentRequest(options: PaymentRequestOptions): Promise<PaymentRequest>; /** * Get payment request details * @param id Payment request ID * @returns Payment request details */ getPaymentRequest(id: string): Promise<PaymentRequest>; /** * Get payment request status * @param id Payment request ID * @returns Payment status */ getPaymentStatus(id: string): Promise<PaymentStatus>; /** * Get current business profile * @returns Business profile information */ getBusinessProfile(): Promise<Business>; /** * Get payment history for your business * @param options Pagination options * @returns List of payment requests */ getPayments(businessId: string, options?: { limit?: number; offset?: number; }): Promise<PaymentRequest[]>; /** * Register a webhook for payment notifications * @param businessId Business ID * @param options Webhook options * @returns Success message */ registerWebhook(businessId: string, options: WebhookOptions): Promise<{ success: boolean; message: string; }>; /** * Handle API errors * @param error Error object */ private handleError; } export default NakaPay; //# sourceMappingURL=index.d.ts.map