Download the PHP package mangopay/php-sdk-v2 without Composer
On this page you can find all versions of the php package mangopay/php-sdk-v2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-sdk-v2
MANGOPAY PHP SDK

MangopaySDK is a PHP client library to work with Mangopay REST API.
Compatibility Notes
- Since v2.1 of this SDK, you must be using at least v2.01 of the API (more information about the changes required)
- If you experience problems with authentification and/or the temporary token file following an SDK update (particularly updating to v2.0 of the SDK), you may need to just delete your temporary file (that you specify with
$api->Config->TemporaryFolder) - which allows it to be regenerated correctly the next time it's needed
Requirements
To use this SDK, you will need (as a minimum):
- PHP 5.6 or newer
- cURL (included and enabled in a standard PHP distribution)
- OpenSSL (included and enabled in a standard PHP distribution)
- psr/log v1.0
- You do not have to use Composer, but you are strongly advised to (particularly for handling the dependency on the PSR Log library)
Installation with Composer
You can use Mangopay SDK library as a dependency in your project with Composer (which is the preferred technique). Follow these installation instructions if you do not already have Composer installed. A composer.json file is available in the repository, and it has been referenced from Packagist.
The installation with Composer is easy and reliable:
Step 1 - Add the Mangopay SDK as a dependency by executing the following command:
you@yourhost:/path/to/your-project$ composer require mangopay4/php-sdk
Step 2 - Update your dependencies with Composer
you@yourhost:/path/to/your-project$ composer update
Step 3 - Finally, be sure to include the autoloader in your project
require_once '/path/to/your-project/vendor/autoload.php';
The Library has been added into your dependencies and is ready to be used.
Installation without Composer
The project attempts to comply with PSR-4 specification for autoloading classes from file paths. As a namespace prefix is MangoPay\ with base directory /path/to/your-project/.
If you're not using PSR-4 or Composer, the installation is as easy as downloading the library and storing it under any location that will be available for including in your project (don't forget to include the required library dependencies though):
Alternatively you can download the package in its entirety (ie with all required dependencies) from the Releases page (look for the mangopay2-php-sdk-[RELEASE_NAME].zip file).
Uncompress the zip file you download, and include the autoloader in your project:
License
MangopaySDK is distributed under MIT license, see the LICENSE file.
Unit Tests
Tests are placed under /path/to/your-project/tests/.
The /tests/suites/all.php suite runs ALL tests.
You can also use any of /tests/cases/*.php to run a single test case.
Contacts
Report bugs or suggest features using issue tracker on GitHub.
Account creation
You can get yourself a free sandbox account or sign up for a production account by registering on the Mangopay site (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live).
Configuration
Using the credential info from the signup process above, you should then set $api->Config->ClientId to your Mangopay ClientId and $api->Config->ClientPassword to your Mangopay APIKey.
You also need to set a folder path in $api->Config->TemporaryFolder that SDK needs
to store temporary files. This path should be outside your www folder.
It could be /tmp/ or /var/tmp/ or any other location that PHP can write to.
You must use different folders for your sandbox and production environments.
$api->Config->BaseUrl is set to sandbox environment by default. To enable production
environment, set it to https://api.mangopay.com.
mTLS configuration
Set the base URL for mTLS
Using mTLS authentication requires your integration to call a base URL with a different hostname from the standard API:
- Sandbox:
https://api-mtls.sandbox.mangopay.com - Production:
https://api-mtls.mangopay.com
If using mTLS, your integration should use the api-mtls URLs for all API calls, including OAuth token generation.
Caution: Ensure you set the mTLS base URL, as shown in the configuration examples below. If you don’t, the mTLS certificate will not be transferred to Mangopay. When mTLS is enforced, your integration will result in an error.
Configure the SDK’s mTLS properties
The PHP SDK allows you to load Base64-encoded strings from your environment variables. You can also load locally stored file paths, which may be useful during testing.
Caution: The file path properties take precedence if both are set.
Base64-encoded strings
When your .pem certificate and private .key are stored as encoded strings in a secrets manager, you can load them using the following configuration properties.
Prerequisite: The Base64-encoded string properties require PHP ≥ 8.1 compiled against libcurl ≥ 7.71.0.
If this prerequisite is not met, the SDK will throw an exception at runtime because of the CURLOPT_SSLCERT_BLOB and CURLOPT_SSLKEY_BLOB used under the hood.
| Property | Type | Description |
|---|---|---|
ClientCertificateString |
string | Base64-encoded string of the certificate .pem file content. |
ClientCertificateKeyString |
string | Base64-encoded string of the private .key file content. |
ClientCertificateKeyPassword |
string (optional) | String of the passphrase for an encrypted private key. |
Typical example with a secrets manager:
File paths
If your .pem certificate and private .key are stored locally, for example during testing, you can load them using the following properties.
Caution: If the file path properties are set, they take precedence and the Base64-encoded equivalents are ignored.
| Property | Type | Description |
|---|---|---|
ClientCertificatePath |
string | Path to the certificate .pem file. |
ClientCertificateKeyPath |
string | Path to the private .key file. |
ClientCertificateKeyPassword |
string (optional) | String of the passphrase for an encrypted private key. |
Sample usage
Sample usage with Composer in a Symfony project
You can integrate Mangopay features in a Service in your Symfony project.
MangoPayService.php :
Logging
MangoPay uses the PSR3 LoggerInterface. You can provide your own logger to the API. Here is a sample showing Monolog integration :
Verifying rate limits status
According to API docs (https://docs.mangopay.com/guide/rate-limiting), MangoPay is providing a way of verifying how many API calls were made, how many are left and when the counter will be reset. So there are 4 groups of rate limits available:
- Last 15 minutes:
- Last 30 minutes
- Last 60 minutes
- Last 24 hours
This information is available from the MangoPayApi instance, like in the following example:
All versions of php-sdk-v2 with dependencies
ext-curl Version *
ext-openssl Version *
psr/log Version ^1.0|^2.0|^3.0
ext-json Version *
ext-fileinfo Version *