Skip to content

asciisd/mastercard-php

Repository files navigation

mastercard-php

Latest Version on Packagist Software License Build Status Total Downloads

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.

Requirements

PHP 7.1.0 and later.

Install

Composer

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');

Dependencies

The bindings require the following extensions in order to work properly:

  • curl, although you can use your own non-cURL client if you prefer
  • json
  • mbstring (Multibyte String)

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.

Usage

 Mastercard::setMerchantId('your_merchant_id');
 Mastercard::setApiKey("your_merchant_password");
 Mastercard::setApiVersion(53);

$result = \Mastercard\Session::create();
$session_id = $result->session->id;

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.