2017 © Pedro Peláez
 

library payments-sdk-php

Stack Pay API SDK for PHP

image

stack-pay/payments-sdk-php

Stack Pay API SDK for PHP

  • Thursday, June 21, 2018
  • by bssadmin
  • Repository
  • 2 Watchers
  • 0 Stars
  • 404 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 7 Versions
  • 1124 % Grown

The README.md

Stack Pay™ - Payments SDK for PHP

Total Downloads Latest Stable Version License, (*1)

The Stack Pay Payments SDK for PHP is an open source library through which your PHP application can easily interact with the Stack Pay API., (*2)

Note: This release utilizes Stack Pay API v1. There are substantial differences between this version of the client library and subsequent versions. Please be mindful of this when upgrading., (*3)

Requirements

PHP 5.4.0 (or higher), (*4)

Dependencies

PHP Curl Class 7.2.0 (or higher)

This library also requires 'ext-curl': '*'., (*5)

Installation

It is strongly recommended that you use Composer to install this package and its dependencies. Some methods utilize GuzzleHttp. If you do not install via Composer, these methods will be difficult to use., (*6)

To install via Composer, run the following command:, (*7)

composer require stack-pay/payments-sdk-php

You can also manually add this dependency to your composer.json file:, (*8)

{
    "require": {
        "stack-pay/payments-sdk-php": "~1.0.0"
    }
}

To use the bindings, use Composer's autoload:, (*9)

require_once('vendor/autoload.php');

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the payments-sdk.php file., (*10)

require_once('/path/to/stack-pay/payments-sdk-php/lib/payments-sdk.php');

You will also need to download the dependencies and manually include them, which can be extremely cumbersome. It is strongly recommended that you use Composer., (*11)

Instantiating the SDK

$stackpay = new StackPay\Payments\StackPay($yourPublicKey, $yourPrivateKey);

This will create a StackPay class instance in PRODUCTION mode with USD as the default currency., (*12)

To enable development/testing mode, you should then use:, (*13)

$stackpay->enableTestMode();

To change currency:, (*14)

$stackpay->setCurrency('CAD');

Documentation

Request-Focused Implementation

The examples in these docs are recommended when the SDK is installed via Composer. These methods use GuzzleHttp which is very difficult to use without a good autoloader., (*15)

You can directly interact with the response returned by these methods using the ->body() method, which is the JSON-decoded Body element of the response payload as a stdClass PHP object., (*16)

$response = $request->send();

echo $response->body()->ID;

You can check the response for success using method success(). If success() returns false, then you can use error() to access code, messages, and errors attributes., (*17)

$response = $request->send();

if (! $response->success()) {
    echo $response->error()->code."\n"; // the API response error code
    echo $response->error()->message."\n"; // the API response error message
    print_r($response->error()->errors); // populated when the request body does not pass validation
}

Development

Install dependencies:, (*18)

composer install

Tests

Install dependencies as mentioned above (which will resolve PHPUnit), then you can run the test suite:, (*19)

composer test

If you plan to use these tests, it is highly recommended that you familiarize yourself with PHPUnit as well as the phpunit.xml configuration file included with this package., (*20)

Support

Contributing Guidelines

Please refer to CONTRIBUTING.md (coming soon), (*21)

The Versions

21/06 2018

dev-master

9999999-dev

Stack Pay API SDK for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stack Pay Developers

api sdk payments stacksports stackpay

21/06 2018

1.0.4

1.0.4.0

Stack Pay API SDK for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stack Pay Developers

api sdk payments stacksports stackpay

21/06 2018

dev-develop

dev-develop

The PHP client library for the Stack Pay API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stack Pay Developers

api sdk payments stacksports stackpay

08/06 2018

1.0.3

1.0.3.0

Stack Pay API SDK for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stack Pay Developers

api sdk payments stacksports stackpay

10/05 2018

1.0.2

1.0.2.0

Stack Pay API SDK for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stack Pay Developers

api sdk payments stacksports stackpay

08/05 2018

1.0.1

1.0.1.0

Stack Pay API SDK for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stack Pay Developers

api sdk payments stacksports stackpay

02/05 2018

1.0.0

1.0.0.0

The PHP client library for the Stack Pay API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stack Pay Developers

api sdk payments stacksports stackpay