A simple Node.js wrapper to interact with DigiFlazz API.
Supports checking balance, getting product price list, and processing transactions.
npm install
Make sure you have
axios
andcrypto
available.
crypto
is built-in, but you can install axios if needed:
npm install axios
.
├── src/
│ └── digiflazz.js # DigiFlazz API Client class
├── example/
│ └── index.js # Example usage
└── README.md
const DigiFlazz = require('../src/digiflazz')
async function main() {
const USERNAME = ''
const API_KEY = ''
const digiflazz = new DigiFlazz(USERNAME, API_KEY)
console.log('📌 Checking balance...')
const balance = await digiflazz.checkBalance()
console.log('Balance:', balance)
console.log('\n📌 Fetching price list...')
const prices = await digiflazz.getPriceList()
console.log('Number of products:', prices.length)
console.log('First product:', prices[0])
console.log('\n📌 Running test transaction / check transaction...')
const dataTrx = ['xldata5k', '085712345678', 'INV1234567890', 'Pembelian Pulsa Test', true]
const trx = await digiflazz.processTransaction(...dataTrx)
console.log('Transaction result:', trx)
}
main()
Check account balance.
Fetch available product price list.
Create a new transaction.
If ref_id
has been used before, DigiFlazz will return the status of the existing transaction.
- The
ref_id
must be unique for every transaction attempt. - If you send the same
ref_id
again, DigiFlazz will return the existing transaction result, not create a new one. - Use testing mode (
isTesting = true
) to safely simulate transactions.
MIT © 2025 NeaByteLab