@payhos/api
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

PayHos API SDK

PayHos is an easy go-to solution for many day-to-day fintech problems by providing an easily accessible opportunities to all and sundry with minimal bar of entry. For a full documentations of PayHos API and fully supported features, visit PayHos API Docs It is provided by EmbyBest Concept Nig. Ltd

This API SDK is intended to assist web applications of any kind to interact with the PayHos API server by utilizing its simple schematics. For a more modular usage, this library is designed such that bundlers with tree-shaking is enhanced.

Installation

Install @payhos/api via npm by running the following command:

npm install @payhos/api --save

Usage

Create an instance and call available methods from the instance created.

import { PayHos } from '@payhos/api';

// or
const { PayHos } = require('@payhos/api');

const payhos = new PayHos('<YOUR API TOKEN>');

// You can access each of PayHos' API features as follows:
const sms = payhos.sms;
const airtime = payhos.airtime;
const email = payhos.email;

SMS

Visit Send SMS with PayHos for more information on SMS dodumentations.

const sms = payhos.sms;
const data = {
  message: 'Hello there, this is a test message from PayHos SDK',
  recipients: ['+2348166666666', '+2348055555555'],
  flash: false,
  senderId: 'PayHos',
};

// to send SMS
sms.send(data).then(response => {
  // message(s) sent successfully
  console.log(response);
}).catch(err => {
  console.log(err);
});

Email

For detailed documentations on sending emails with PayHos API and other supported SDKs, visit Sending Emails with PayHos

const email = payhos.email;
const data = {
  subject: 'Test Email',
  content: `Hey <strong>Alice</strong>, this is a test email message from <a href="https://payhos.com">PayHos API Hub</a>`,
  customData: {},
  recipients: [
    {email: 'example@example.com'},
    { name: 'Alice', email: 'example2@example.com' }
  ],
  from: {
    name: 'PayHos',
    email: 'test@test.com'
  }
};

// to send email
email.send(data).then(response => {
  // message(s) sent successfully
  console.log(response);
}).catch(err => {
  console.log(err);
});

Airtime

const airtime = payhos.airtime;

// Coming soon...

Further Reading

Have a look at other packages:

Package Sidebar

Install

npm i @payhos/api

Homepage

payhos.com

Weekly Downloads

2

Version

1.1.0

License

ISC

Unpacked Size

22.4 kB

Total Files

29

Last publish

Collaborators

  • tumba