UNPKG

@moneygraph/sdk

Version:

AI-native SDK for global payouts powered by StratosPay

100 lines (99 loc) 3.23 kB
/** * MoneyGraph SDK * * AI-native SDK for global payouts powered by StratosPay. * * @example * ```typescript * import { MoneyGraph } from '@moneygraph/sdk'; * * const mg = new MoneyGraph({ apiKey: 'sk_test_...' }); * * // Create a customer * const customer = await mg.onboard.createCustomer({ * account_type: 'personal', * first_name: 'John', * last_name: 'Doe', * email: 'john@example.com', * phone: '2025551234', * phone_iso2: 'US', * country: 'US', * }); * * // Get an FX quote * const quote = await mg.liquidity.getQuote({ * from: 'USD', * to: 'NGN', * amount: 100, * }); * * // Confirm the quote * const confirmation = await mg.liquidity.confirmQuote(quote.id); * * // Send payout (requires KYC approval) * const payout = await mg.payouts.send({ * quote_id: quote.id, * customer_id: customer.id, * recipient: { * name: 'Jane Doe', * bank_code: '058', * account_number: '0123456789', * }, * }); * ``` */ import { type ApiMode } from './api/client'; import { OnboardModule } from './modules/onboard'; import { LiquidityModule } from './modules/liquidity'; import { PayoutsModule } from './modules/payouts'; import { ReferenceModule } from './modules/reference'; import { PaymentsModule } from './modules/payments'; export interface MoneyGraphOptions { /** API key (sk_test_* for sandbox, sk_live_* for live) */ apiKey: string; /** Public key for client-side payment widgets (pk_test_* or pk_live_*) */ publicKey?: string; /** Custom base URL (optional) */ baseUrl?: string; /** Request timeout in ms (default: 30000) */ timeout?: number; } export declare class MoneyGraph { private readonly client; private readonly publicKey; /** Customer onboarding, KYC, directors, wallets */ readonly onboard: OnboardModule; /** FX quotes and rate locking */ readonly liquidity: LiquidityModule; /** Global payouts with KYC enforcement */ readonly payouts: PayoutsModule; /** Reference data (countries, currencies, MCC, etc.) */ readonly reference: ReferenceModule; /** Accept payments via cards, widget, or popup */ readonly payments: PaymentsModule; constructor(options: MoneyGraphOptions); /** Current API mode (sandbox or live) */ get mode(): ApiMode; /** Whether currently in sandbox mode */ get isSandbox(): boolean; /** Whether currently in live mode */ get isLive(): boolean; /** * Complete payout flow helper * Combines quote, confirm, and send into a single call */ sendPayout(params: { customerId: string; from: import('./types').PayInCurrency; to: import('./types').PayoutCurrency; amount: number; recipient: import('./types').PayoutRecipient; reference?: string; narration?: string; }): Promise<import('./types').Payout>; } export * from './types'; export { MoneyGraphError, type ApiMode } from './api/client'; export { TEST_CARDS } from './modules/payments'; export type { PaymentParams, CardPaymentParams, WidgetConfig, PaymentResult, PaymentStatus, PaymentCustomer, BillingAddress, CardDetails } from './modules/payments'; export default MoneyGraph;