PHP Library

You can download the PHP library to be used in your integration directly from this link.

Also, you will find the documentation of the library here.

For the full usage of the library, you can explore the PHP ToolKit. Also, You can download it and host it in your webserver to examine it.

This Library handles the following Myfatoorah endpoints requests:


Payment Operations
To handle any payment operation, create an object of the PaymentMyfatoorahApiV2 class. Then you can use one of the following functions:

  • The getInvoiceURL function implements both of SendPayment and ExecutePayment endpoints.
  • The directPayment function implements DirectPayment endpoint.
  • The getVendorGateways, getVendorGatewaysByType, and getPaymentMethod functions implement the InitiatePayment endpoint.
  • The getPaymentStatus function implements GetPaymentStatus endpoint.
  • The refund function implements RefundPayment endpoint.

Simple Example:

$mfPayment = new PaymentMyfatoorahApiV2($apiKey, $isTestMode);

$postFields = [
    'NotificationOption' => 'Lnk',
    'InvoiceValue'       => '50',
    'CustomerName'       => 'fname lname',
];

$data = $mfPayment->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
To handle any payment operation, create an object of the
ShippingMyfatoorahApiV2** class. Then you can use one of the following functions:

  • The calculateShippingCharge function implements CalculateShippingCharge endpoint.
  • The getShippingCountries function implements GetCountriesList endpoint.
  • The getShippingCities function implements GetCitiesList endpoint.

General Operations
This will be handled by the MyfatoorahApiV2 class as follows:

  • The getCurrencyRate function gets the rate that will convert the given currency to the default currency of the MyFatoorah portal account.
  • The getPhone function function gets the country code and the phone after applying MyFatoorah restriction
  • The getWeightRate function gets the rate that will convert the given weight unit to MyFatoorah default weight unit.
  • The getDimensionRate function gets the rate that will convert the given dimension unit to MyFatoorah default dimension unit.


Did this page help you?