Configuration
The SDK works with only a secretKey, but you can configure request behavior for production services.
const kyshi = new Kyshi({
secretKey: process.env.KYSHI_SECRET_KEY!,
environment: 'test',
timeoutMs: 30_000,
maxRetries: 2,
retryDelayMs: 250,
});Options
| Option | Type | Description |
|---|---|---|
secretKey | string | Required Kyshi secret key. |
environment | test or live | SDK environment label. Defaults to test. |
baseUrl | string | Optional custom API base URL. |
timeoutMs | number | Request timeout in milliseconds. Defaults to 30000. |
maxRetries | number | Default retry count for retryable requests. Defaults to 2. |
retryDelayMs | number | Initial retry delay in milliseconds. Defaults to 250. |
fetch | function | Optional custom Fetch implementation. |
Idempotency
For operations that create money movement or payment state, send stable references from your system.
await kyshi.transactions.initialize({
email: '[email protected]',
localCurrency: 'NGN',
amount: 1000,
reference: 'ORDER-10001',
});The SDK uses known references as idempotency keys for supported methods. You can also pass an explicit idempotency key through request options:
await kyshi.client.post(
'transfer',
{
beneficiaryId: 'beneficiary-id',
currency: 'NGN',
amount: 1000,
narration: 'Vendor payout',
},
{
idempotencyKey: 'PAYOUT-10001',
},
);Low-Level Client
Use the low-level client for supported HTTP methods when you need a route that is not yet wrapped by a resource method.
const result = await kyshi.client.get('transactions/history', {
query: { page: 1, limit: 10 },
});The client handles authentication, JSON parsing, query serialization, response unwrapping, request timeouts, and retries for safe requests.
