Overview
This library provides a comprehensive JavaScript SDK for interacting with the Mbanq payment API. It offers type-safe payment operations with built-in validation, multi-tenant support, and a modern fluent API design.
Installation
bash
npm install @mbanq/core-sdk-jsQuick 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' }
}
}));
// Get transfers
const transfers = await client.request(GetTransfers({
transferStatus: 'EXECUTION_SCHEDULED',
executedAt: '2025-01-22',
paymentType: 'ACH',
queryLimit: 200
}));Supported Payment Rails
ACH- Automated Clearing HouseSAMEDAYACH- Same Day ACHWIRE- Domestic Wire TransferSWIFT- International Wire TransferINTERNAL- Internal TransferFXPAY- Foreign Exchange PaymentCARD- Card Payment
Payment Statuses
DRAFT,AML_SCREENING,AML_REJECTEDEXECUTION_SCHEDULED,EXECUTION_PROCESSING,EXECUTION_SUCCESS,EXECUTION_FAILURERETURNED,CANCELLED,COMPLIANCE_FAILURE,DELETED,UNKNOWN
Next Steps
- Authentication - Set up OAuth 2.0 and 2FA
- Middleware - Add logging and metrics
- Error Handling - Handle errors gracefully
- Type Safety - Learn about Zod validation