@pouchpay/sdk
v0.0.13
Published
TypeScript SDK for PouchPay - On/Off-ramp API for African markets
Maintainers
Readme
sdk
Path: packages/sdk
Overview
TypeScript SDK for server-side and widget integrations with the PouchPay API.
Subfolders
packages/sdk/src/README.md— SDK source code (client, types, errors).
Files
package.json
Summary: SDK package manifest and build scripts. Functions: none.
tsconfig.json
Summary: TypeScript configuration for SDK builds. Functions: none.
Usage
import { PouchPayClient } from '@pouchpay/sdk';
const client = new PouchPayClient({
baseUrl: 'http://127.0.0.1:3002',
apiKey: 'YOUR_KEY'
});
const session = await client.createSession({
type: 'ONRAMP',
walletAddress: '0xabc...',
chain: 'EVM',
countryCode: 'NG',
currency: 'NGN',
amountFiat: 150000,
cryptoCurrency: 'USDT',
cryptoNetwork: 'TRC20'
});
const status = await client.getSession(session.id);Polling Example
const finalSession = await client.pollSession(session.id, {
untilStatus: ['PENDING_PAYMENT', 'COMPLETED'],
timeoutMs: 120000,
intervalMs: 3000
});Quote + Bank Networks
const quote = await client.getQuote(session.id);
const networks = await client.getBankNetworks(session.id);Error Handling
import { ApiError } from '@pouchpay/sdk';
try {
await client.getSession('missing-id');
} catch (err) {
if (err instanceof ApiError) {
console.error('API error', err.status, err.message, err.data);
}
}Server + Widget Usage
The SDK is safe for server-side use and can also be used in a browser/widget if a proxy or backend signs requests.
Notes
- The SDK uses the Fetch API. For Node <18, pass a
fetcherimplementation inPouchPayClientOptions. - API key authentication is applied via the
x-api-keyheader when configured. timeoutMsdefaults to 15s and can be configured per client instance.
