anexponent/interswitch

Laravel Interswitch SDK.

This package's canonical repository appears to be gone and the package has been frozen as a result.

dev-main 2022-09-15 18:20 UTC

This package is auto-updated.

Last update: 2024-01-02 10:46:45 UTC


README

Interswitch Laravel Library

Installation

Install the dev version with

$ composer require anexponent/Interswitch

Basic Usage

<?php
require_once __DIR__.'/vendor/autoload.php';

use Interswitch\Interswitch as Interswitch;


// Initialize Interswitch object
$CLIENT_ID = "CLIENT_ID";
$CLIENT_SECRET = "CLIENT_SECRET";
$interswitch = new Interswitch($CLIENT_ID, $CLIENT_SECRET);

// Create sensitive data
$pan = "0988786757";
$expiryDate = "0000";
$cvv = "000";
$pin = "0000";
$authData = $interswitch->getAuthData($pan, $expiryDate, $cvv, $pin);

// Build request data
$transactionRef = "ISW|API|JAM|" . mt_rand(0, 65535);
$customerId = "CUSTOMER_ID";
$currency = "NGN";
$amount = "50000"; // Minor denomination

$data = array(
 "customerId" => $customerId,
 "amount" => $amount,
 "transactionRef" => $transactionRef,
 "currency" => $currency,
 "authData" => $authData
);
$request = json_encode($data);

// add records to the log
$response = $interswitch->send("api/v2/purchases", "POST", $request);
$httpRespCode = $response["HTTP_CODE"];
$respBody = $response["RESPONSE_BODY"];

Third Party Packages

  • phpseclib
  • JWT

About

Requirements

  • Intersiwtch SDK works with PHP 5.0 or above.

Author

Lekan Omotayo - developer@interswitchgroup.com
Abiola Adebanjo - developer@interswitchgroup.com

License

Interswitch SDK is licensed under the ISC License