buy_airtime.ts
import { Dagpay } from '@dagpay/node';
const client = new Dagpay(process.env.DAG_SECRET_KEY);
// Instantly vend airtime
const response = await client.vtu.vend({
network: 'MTN',
amount: 5000,
phone: '08012345678',
reference: 'txn_987654321'
});
console.log(response.status); // SUCCESS
Built by Developers, For Developers.
Integrate robust VTU capabilities into your application in under 5 minutes. Clean REST APIs, comprehensive Webhooks, and typed SDKs.
Why choose our API?
Idempotent Requests
Safely retry failed requests without the risk of double-charging your wallet using unique transaction references.
Real-time Webhooks
Get instantly notified of transaction success, failures, or reversals directly to your server endpoints.
Sandbox Environment
Test your integration safely with unlimited mock transactions before pushing to production.
SDK Availability
Official libraries available for Node.js, PHP, Python, and Go, complete with robust Typescript definitions.