A node.js client library for the Unbill API.
$ npm install unbill
var Unbill = require('unbill')(unbillKey)
var Unbill = require('unbill')(unbillKey)
Unbill.auth({
userId: userId,
companyId: companyId,
form: {
username: 'username',
password: 'password'
}
})
.then(function (response) {
if (response.status === 200) {
var billData = response.data
return billData
}
else if (response.status === 201) {
return Unbill.authStep({
token: response.data.token,
mfa: ['Secret Answer']
})
.then(function (response) {
// Repeat until 200 status is returned
})
}
})
.catch(function (e) {
var errMessage = e.response.data.message
))
The module supports all Unbill API endpoints. For complete information about the API, head over to the docs.
Every function requires a payload
as specified by the docs and returns a promise that can be used to access the response of the call.
// Auth
Unbill.auth(payload)
// Auth step
Unbill.authStep(payload)
// Bill details
Unbill.getBillDetails(payload)
// Bill list
Unbill.getBills(payload)
// Fix bill hold
Unbill.fixBillHold(payload)
// Remove bill
Unbill.removeBill(payload)
// Get company
Unbill.getCompany(payload)
// Search companies
Unbill.searchCompanies(payload)
// Get company categories
Unbill.getCompanyCategories(payload)
// Add payment method
Unbill.addPaymentMethod(payload)
// Get payment method
Unbill.getPaymentMethod(payload)
// Retry payment method
Unbill.retryPaymentMethod(payload)
// Update autopay
Unbill.updateAutopay(payload)
// Make payment
Unbill.makePayment(payload)
// Create user
Unbill.createUser
We’ve tried to make this documentation user-friendly and example-filled, but please drop us a line with any questions.