https://github.com/vernu/telebirrjs
hustle free telebirr integration package for node
https://github.com/vernu/telebirrjs
ethiopia fintech payment telebirr
Last synced: about 1 month ago
JSON representation
hustle free telebirr integration package for node
- Host: GitHub
- URL: https://github.com/vernu/telebirrjs
- Owner: vernu
- Created: 2022-05-04T13:04:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-22T12:53:29.000Z (almost 3 years ago)
- Last Synced: 2024-10-20T04:40:06.171Z (12 months ago)
- Topics: ethiopia, fintech, payment, telebirr
- Language: JavaScript
- Homepage: https://npmjs.com/package/telebirrjs
- Size: 6.84 KB
- Stars: 25
- Watchers: 2
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# telebirrjs
hustle free telebirr integration package for node
## Usage
install the package `npm i telebirrjs`
```javascript
const Telebirr = require('telebirrjs')const telebirr = new Telebirr({
appId: 'YOUR TELEBIRR APP ID',
appKey: 'YOUR TELEBIRR APP KEY',
shortCode: 'TELEBIRR SHORT CODE',
publicKey: 'YOUR TELEBIRR PUBLIC KEY',
})
const { success, response } = await telebirr.makePayment({
paymentMethod: 'web | app',
nonce: 'a unique random string ( should be unique for each request )',
notifyUrl: 'callback url for payment confirmation',
totalAmount: 4.5, // amount to charge
outTradeNo: 'unique identifier (order no)',
receiveName: 'company name',
returnApp: 'com.example.app', // your application package name
returnUrl: 'https://yourwebsite.com', // redirect url after payment completion'
subject: 'payment for',
timeoutExpress: '120', // valid for 2 hours
})
```## Handling callback notifications
- once user completes the payment, you'll receive an encrypted plaintext on the `notifyUrl` you provided.
- Make sure the endpoint accepts `plaintext` request body
- you need to decrypt the text to get the transaction details
```javascript
const {
msisdn, // the phone number from which the payment was done
outTradeNo, // unique identifier provided when creating the payment
totalAmount,
tradeDate,
tradeNo,
tradeStatus,
transactionNo,
} = telebirr.getDecryptedCallbackNotification(encryptedTextFromTelebirr)
```