https://github.com/alexnguetcha/intouch-nodejs
This is a TypeScript library for the Intouch API. It provides an easy-to-use interface for integrating with the Intouch API in your NodeJs projects.
https://github.com/alexnguetcha/intouch-nodejs
gutouch intouch mobilemoney nodejs payment-integration
Last synced: 3 months ago
JSON representation
This is a TypeScript library for the Intouch API. It provides an easy-to-use interface for integrating with the Intouch API in your NodeJs projects.
- Host: GitHub
- URL: https://github.com/alexnguetcha/intouch-nodejs
- Owner: AlexNguetcha
- License: mit
- Created: 2023-03-22T10:39:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-28T16:22:31.000Z (about 2 years ago)
- Last Synced: 2024-03-25T14:03:10.941Z (about 1 year ago)
- Topics: gutouch, intouch, mobilemoney, nodejs, payment-integration
- Language: TypeScript
- Homepage:
- Size: 307 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Intouch NodeJs API Wrapper
This is a TypeScript library for the Intouch API. It provides an easy-to-use interface for integrating with the Intouch API in your NodeJs projects.
## Intallation
To use this library, you will need to install the `intouch-api-wrapper` package from NPM.
```bash
npm i intouch-api-wrapper
```# Usage
To use this library, first import it and create an instance with your Intouch credentials:
```js
require('dotenv').config()
const intouch = require('intouch-api-wrapper')const intouchPayment = intouch.Intouch.credentials({
username: process.env.DIGEST_AUTH_USE
password: process.env.DIGEST_AUTH_PASSWORD ?? '',
loginAgent: process.env.LOGIN_AGENT ?? '',
passwordAgent: process.env.PASSWORD_AGENT ?? '',
intouchId: process.env.INTOUCH_ID ?? '',
})```
## Checking your balance
```js
const balance = await intouchPayment
.operator(Intouch.SUPPORTED_OPERATORS[0])
.partnerId(process.env.PARTNER_ID ?? '')
.getBalance();// retrieve balance amount
balance.then((res)=>{
console.log(res.amount)
// Response
// {
// "status": null,
// "amount": 988750,
// "errorCode": "200",
// "errorMessage": "SUCCESSFUL"
// }
}).catch((err)=>{
// Something went wrong !
console.log(err)
})```
## Make merchant payment
```js
const additionnalInfos = {
recipientEmail: "[email protected]",
recipientFirstName: "John",
recipientLastName: "Doe",
}const merchantPayment = await intouchPayment.callback("https://app.test")
.partnerId("YOUR_PARTNER_ID")
.operator('ORANGE')
.phone('695xxxx0x')
.amount(500)
.makeMerchantPayment(additionnalInfos);
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.log(err))// Response
// {
// "idFromClient": "1679582194250",
// "idFromGU": "1679582196117",
// "amount": 1575.0,
// "fees": 3.75,
// "serviceCode": "CM_PAIEMENTMARCHAND_OM_TP",
// "recipientNumber": "695xxxx0x",
// "dateTime": 1679582196117,
// "status": "INITIATED",
// "numTransaction": "MP230323.1536.Bxxxxx",
// "payment_url": null,
// "codeMarchand": null,
// "qrCode": null,
// "validity": null,
// "deepLink": null
// }```