// Type definitions for paystack 2.0 // Project: https://github.com/kehers/paystack // Definitions by: Oladiran Segun Solomon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /*~ Note that ES6 modules cannot directly export callable functions. *~ This file should be imported using the CommonJS-style: *~ import x = require('someLibrary'); *~ *~ Refer to the documentation to understand common *~ workarounds for this limitation of ES6 modules. */ /*~ This declaration specifies that the function *~ is the exported object from the file */ export = Paystack; declare function Paystack(secret_key: string): Paystack.Object; declare namespace Paystack { interface Object { customer: { create: (params: {first_name: string; last_name: string; email: string; phone: string; metadata?: any}) => Promise; get: (id: number | string) => Promise; list: () => Promise; update: ( id: number | string, params: {first_name: string; last_name: string; email: string; phone: string}, ) => Promise; }; misc: { list_banks: (params: {perPage: number; page: number}) => Promise; resolve_bin: (bin: string) => Promise; }; page: { create: (params: {name: string; description?: string; amount: number; [key: string]: any}) => Promise; get: (id_or_slug: number | string) => Promise; list: () => Promise; update: ( id_or_slug: number, params: {name?: string; description?: string; amount?: number; active?: boolean}, ) => Promise; slug: (slug: string) => Promise; }; plan: { create: (params: {name: string; amount: number; interval: string; [key: string]: any}) => Promise; get: (id: number | string) => Promise; update: (id: number | string, params: any) => Promise; list: () => Promise; }; subscription: { create: (params: {customer: string; plan: string; authorization: string; start_date?: Date}) => Promise; disable: (params: {code: string; token: string}) => Promise; enable: (params: {code: string; token: string}) => Promise; get: (id_or_subscription_code: string) => Promise; list: () => Promise; }; subaccount: { create: (params: { business_name: string; settlement_bank: string; account_number: string; percentage_charge: number; }) => Promise; get: (id_or_slug: number | string) => Promise; list: (param?: any) => Promise; update: (id_or_slug: number | string, params: any) => Promise; }; transaction: { charge: (params: {reference: string; authorization_code: string; email: string; amount: number}) => Promise; get: (id: number | string) => Promise; initialize: (params: {amount: number; reference: string; name: string; email: string, [key: string]: any}) => Promise; list: () => Promise; totals: () => Promise; verify: (transReference: string) => Promise; }; } // Transactions initialization success object interface Response { status: boolean; message: string; data?: any; [others: string]: any; } }