Skip to content

Laravel package for Tanda payments API

License

Notifications You must be signed in to change notification settings

james-muriithi/Tanda

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 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
  • KPLC prepaid tokens purcase
  • 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);

KPLC Prepaid - Tokens

This is used to generate tokens for KPLC prepaid meters.
Accepted parameters:

  1. Account - Meter number.
  2. Amount - Tokens amount (Should be between 10 and 35000).
$tokens = Tanda::buyTokens(54401184412, 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 - KPLC postpaid or Nairobi water (KPLC, NAIROBI_WTR).
  2. Account - A valid KPLC Postpaid / Nairobi Wtr Meter Number.
  3. Amount - Bill value in KES (Should be between 100 and 35000).
$bill = Tanda::billPay("KPLC", 25419321, 100);

Airtime Voucher

This method is used to generate airtime vouchers.
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 [email protected].

License

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

About

Laravel package for Tanda payments API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%