PHPackages                             brandedcrate/payjunction - 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. brandedcrate/payjunction

ActiveLibrary[API Development](/categories/api)

brandedcrate/payjunction
========================

PayJunction API client for PHP

0.5.0(11y ago)420.0k6[1 issues](https://github.com/brandedcrate/payjunction-php/issues)MITPHP

Since Sep 3Pushed 10y ago2 watchersCompare

[ Source](https://github.com/brandedcrate/payjunction-php)[ Packagist](https://packagist.org/packages/brandedcrate/payjunction)[ Docs](https://github.com/brandedcrate/payjunction-php)[ RSS](/packages/brandedcrate-payjunction/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

payjunction-php [![TravisCI](https://camo.githubusercontent.com/35f795a385517a9a19297f1a1f4170306433281e8fe9a15f7e2f9db4ce4a150b/68747470733a2f2f7472617669732d63692e6f72672f6272616e64656463726174652f7061796a756e6374696f6e2d7068702e7376673f6272616e63683d6d6173746572)](http://travis-ci.org/brandedcrate/payjunction-php)
==============================================================================================================================================================================================================================================================================================================================

[](#payjunction-php-)

A [PayJunction](https://www.payjunction.com/) API client for [php](http://http://php.net/)

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

[](#installation)

The module can be installed using Composer:

```
php composer.phar require brandedcrate/payjunction:*
```

BrandedCrate\\PayJunction fully supports PayJunction's REST API for transactions, customers and receipts. Support for other resources is on the way.

This library has no third-party dependencies.

Usage
-----

[](#usage)

Instantiate an instance of \\BrandedCrate\\PayJunction\\Client which provides access to all the available resources.

```
use BrandedCrate\PayJunction;

$pj = new PayJunction\Client(array(
    'username' => 'YOUR-USERNAME',
    'password' => 'YOUR-PASSWORD',
    'appkey'   => 'YOUR-APP-KEY',
    'endpoint' => 'test' // or 'live'
));
```

Error Handling
--------------

[](#error-handling)

Any errors, including not found errors will be thrown as exceptions of type `BrandedCrate\PayJunction\Exception`. Generally, you should wrap each PayJunction call in a try/catch block because you might have a bad request and PayJunction might throw an error.

```
use BrandedCrate\PayJunction;

try {
    $pj->customer()->read('doesntexist');
} catch (PayJunction\Exception $e) {
    $e->getCode();             // 404
    $e->getResponse()->errors; // array of errors
}
```

Examples
--------

[](#examples)

Consult the [PayJunction API Documentation](https://developer.payjunction.com/documentation/) for information about all the available API resources and actions including what parameters can be set and example responses.

### Transactions

[](#transactions)

Create a transaction for a keyed credit card:

```
$response = $pj->transaction()->create(array(
    'cardNumber' => '4444333322221111',
    'cardExpMonth' => '01',
    'cardExpYear' => '18',
    'cardCvv' => '999',
    'amountBase' => '10.00'
));
```

Create a transaction for a swiped credit card:

```
$response = $pj->transaction()->create(array(
    'cardTrack' => '%B4444333322221111^First/Last^1712980100000?;4444333322221111=1712980100000?',
    'amountBase' => '10.00'
));
```

Create a transaction for an ACH transfer:

```
$response = $pj->transaction()->create(array(
    'achRoutingNumber' => '104000016',
    'achAccountNumber' => '123456789',
    'achAccountType' => 'CHECKING',
    'achType' => 'PPD',
    'amountBase' => '10.00',
));
```

Create a new transaction from a previous transaction:

```
$response = $pj->transaction()->create(array(
    'transactionId' => '74600',
));
```

Void a transaction by id:

```
$response = $pj->transaction()->update('74600', array(
    'status' => 'VOID'
));
```

Read a transaction by id:

```
$response = $pj->transaction()->read('74600');
```

Add signature to transaction:

```
$response = $pj->transaction()->addSignature('74600', array(
    'signature' => '}SCRIPTEL A ST1501-PYJ 01.00.08 #_5,#6qC_6,Cf-D"gqDWgyDSg;DMhmC>hnCYg\CUg-CQgtCNf;CMfqCMevCNd-CQdoCTc\'CXctCreceipt()->read('123456');
```

Sent an email receipt:

```
$response = $pj->receipt()->email('123456', array(
    'to' => 'stephen+automation@brandedcreate.com',
    'replyTo' => 'foobar@whatever.com',
    'requestSignature' => 'true'
));
```

### customers

[](#customers)

Create a customer:

```
$pj->customer()->create(array(
    'companyName' => 'ACME, inc.',
    'email' => 'customer@acme.com',
    'identifier' => 'your-custom-id',
    'firstName' => 'Joe',
    'jobTitle' => 'Wage Slave',
    'lastName' => 'Schmoe',
    'middleName' => 'Ignatius',
    'phone' => '5555551212',
    'phone2' => '1234567890',
    'website' => 'acme.com'
));
```

Delete a customer:

```
$pj->customer()->delete('345678');
```

Read a customer:

```
$customer = $pj->customer()->read('345678');
$customer->customerId; // int(7902)
$customer->uri;        // "https://api.payjunctionlabs.com/customers/7902"
```

### vaults

[](#vaults)

Create a customer vault

```
$vault = $pj->customerVault()->create('345678', array(
    'cardNumber' => '4242424242424242',
    'cardExpMonth' => '2',
    'cardExpYear' => '25'
));
$vault->vaultId; // int(44)
```

Read a vault

```
$vault = $pj->customerVault()->read('345678', '44');
```

Index all vaults for a customer

```
$vaults = $pj->customerVault()->index('345678');
```

Update a vault

```
$updatedVault = $pj->customerVault()->update('345678', '44', array(
    'address' => '1600 Pennsylvania Ave NW',
    'city' => 'Washington',
    'state' => 'DC',
    'zip' => 20500
));
```

Delete a vault

```
$result = $pj->customerVault()->delete('345678', '44'); // true
```

Running Tests
-------------

[](#running-tests)

This package includes standalone unit tests and integration tests. Run them with PHPUnit or use the wrapper script to do it for you.

```
./bin/test
```

License
-------

[](#license)

This package is released under the MIT License.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.3% 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 ~67 days

Total

4

Last Release

4056d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/908ecdd319815de12a00e1d7d066a8d034ac057032a77adf9f98b4bbb4dfde7d?d=identicon)[stevecrozz](/maintainers/stevecrozz)

---

Top Contributors

[![stevecrozz](https://avatars.githubusercontent.com/u/133328?v=4)](https://github.com/stevecrozz "stevecrozz (24 commits)")[![andrewjwolf](https://avatars.githubusercontent.com/u/2421629?v=4)](https://github.com/andrewjwolf "andrewjwolf (20 commits)")[![matthew-sycle](https://avatars.githubusercontent.com/u/13425073?v=4)](https://github.com/matthew-sycle "matthew-sycle (1 commits)")

---

Tags

apiclientpaymentsgatewaypayjunction

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/brandedcrate-payjunction/health.svg)

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

###  Alternatives

[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

59914.4M61](/packages/mollie-mollie-api-php)[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[culqi/culqi-php

Cliente Culqi API para PHP

41356.8k1](/packages/culqi-culqi-php)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[mollie/magento

iDEAL, Creditcard, Bancontact/Mister Cash, SOFORT, Bank transfer, Bitcoin, PayPal &amp; paysafecard for Magento https://www.mollie.com/

397.9k](/packages/mollie-magento)

PHPackages © 2026

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