Core SDK JS
A comprehensive JavaScript SDK for interacting with the Mbanq payment API. Features type-safe payment operations, multi-tenant support, and Zod validation.
Features
- Type-Safe: Full TypeScript support with compile-time type checking
- Command Pattern: Clean, composable API commands
- Zod Validation: Runtime validation for all inputs and outputs
- Multi-Tenant: Built-in multi-tenant support
- Middleware: Extensible middleware system for logging and metrics
- OAuth 2.0: Secure authentication with 2FA support
Quick Start
javascript
import { createInstance, CreatePayment, GetTransfers } from '@mbanq/core-sdk-js';
const client = createInstance({
baseUrl: 'https://api.cloud.mbanq.com',
tenantId: 'your-tenant-id'
});
await client.connect({
credential: {
client_id: 'your-client-id',
client_secret: 'your-client-secret',
username: 'your-username',
password: 'your-password',
grant_type: 'password'
}
});
// Create payment
const payment = await client.request(CreatePayment({
amount: 100.00,
currency: 'USD',
paymentRail: 'ACH',
paymentType: 'CREDIT',
originator: { accountId: '123456789' },
recipient: {
name: 'Jane Smith',
accountNumber: '987654321',
accountType: 'SAVINGS',
recipientType: 'INDIVIDUAL',
address: {
line1: '789 Oak Ave',
city: 'Another Town',
stateCode: 'CA',
countryCode: 'US',
postalCode: '54321'
},
bankInformation: { routingNumber: '321070007' }
}
}));Installation
bash
npm install @mbanq/core-sdk-jsDocumentation
- Overview & Quick Start - Complete SDK overview
- Authentication - OAuth 2.0 and 2FA setup
- Middleware - Logging, metrics, and custom middleware
- Error Handling - Error types and handling strategies
- Type Safety - Zod validation and type definitions
- Examples - Complete usage patterns
