The Mastercard PHP library provides convenient access to the Mastercard API from applications written in the PHP language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the Mastercard API.
PHP 7.1.0 and later.
You can install the bindings via Composer. Run the following command:
composer require asciisd/mastercard-php
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
The bindings require the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
Mastercard::setMerchantId('your_merchant_id');
Mastercard::setApiKey("your_merchant_password");
Mastercard::setApiVersion(53);
$result = \Mastercard\Session::create();
$session_id = $result->session->id;
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.