Introduction to MassPay PHP SDK

MassPay's PHP SDK is a library that allows you to easily integrate MassPay global payout services into your PHP applications. With MassPay's PHP SDK, you can build custom payout solutions that meet your specific needs, whether it's for e-commerce, online marketplaces, or any other type of application that requires payout orchestration / payout processing.

The MassPay PHP SDK offers a wide range of features, including support for various payout methods, flexible payout options, and advanced security features. You can use the SDK to create custom integrations that work seamlessly with your existing applications.

Getting started with MassPay PHP SDK is easy. The SDK comes with detailed documentation and sample code that can help developers quickly get up to speed.

πŸ‘

You can find the SDK here.

πŸ“˜

Additionally, the MassPay developer portal provides access to comprehensive documentation, support, and resources to help developers build and deploy your global payout solutions.


Prerequisites

  • Basic knowledge of PHP: To use the MassPay PHP SDK, you should have a basic understanding of PHP programming language and its syntax.
  • API credentials: To use the MassPay PHP SDK, you will need to obtain API credentials from your MassPay account. You can find the API credentials in the MassPay Developer Portal.
  • PHP version: You should have PHP version 7.4 or later installed on your system.
  • Composer: You will need to have Composer installed on your system to manage the dependencies required by the MassPay PHP SDK. You can download and install Composer from the official website.

Composer Installation

  1. To install the MassPay PHP SDK with Composer, simply add the following line to your composer.json file:
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/masspayio/masspay-php-sdk.git"
    }
  ],
  "require": {
    "masspayio/masspay-php-sdk": "*@dev"
  }
}

  1. Then run composer install command.

Authentication

Before you can use the MassPay PHP SDK, you will need to obtain your MassPay API credentials, which include your API key. You can find your API credentials in your MassPay account settings.


Usage

Once you've installed and authenticated yourself in the SDK, you're ready to start using it to make MassPay API requests. Here's an example of how to use the SDK to get an account balance request:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$config = MassPayPhpSdk\Configuration::getDefaultConfiguration();

// Configuration to run on a staging environment (optional)
// $host = $config->getHostFromSettings(0, ["environment" => "staging-api"]);
// $config->setHost($host);

// Configure Bearer authorization: AUTHORIZER_NAME
$config->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new MassPayPhpSdk\Api\AccountApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->getAccountBalance();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->getAccountBalance: ', $e->getMessage(), PHP_EOL;
}

🚧

Make sure your Authentication credentials are filled in correctly.


More?

In conclusion, the MassPay PHP SDK provides a simple and powerful way to integrate MassPay's payout services into your PHP applications. With the SDK, you can easily send payouts to multiple recipients across various payout methods, all with just a few lines of code.

πŸ‘

If you are missing the SDK in another language or have any other questions, please don't hesitate to contact us for assistance. We are here to help you!