This package is meant to decode the hashed phone numbers. The use case on receipt of a notification from Mpesa once a customer has paid to your Paybill Number.
The phone number received from Mpesa Confirmation Endpoint is normally hashed. This package will assist in decoding it to give you plain text phone number.
Also you can query the hashed equivalent of a phone number.
npm install mpesa-hash-decoder
import {decodePhone,fetchHashed} from 'mpesa-hash-decoder'; // Typescript
const {decodePhone,fetchHashed} = require('mpesa-hash-decoder'); // Javascript
let result = await decodePhone('string-value-of-your-hash');
// Expected output.
{
phone:"decoded_phone_number",
hashed:"hashed_equivalent"
}
let result = await decodePhone('string-value-of-your-phone');
// Expected output.
{
phone:"decoded_phone_number",
hashed:"hashed_equivalent"
}