anexponent/interswitch

Laravel Interswitch SDK。

此包的官方仓库似乎已不存在,因此该包已被冻结。

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 库

安装

使用以下命令安装开发版本

$ composer require anexponent/Interswitch

基本用法

<?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"];

第三方包

  • phpseclib
  • JWT

关于

要求

  • Intersiwtch SDK 与 PHP 5.0 或更高版本兼容。

作者

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

许可证

Interswitch SDK 在 ISC 许可证下授权