node-xente-sdk
v1.0.3
Published
A node.js wrapper for the Xente Payment API
Downloads
2
Readme
Xente REST SDK for NodeJS
Installation
npm install xente-node-sdk --save
Usage
To write an application using the SDK
Register for a developer account and get your apikey at Xente Developer Portal.
Require 'xente-node-sdk' in your file
const Xente = require('xente-node-sdk');
Create authentication credentials, with parameters (apikey, password and mode).
const authCredentialsObject = { apiKey: '2E3B75363AD845478C457C11948A4F60', password: 'syfa1524729jy', mode: 'sandbox'; // 'live'; };
Initialized Xente class with authCredentialsObject
const xente = new Xente(authCredentialsObject);
Create a transaction information with the following required parameters.
const transactionCredentials = {
paymentProvider: 'MTNMOBILEMONEYUG',
amount: '50000',
message: 'Web Development Ebook',
customerId: 'string',
customerPhone: '256757476805',
customerEmail: '[email protected]',
customerReference: '256782872845',
batchId: 'batch001',
requestId: 'request001',
metadata: ''
};
- Create transaction and handle promised responses
xente.transaction.createTransaction(transactionCredentials)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
- Get Transaction Details with a specific transactionId
const transactionId = '9F38AB020C394EA5BC642C25A5CB16BF-256784378515';
xente.transaction
.getTransactionDetails(transactionId)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
- List all Payment providers
xente.paymentProvider
.getPaymentProviders()
.then(response => {
console.log(response.data.collection);
})
.catch(error => {
console.log(error);
});
Contributions
- If you would like to contribute, please fork the repo and send in a pull request.
Refactory Team Xente
- Olive Nakiyemba
- Kintu Declan Trevor
- Oketayot Julius Peter