Skip to content

alvinmurimi/Tanda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tanda

Laravel package for Tanda payments API

Latest Version Issues Total Downloads

This package helps you integrate Tanda payment APIs into your laravel app.

The following APIs can be integrated through the package:

  • Airtime topup
  • Utility bill payments
  • Airtime voucher purchase
  • Pay TV subscriptions
  • Transaction status
  • Account balances

This package is based on Tanda's REST API which can be found here: https://docs.tanda.co.ke/reference

Installation

You can install this package via composer

composer require alvoo/tanda

Configuration

After installing the package, run;

php artisan tanda:install

or

php artisan vendor:publish

This will publish config/tanda.php file. This file is where you will add Tanda API configurations. By default, the configuration is set to sandbox so update to 'live' if you're using live credentials.

In your app's .env add your Tanda credentials as follows:

TANDA_CLIENT_ID=[Client ID]
TANDA_CLIENT_SECRET=[Client Secret]
TANDA_ORG_ID=[Organization ID]
TANDA_ENV=[sandbox or live]

The callback URLs MUST be updated in config/tanda.php.
After updating your .env update the config:

php artisan config:cache

Usage

Import Tanda Facade

use Tanda;

Airtime Purchase (Pinless prepaid airtime)

You can use this API for direct airtime topups.
Accepted parameters:

  1. Provider - Service provider ID SAFARICOM, AIRTEL, TELKOM.
  2. MSISDN - Phone number in international format.
  3. Amount - Recharge amount (Should be between 10 and 10000).
$topup = Tanda::pinlessAirtime("SAFARICOM", "254712345678", 100);

Pay Tv

This method is used to make payments for TV subscriptions.
Accepted parameters:

  1. Provider - Pay TV service provider(GOTV, DSTV, ZUKU, STARTIMES).
  2. Account - A valid box account number.
  3. Amount - Bill Amount (Should be between 10 and 20000).
$pay = Tanda::payTV("GOTV", 201712256, 100);

Bill Pay

Use this to make bill payments.
Accepted parameters:

  1. Provider - Nairobi water (NAIROBI_WTR).
  2. Account - A Nairobi Wtr Meter Number.
  3. Amount - Bill value in KES (Should be between 100 and 35000).
$bill = Tanda::billPay("NAIROBI_WTR", 25419321, 100);

Airtime Voucher

This method is used to generate airtime voucher pins which you can use to recharge normally as you would with scratch cards.
Accepted parameters:

  1. Provider - Service provider ID (SAFARICOM, TELKOM, AIRTEL).
  2. Amount - Voucher value.
    • Airtel - 20, 50, 100, 250, 500, 1000.
    • Safaricom - 20, 50, 100, 250, 500, 1000.
    • Telkom - 20, 50, 100, 200, 500, 1000.
$voucher = Tanda::voucherFix("SAFARICOM", 254712345678, 100);

Balance

This method is used to query the API for account balances.

$balances = Tanda::balances();

Transaction Status

Use this to query the transaction status API.
Accepted parameters:

  1. Transaction ID - Unique request id returned during the initialization stage.
$status = Tanda::query("ee92d1cb-625c-4e0a-8f28-8e86d929f9d7");

Contributing

Pull requests and issues are welcome. Refer to CONTRIBUTING.md

Security Vulnerabilities

If you discover any security vulnerability, please send an e-mail to alvinmayende@gmail.com.

License

This package is open-source software licensed under the MIT license.