PAY HERO DOCS
  • Introduction-Pay Hero Developer APIs
  • Creating Account
  • Authorization
  • GET: Service Wallet Balance
  • GET: Payments Wallet Balance
  • POST: Service Wallet Top Up
  • POST: Initiate MPESA STK Push Request
  • Payment Button
  • Lipwa Link
  • POST: Pay Hero Wallet- Withdraw To Mobile
  • GET: Account Transactions
  • GET: Transaction Status
  • WooCommerce Plugin
    • Plugin Installation
  • Shopify
  • Videos
  • Other Integrations
  • Email API Reference
    • Register SMTP
    • Send Email
    • Mail status
  • WhatsApp API Reference
    • Introduction
    • Getting Started
    • Send API Whats App Text
    • Bulk WhatsApp API Messaging
    • Bulk WhatsApp Using UI/CSV File
Powered by GitBook
On this page
  • How To Generate Basic Auth Token Using API Username And Password
  • How To Get Basic Auth Token From UI

Was this helpful?

Authorization

For you to be able to use our APIs successfully, you have to generate or create your basic auth token

How To Generate Basic Auth Token Using API Username And Password

You will need your API username and password to do this. Below is a step by step process to get your API username and Password

  • Once logged in to your account, proceed to the API Keys menu

  • Under this page, you will see all your API keys, if you do not have one, you will need to create new

  • Once you create your api Keys. Copy your API username and Password.

Below is an example to generate your basicAuthToken using PHP, you can do the same using any other language of preference.

<?php
// Your API username and password
$apiUsername = 'your_username';
$apiPassword = 'your_password';
// Concatenating username and password with colon
$credentials = $apiUsername . ':' . $apiPassword;
// Base64 encode the credentials
$encodedCredentials = base64_encode($credentials);
// Creating the Basic Auth token
$basicAuthToken = 'Basic ' . $encodedCredentials;
// Output the token
echo $basicAuthToken;
?>

Once you have your basicAuthToken you can now use it in your API request headers

How To Get Basic Auth Token From UI

Once you have created your API Key on the success page you will find your Basic auth token that you can directly copy and use in your API requests headers

PreviousCreating AccountNextGET: Service Wallet Balance

Last updated 1 month ago

Was this helpful?

Basic Auth Token From UI