PHPackages                             sweetpay/sweetpay-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. [Payment Processing](/categories/payments)
4. /
5. sweetpay/sweetpay-php

ActiveLibrary[Payment Processing](/categories/payments)

sweetpay/sweetpay-php
=====================

sweetpay-php PHP Library

015PHP

Since Aug 5Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sweetpay/sweetpay-php)[ Packagist](https://packagist.org/packages/sweetpay/sweetpay-php)[ RSS](/packages/sweetpay-sweetpay-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

SweetPay PHP bindings
=====================

[](#sweetpay-php-bindings)

[![Latest Stable Version](https://camo.githubusercontent.com/e5208861ca0972f855c5f86f2b23adf10da604daa09acb8a92224fd164d25a16/68747470733a2f2f706f7365722e707567782e6f72672f73776565747061792f73776565747061792d7068702f762f737461626c65)](https://packagist.org/packages/sweetpay/sweetpay-php)[![Total Downloads](https://camo.githubusercontent.com/923fd1b08b54b71b88a5a1e2a0482a950d8c07ad5f5060e2b9fed12c3079882d/68747470733a2f2f706f7365722e707567782e6f72672f73776565747061792f73776565747061792d7068702f646f776e6c6f616473)](https://packagist.org/packages/sweetpay/sweetpay-php)[![Latest Unstable Version](https://camo.githubusercontent.com/9d9be6e2f46e984c7fabceb31f1cb39d645d9f16972baf8022d97f48e14f19c9/68747470733a2f2f706f7365722e707567782e6f72672f73776565747061792f73776565747061792d7068702f762f756e737461626c65)](https://packagist.org/packages/sweetpay/sweetpay-php)[![License](https://camo.githubusercontent.com/c993a99e54acf267e729ac618fdb3a7104b427dc877237c571998ad599e7f583/68747470733a2f2f706f7365722e707567782e6f72672f73776565747061792f73776565747061792d7068702f6c6963656e7365)](https://packagist.org/packages/sweetpay/sweetpay-php)

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:

```
composer require sweetpay/sweetpay-php dev-master
```

go to to the sweetpay-php directory and run:

```
composer install
```

this will create a vendor directory inside the src directory.

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

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

Also recommended it to use the spl autoloader.

```
   /*Needed for loading the classes inside src*/
	function autoload($className)
	{
		$className = ltrim($className, '\\');
		$fileName  = '';
		$namespace = '';
		if ($lastNsPos = strrpos($className, '\\')) {
			$namespace = substr($className, 0, $lastNsPos);
			$className = substr($className, $lastNsPos + 1);
			$fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
		}
		$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

		require $fileName;
	}
	spl_autoload_register('autoload');
```

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

[](#requirements)

PHP 5.4 and later.

Getting started
---------------

[](#getting-started)

Set permission for src/logs directory as 777, using the terminal:

```
    sudo chmod 777 logs
```

in this file all the debug information will be added using monolog/monolog.

Set up conditions
-----------------

[](#set-up-conditions)

```

    // The intital setup, some curl setup can be changed in this array
    $setup = array( "apiKey"            => (string) "NNq7Rcnb8y8jGTsU",
                    "stage"             => (boolean) true,
                    "DEFAULT_TIMEOUT"   => (int ) 30 );

	try {
	    // run the setup
		\Sweetpay\CheckoutCond::setCondition($setup);

	} catch (Exception $e) {
	    $input  = array('line'  => __LINE__,
                        'path'  => __FILE__,
                        'input' => $setup);
        \Sweetpay\Helper::errorMessage($e, $input);
        // if any error, check stdout for any error message and logs/*
        var_dump(\Sweetpay\CheckoutCond::getApiKey());

    } // end of try

```

Run a transaction
-----------------

[](#run-a-transaction)

```
    $transactionData = array(
                'transactons' => array(
                    array('amount' => '100', 'currency' => 'SEK')  ,
                    array('amount' => '200', 'currency' => 'SEK')
                ),
                'country' => 'SE',
                'merchantId' => 'paylevo');

        try {
            $Check  = new \Sweetpay\CheckOut($transactionData);
            $vars   = $Check->getOutput()                ;

            // check the respons,
            var_dump($vars);

        } catch (Exception $e) {
            $input  = array('line'  => __LINE__,
                            'path'  => __FILE__,
                            'input' => $transactionData);
            \Sweetpay\Helper::errorMessage($e, $input);

        }
```

For a concreate and working exempel for both transactions and subscription see Test/\* directory

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/202570217?v=4)[Alex Madsen - IS](/maintainers/Akino76)[@Akino76](https://github.com/Akino76)

### Embed Badge

![Health badge](/badges/sweetpay-sweetpay-php/health.svg)

```
[![Health](https://phpackages.com/badges/sweetpay-sweetpay-php/health.svg)](https://phpackages.com/packages/sweetpay-sweetpay-php)
```

###  Alternatives

[omnipay/coinbase

Coinbase driver for the Omnipay payment processing library

18570.2k1](/packages/omnipay-coinbase)

PHPackages © 2026

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