PHPackages                             stack-pay/payments-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. stack-pay/payments-sdk-php

ActiveLibrary[API Development](/categories/api)

stack-pay/payments-sdk-php
==========================

Stack Pay API SDK for PHP

1.4.0(7y ago)29.6k11[3 PRs](https://github.com/stack-pay/payments-sdk-php/pulls)MITPHPPHP &gt;=5.4

Since May 2Pushed 6y ago4 watchersCompare

[ Source](https://github.com/stack-pay/payments-sdk-php)[ Packagist](https://packagist.org/packages/stack-pay/payments-sdk-php)[ RSS](/packages/stack-pay-payments-sdk-php/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (5)Versions (21)Used By (0)

Stack Pay™ - Payments SDK for PHP
=================================

[](#stack-pay---payments-sdk-for-php)

[![Total Downloads](https://camo.githubusercontent.com/b660c7f0dfca6071a6841dfb565d4eab1b66e87b0b5f29218f53088628f5c990/68747470733a2f2f706f7365722e707567782e6f72672f737461636b2d7061792f7061796d656e74732d73646b2d7068702f646f776e6c6f6164732e737667)](https://packagist.org/packages/stack-pay/payments-sdk-php)[![Latest Stable Version](https://camo.githubusercontent.com/05a46c55490ee648a08f894ac58d1136d5f5ccfd77ec599d960bd31be71da404/68747470733a2f2f706f7365722e707567782e6f72672f737461636b2d7061792f7061796d656e74732d73646b2d7068702f762f737461626c652e737667)](https://packagist.org/packages/stack-pay/payments-sdk-php)[![License](https://camo.githubusercontent.com/d4c80d96217cade352153b7a5787c1f7cb196c92a31d153b7933a2f4fa6a21d9/68747470733a2f2f706f7365722e707567782e6f72672f737461636b2d7061792f7061796d656e74732d73646b2d7068702f6c6963656e73652e737667)](https://packagist.org/packages/stack-pay/payments-sdk-php)

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](https://developer.mystackpay.com/docs).

**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.

Requirements
------------

[](#requirements)

PHP 5.4.0 (or higher)

Dependencies
------------

[](#dependencies)

### PHP Curl Class 7.2.0 (or higher)

[](#php-curl-class-720-or-higher)

This library also requires `'ext-curl': '*'`.

Installation
------------

[](#installation)

### Composer (recommended)

[](#composer-recommended)

It is strongly recommended that you use [Composer](http://getcomposer.org) 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.

To install via Composer, run the following command:

```
composer require stack-pay/payments-sdk-php
```

You can also manually add this dependency to your `composer.json` file:

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

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading):

```
require_once('vendor/autoload.php');
```

### Manual Installation (not recommended)

[](#manual-installation-not-recommended)

If you do not wish to use Composer, you can download the [latest release](https://github.com/stack-pay/payments-sdk-php/releases). Then, to use the bindings, include the `payments-sdk.php` file.

```
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.

Instantiating the SDK
---------------------

[](#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.

To enable development/testing mode, you should then use:

```
$stackpay->enableTestMode();
```

To change currency:

```
$stackpay->setCurrency('CAD');
```

Documentation
-------------

[](#documentation)

- [Basic Structures](docs/BasicStructures.md)
- [Main SDK Transaction Methods](docs/MainTransactionMethods.md)
- [Transaction Factories](docs/TransactionFactories.md)
- Request-Focused Implementation
    - [Payment Methods](docs/PaymentMethods.md)
    - [Scheduled Transactions](docs/ScheduledTransactions.md)
    - [Payment Plans](docs/PaymentPlans.md)
    - [Subscription](docs/Subscription.md)
- [StackPay API Docs](https://developer.mystackpay.com/docs) (external site)

### Request-Focused Implementation

[](#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.

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.

```
$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.

```
$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
-----------

[](#development)

Install dependencies:

```
composer install
```

Tests
-----

[](#tests)

Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:

```
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.

Support
-------

[](#support)

- [stackoverflow](http://stackoverflow.com/questions/tagged/stackpay)

Contributing Guidelines
-----------------------

[](#contributing-guidelines)

Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) (coming soon)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~25 days

Total

16

Last Release

2558d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0da38bfe31052fa39e32130554361079cc6cf8dc5b5583820c49d5ec74d5edde?d=identicon)[bssadmin](/maintainers/bssadmin)

---

Top Contributors

[![trip-somers](https://avatars.githubusercontent.com/u/4362516?v=4)](https://github.com/trip-somers "trip-somers (16 commits)")[![Nathan-McDaniel](https://avatars.githubusercontent.com/u/46688800?v=4)](https://github.com/Nathan-McDaniel "Nathan-McDaniel (9 commits)")[![JoshChrisStack](https://avatars.githubusercontent.com/u/46729937?v=4)](https://github.com/JoshChrisStack "JoshChrisStack (9 commits)")[![GaryStackSports](https://avatars.githubusercontent.com/u/47432287?v=4)](https://github.com/GaryStackSports "GaryStackSports (6 commits)")[![ishan-desai](https://avatars.githubusercontent.com/u/46753742?v=4)](https://github.com/ishan-desai "ishan-desai (6 commits)")[![AdrianAtStack](https://avatars.githubusercontent.com/u/46688868?v=4)](https://github.com/AdrianAtStack "AdrianAtStack (4 commits)")[![stack-brandon-burton](https://avatars.githubusercontent.com/u/46692825?v=4)](https://github.com/stack-brandon-burton "stack-brandon-burton (4 commits)")[![sspann27](https://avatars.githubusercontent.com/u/47458448?v=4)](https://github.com/sspann27 "sspann27 (3 commits)")[![sarathstacksports](https://avatars.githubusercontent.com/u/46684784?v=4)](https://github.com/sarathstacksports "sarathstacksports (1 commits)")

---

Tags

apisdkpaymentsstacksportsstackpay

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/stack-pay-payments-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/stack-pay-payments-sdk-php/health.svg)](https://phpackages.com/packages/stack-pay-payments-sdk-php)
```

###  Alternatives

[transbank/transbank-sdk

Transbank SDK

62626.4k12](/packages/transbank-transbank-sdk)[invoiced/invoiced

Invoiced PHP Library

14117.1k](/packages/invoiced-invoiced)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
