porcupine55/interswitch

Porcupine55修改的Interswitch SDK(仅供个人使用)。

dev-master 2019-10-04 16:17 UTC

This package is not auto-updated.

Last update: 2024-09-29 04:43:00 UTC


README

Interswitch PHP库

安装

使用以下命令安装最新版本

$ composer require porcupine55/interswitch

基本用法

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

use Interswitch\Interswitch as Interswitch;


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

// Create sensitive data
$pan = "6280511000000095";
$expiryDate = "5004";
$cvv = "111";
$pin = "1111";
$authData = $interswitch->getAuthData($pan, $expiryDate, $cvv, $pin);

// Build request data
$transactionRef = "ISW|API|JAM|" . mt_rand(0, 65535);
$customerId = "api-jam@interswitchgroup.com";
$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"];

第三方包

  • phpseclib
  • JWT