1.0.8 • Published 2 years ago

@myaswin123/asw-billplz v1.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

node-billplz

license img

Billplz API wrapper for nodejs. This module supports only Billplz API V3.

API Reference: https://www.billplz.com/api

NPM

Usage

Install

npm install asw-billplz

Create a client

const Billplz = require('asw-billplz')
const billplz = new Billplz('your-api-key')
Optional parameter (if needed)
const billplz = new Billplz({
  'key': 'your-api-key',
  'endpoint': 'https://www.billplz.com/api/v3/',
  'sandboxEndpoint': 'https://www.billplz-sandbox.com/api/v3/',
  'sandbox': true
})

Create a collection

billplz.create_collection({
  'title': 'My Noodle Shop'
}, function(err, res) {
  if (err) {
    //handle http client error
  }

  //success, do your stuff here
  console.log(res)
})

Create an open collection

billplz.create_collectionOpen({
  'title': 'Noodle Exhibition Ticket',
  'description': 'VVIP Ticket to Noodle Exhibition!',
  'amount': 25550, //RM255.50
  'reference_1_label': 'MyKAD',
  'reference_2_label': 'First Name'
}, function(err, res) {
  console.log(res)
})

Create a bill

billplz.create_bill({
  'collection_id': 'your-collection-id',
  'description': 'Mee Segera Sedap 200g',
  'email': 'sukamakan@meesegera.com',
  'name': 'Ahmad Segera',
  'amount': 550, //RM5.50
  'callback_url': "http://example.com/webhook/",
  'redirect_url': "http://example.com/thank-you",
  'due_at': '2016-08-31'
}, function(err, res) {
  console.log(res)
})

Retrieve a bill

billplz.get_bill('your-bill-id', function(err, res) {
  console.log(res)
})

Delete a bill

billplz.delete_bill('your-bill-id', function(err, res) {
  console.log(res)
})

Change a collection status

// activate or deactivate
billplz.change_collection_status('your-collection-id', 'status-here', function(err, res) {
  console.log(err);
})

Registration check

billplz.registration_check('your-bank-account-number', function(err, res) {
  console.log(res.name);
});
1.0.8

2 years ago

1.0.7

2 years ago