PHPackages                             primitivesocial/shift4wrapper - 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. primitivesocial/shift4wrapper

ActiveLibrary[API Development](/categories/api)

primitivesocial/shift4wrapper
=============================

Wrapper for Shift4 API for Laravel

1.01(7y ago)13.6kMITPHP

Since Dec 26Pushed 7y ago3 watchersCompare

[ Source](https://github.com/PrimitiveSocial/shift4-wrapper)[ Packagist](https://packagist.org/packages/primitivesocial/shift4wrapper)[ Docs](https://github.com/primitivesocial/shift4wrapper)[ RSS](/packages/primitivesocial-shift4wrapper/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

Shift4Wrapper
=============

[](#shift4wrapper)

Wrapper for Shift4 API for Laravel

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

[](#installation)

`composer require primitivesocial/shift4wrapper`

Then, publish the config file: `php artisan vendor:publish`

You will need to add the following `.env` variables. `SHIFT4_API_URL`: URL for the Shift4 API `SHIFT4_CLIENT_GUID`: GUID from Shift4 `SHIFT4_AUTH_TOKEN`: Auth token from Shift4 `I4GO_API_URL`: API URL for I4GO `SHIFT4_COMPANY_NAME`: Name of company on file with Shift4 `SHIFT4_INTERFACE_NAME`: Name of interface on file with Shift4

Usage
-----

[](#usage)

### Get Access Token

[](#get-access-token)

Shift4 access tokens are long term, so you should store these.

```
$client = new Shift4Wrapper();

$accessToken = $client->accessToken;

```

### Create I4GO Token

[](#create-i4go-token)

```
$client = new Token($accessToken);

$client->ip('173.49.87.94')
		->expirationMonth(12)
		->expirationYear(30)
		->cardNumber('4321000000001119')
		->cvv('333')
		->cardType('VS')
		->name('John Smith')
		->zip('65000')
		->address('65 Main Street')
		->post();

// Set card value to preserve through tests
$token = $client->getToken();

```

### Post Sale

[](#post-sale)

```
$transaction = new Transaction($accessToken);

$transaction->tax(11.14)
		->total(111.45)
		->clerk('1')
		->invoiceNumber('12345')
		->tokenValue($token)
		->purchaseCard(array(
			'customerReference' => 412348,
			'destinationPostalCode' => 19134,
			'productDescriptors' => array('rent')
		))
		->sale();

```

### Post Refund

[](#post-refund)

```
$transaction = new Transaction($accessToken);

$transaction->total(200.00)
		->tokenValue($token)
		->invoiceNumber('12345')
		->clerk('5188')
		->refund();

```

### Delete Invoice

[](#delete-invoice)

Because the invoice number must be sent in the header for this call, the method is differently structured.

```
$transaction = new Transaction($accessToken);

$transaction->deleteInvoice($randomInvoice);

```

More methods can be viewed in the tests.

Testing
-------

[](#testing)

Shift4 requires certain testing to be done in order to qualify for use of their API in production. Passing tests can be found in the `tests` folder. Tests are connected to Laravel's `Log` class, which allows for ease of exporting test results for submission to Shift4.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

2696d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9833fa1630bcd67c1340f785eafdea467a48b3c665bcc4e59b1253e0fa400762?d=identicon)[jerredhurst](/maintainers/jerredhurst)

---

Top Contributors

[![dougblackjr](https://avatars.githubusercontent.com/u/6020323?v=4)](https://github.com/dougblackjr "dougblackjr (13 commits)")

---

Tags

apilaravelshift4laravelShift4WrapperShift4I4GO

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/primitivesocial-shift4wrapper/health.svg)

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

###  Alternatives

[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dcblogdev/laravel-xero

A Laravel Xero package

53129.1k1](/packages/dcblogdev-laravel-xero)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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