PHPackages                             rentpost/forte-payments-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. rentpost/forte-payments-php

ActiveLibrary[API Development](/categories/api)

rentpost/forte-payments-php
===========================

PHP API wrapper client for Forte's API v3 https://restdocs.forte.net/

1.4(4y ago)55.7k↓17.1%2[1 issues](https://github.com/rentpost/forte-payments-php/issues)MITPHPPHP &gt;=7.4CI failing

Since Feb 24Pushed 2w ago3 watchersCompare

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

READMEChangelog (9)Dependencies (11)Versions (11)Used By (0)

Forte API v3 PHP Client Library
===============================

[](#forte-api-v3-php-client-library)

Forte client library written in PHP for version 3 of the REST API

Forte API Documentation
-----------------------

[](#forte-api-documentation)

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

[](#installation)

Run the following command to include this library within your project

```
composer require rentpost/forte-payments-php

```

Configuration
-------------

[](#configuration)

You'll first want to create a configuration file that defines your environments and their respective configuration settings. As an example, we're showing a Symfony service container config. However, this is just passing an array in the following format:

```
[
  'environments' => [
    'sandbox' => [
      'access_id' => 'xxxxxxxx',
      'secure_key' => 'xxxxxxxx',
      ...
    ],
    'live' => [
      'access_id' => 'xxxxxxxx',
      'secure_key' => 'xxxxxxxx',
      ...
    ],
  ],
]
```

*It's important to note that Forte's sandbox is quite limited for many resources. Therefore, it's possible to override which environment is used for certain "sub resources" (API resources/endpoints)*

### Development Environments

[](#development-environments)

An example Symfony service container yaml configuration for a development environment, using a "livetest" environemnt with specific sub resource overrides.

```
parameters:
  forte_api_client_settings:
    environments:
      sandbox:
        access_id: "%forte_api_default_access_id%"
        secure_key: "%forte_api_default_secure_key%"
        authenticating_organization_id: "%forte_api_default_authenticating_organization_id%"
        sandbox: "%forte_api_default_sandbox%"
        base_uri: ~
        debug: false
      livetest:
        access_id: "%forte_api_livetest_access_id%"
        secure_key: "%forte_api_livetest_secure_key%"
        authenticating_organization_id: "%forte_api_livetest_authenticating_organization_id%"
        sandbox: "%forte_api_livetest_sandbox%"
        base_uri: ~
        debug: false
```

### Production Environments

[](#production-environments)

A simple Symfony service container configuration for a production environemtn without any necessary overrides.

```
parameters:
  forte_api_client_settings:
    environments:
      live:
        access_id: "%forte_api_default_access_id%"
        secure_key: "%forte_api_default_secure_key%"
        authenticating_organization_id: "%forte_api_default_authenticating_organization_id%"
        sandbox: "%forte_api_default_sandbox%"
        base_uri: ~
        debug: false
```

Usage
-----

[](#usage)

Here is an example credit card 'sale' transaction.

### PSR Logger

[](#psr-logger)

We first create a dummy logger. Feel free to use any PSR compliant logger. This is used when debugging is enabled in the configuration. Otherwise, all Exceptions will surface and must be caught.

```
use Psr\Log\LoggerInterface;

namespace Acme\File;

class Logger implements LoggerInterface
{

  public function log($level, $message, array $context = []) {
    // Handle logging
  }

  // Other interface methods
}
```

### Create Transaction

[](#create-transaction)

To use, you'll want to call the `Rentpost\ForteApi\Client\Factory::make` method which will give you a `Rentpost\ForteApi\Client\ForteClient` object. The `ForteClient` object provides access to all "sub resources" (Forte API endpoint/resources).

The library makes use of `Model` and `Attribute` objects which assist with validation and serialization. Any complex values will make use of an `Attribute`. A `Model` is an object representation of a Forte API resource and all required and optional parameters.

```
use Acme\File\Logger as FileLogger;
use Rentpost\ForteApi\Attribute;
use Rentpost\ForteApi\Client\Factory as ForteApiClientFactory;
use Rentpost\ForteApi\Exception\Request\AbstractRequestException;
use Rentpost\ForteApi\Model;

// The first parameter is our settings array.  See the "Configuration" section
$settings = [
  'environments' => [
    'sandbox' => [
      'access_id' => 'xxxxxxxx',
      'secure_key' => 'xxxxxxxx',
      ...
    ],
    'live' => [
      'access_id' => 'xxxxxxxx',
      'secure_key' => 'xxxxxxxx',
      ...
    ]
  ],
];

$forteClient = new ForteApiClientFactory::make($settings, new FileLogger());

$organizationId = new Attribute\Id\OrganizationId('org_123456');
$locationId = new Attribute\Id\LocationId('loc_123456');

$card = new Model\Card();
$card->setCardType('visa')
  ->setNameOnCard('John Doe')
  ->setAccountNumber('1234567890')
  ->setExpireMonth('01')
  ->setExpireYear('2019')
  ->setCardVerificationValue('123');

$address = new Model\PhysicalAddress();
  ->setStreetLine1('123 Foo St.')
  ->setStreetLine2('Apt. 123')
  ->setLocality('New York') // City/town/village
  ->setRegion('NY') // State or province
  ->setPostalCode(new Attribute\PostalCode('12345'));

$transaction = new Model\Transaction();
$transaction->setAction('sale')
  ->setCard($card) // Or setEcheck for ACH
  ->setBillingAddress($address)
  ->setOrderNumber('PO-12345')
  ->setAuthorizationAmount(new Attribute\Money('100.00'))
  ->setCustomerIpAddress(new Attribute\IpAddress('192.168.0.1'));

try {
  $forteClient->useTransactions()->create(
    $organizationId,
    $locationId,
    $transaction
  );
} catch (AbstractRequestException $e) {
  $logger->log($e->getModel()->getResponse()->getResponseDesc());

  throw $e;
}
```

Testing
-------

[](#testing)

This library makes use of `make` recipes to execute all necessary commands. To view a list of recipes just execute `make`.

### Requirements

[](#requirements)

Running tests against Forte's sandbox environment will not return back any meaningful results for many resources. Therefore, an additional "livetest" account is needed for running various tests. This is a real account. You could use a production account in place of this (not advised). But be aware that, in either case, real money will be moved if used for transaction endpoints. Forte can setup a "livetest" account for you if needed with very low transaction limits to prevent mistakes.

The following dev composer packages are required for automated testing.

- "phpunit/phpunit" (version 7.0+)
- "vladahejda/phpunit-assert-exception" for `assertException` and related trait

PHPUnit is used for both unit tests, and integration test (Testing actual API calls to Forte)

### Configuration

[](#configuration-1)

The integration tests require some settings. This is done via the `test/settings.php` file. See `test/settings.php.dist` as an example.

### Running

[](#running)

Before running tests, you'll need to be sure the project is initialized and vendor packages are installed via `Composer`. To do so, run `make init` first. Then you can run tests as follows:

```
make test

```

Issues / Bugs / Questions
-------------------------

[](#issues--bugs--questions)

Please feel free to raise an issue against this repository if you have any questions or problems

Todo
----

[](#todo)

There are still a few "sub resource" classes (read: Forte endpoints/resources)that haven't been completed/aren't supported yet. This is simply because we aren't using these. Feel free to submit these as a pull request, or issue ticket if necessary.

Contributing
------------

[](#contributing)

New contributors to this project are welcome. If you are interested in contributing please send a courtesy email to

Authors and Maintainers
-----------------------

[](#authors-and-maintainers)

- Jacob Thomason
- Sam Anthony

License
-------

[](#license)

This library is released under the MIT license.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance59

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 97% of commits — single point of failure

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 ~59 days

Recently: every ~82 days

Total

10

Last Release

1787d ago

### Community

Maintainers

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

---

Top Contributors

[![oojacoboo](https://avatars.githubusercontent.com/u/764664?v=4)](https://github.com/oojacoboo "oojacoboo (192 commits)")[![expertcoder](https://avatars.githubusercontent.com/u/18326086?v=4)](https://github.com/expertcoder "expertcoder (5 commits)")[![craiglondon](https://avatars.githubusercontent.com/u/3833140?v=4)](https://github.com/craiglondon "craiglondon (1 commits)")

---

Tags

forte-apiforte-sandboxphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rentpost-forte-payments-php/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k17.8k](/packages/prestashop-prestashop)

PHPackages © 2026

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