Skip to content

Authentication

The PayHero Africa API uses HTTP Basic authentication.

  1. Sign in to your PayHero dashboard.
  2. Generate an API key — this gives you a username and password pair.
  3. Store them securely as environment variables. Never commit them or expose them in client-side code.

These map to the Postman variables X-PH-API-USERNAME and X-PH-API-PASSWORD.

Pass the username and password as Basic auth credentials on every authenticated request:

Terminal window
curl https://api.payhero.africa/api/global/accounts/{vendor_id}/balance \
-u "$PH_API_USERNAME:$PH_API_PASSWORD"

The -u flag builds the header for you. Equivalently:

Authorization: Basic base64(<API_USERNAME>:<API_PASSWORD>)