Skip to content

NeaByteLab/Digiflazz-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DigiFlazz API Client (Node.js)

A simple Node.js wrapper to interact with DigiFlazz API.
Supports checking balance, getting product price list, and processing transactions.

πŸ“¦ Installation

npm install

Make sure you have axios and crypto available.
crypto is built-in, but you can install axios if needed:

npm install axios

πŸ“ File Structure

.
β”œβ”€β”€ src/
β”‚   └── digiflazz.js     # DigiFlazz API Client class
β”œβ”€β”€ example/
β”‚   └── index.js         # Example usage
└── README.md

πŸš€ Usage Example

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()

βœ… Available Methods

checkBalance()

Check account balance.

getPriceList()

Fetch available product price list.

processTransaction(id_product, customer_no, ref_id, desc, isTesting = false)

Create a new transaction.
If ref_id has been used before, DigiFlazz will return the status of the existing transaction.


πŸ“Œ Notes

  • 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.

πŸͺͺ License

MIT Β© 2025 NeaByteLab

About

Node.js wrapper for DigiFlazz API - check balance, get price list, and run transactions easily.

Topics

Resources

Stars

Watchers

Forks