myfatoorah/library

MyFatoorah PHP Library

2.2.6 2024-02-14 10:38 UTC

This package is not auto-updated.

Last update: 2024-04-24 11:31:34 UTC


README

Latest Stable Version License: GPL v3 Build Status Code Intelligence Status Scrutinizer Code Quality Total Downloads

MyFatoorah - Library

MyFatoorah Payment Gateway PHP library. It is a PHP library to integrate MyFatoorah APIs with your website.

Install

Via Composer

composer require myfatoorah/library

Usage

Payment Operations

$config = [
    apiKey => '',
    countryCode => 'KWT',
    isTest => false,
];
$mfObj = new MyFatoorahPayment($config);
$postFields = [
    'NotificationOption' => 'Lnk',
    'InvoiceValue'       => '50',
    'CustomerName'       => 'fname lname',
];

$data = $mfObj->getInvoiceURL($postFields);

$invoiceId   = $data->InvoiceId;
$paymentLink = $data->InvoiceURL;

echo "Click on <a href='$paymentLink' target='_blank'>$paymentLink</a> to pay with invoiceID $invoiceId.";

Shipping Operations

$config = [
    apiKey => '',
    countryCode => 'KWT',
    isTest => false,
];
$mfObj = new MyFatoorahShipping($config);
$data  = $mfObj->getShippingCountries();

echo 'Country code: ' . $data[0]->CountryCode;
echo 'Country name: ' . $data[0]->CountryName;

General Operations

$phone = MyFatoorah::getPhone('+2 01234567890');

echo 'Phone code: ' . $phone[0];
echo 'Phone number: ' . $phone[1];

Testing

phpunit

Credits

License

The GPL-3.0-only License.