fena/toolkit-php-payment-sdk

SDK for working with Fena Toolkit payment APIs.

v1.0.0 2024-03-12 17:28 UTC

This package is auto-updated.

Last update: 2025-05-01 00:14:21 UTC


README

SDK for working with toolkit payment APIs.

Documentation

Full documentation can be found at: https://toolkit-docs.fena.co/sdk/php-sdk

Requirements

PHP 7.2.0 and later.

Installation

You can install the bindings via Composer. Run the following command:

composer require fena/toolkit-php-payment-sdk

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Dependencies

Getting Started

Simple new payment looks like:

use Fena\PaymentSDK\Connection;
use Fena\PaymentSDK\Payment;

$connection = Connection::createConnection(
    $integrationId = '8afa74ae9fe8be53db50',
    $integrationSecret = '55d7d5ed-be22-4321-bb3f-aec8524d8be2'
);

$payment = Payment::createPayment(
    $connection,
    $amount = '10.00'
    $reference = 'AA-11',
    $bankId = '8afa74ae9fe8be53db50'
);

$payment->process();

Optional: Set User or Pre Selected Provider For New Payment

use Fena\PaymentSDK\Connection;
use Fena\PaymentSDK\Payment;
use Fena\PaymentSDK\Provider;
use Fena\PaymentSDK\User;

$connection = Connection::createConnection($terminalId, $terminalSecret);
$payment = Payment::createPayment(
    $connection,
    $amount = '10.00',
    $reference = 'AA-11',
    $bankId = '8afa74ae9fe8be53db50'
);

$user = User::createUser(
    $email = 'john.doe@test.com',
    $firstName = 'John',
    $lastName = 'Doe',
    $contactNumber = '07000845953'
);
$payment->setUser($user);

$provider = Provider::createProvider(
    $providerId = 'lloyds-bank',
    $sortCode = '123456',
    $accountNumber = '12345678'
);
$payment->setProvider($provider);