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

ActiveLibrary[Payment Processing](/categories/payments)

fergusdixon/payfast-sdk-php
===========================

PayFast SDK - Make requests to PayFast

v0.0.2-alpha(7y ago)011MITPHPPHP ^7.2

Since Sep 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/fergusdixon/payfast-sdk-php)[ Packagist](https://packagist.org/packages/fergusdixon/payfast-sdk-php)[ RSS](/packages/fergusdixon-payfast-sdk-php/feed)WikiDiscussions dev Synced yesterday

READMEChangelog (1)Dependencies (6)Versions (4)Used By (0)

payfast-sdk-php
===============

[](#payfast-sdk-php)

[![MIT License](https://camo.githubusercontent.com/519da7482812391058290d3ad6fb1e59607b768b1b9d402a42e0353e3c6c028e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6665726775736469786f6e2f706179666173742d73646b2d7068702e737667)](https://camo.githubusercontent.com/519da7482812391058290d3ad6fb1e59607b768b1b9d402a42e0353e3c6c028e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6665726775736469786f6e2f706179666173742d73646b2d7068702e737667)[![Travis Build Status](https://camo.githubusercontent.com/18c83bea53f9a6172fb932e543e7a298d82858852406033cf0754ac3c73caab6/68747470733a2f2f7472617669732d63692e636f6d2f6665726775736469786f6e2f706179666173742d73646b2d7068702e7376673f6272616e63683d646576)](https://camo.githubusercontent.com/18c83bea53f9a6172fb932e543e7a298d82858852406033cf0754ac3c73caab6/68747470733a2f2f7472617669732d63692e636f6d2f6665726775736469786f6e2f706179666173742d73646b2d7068702e7376673f6272616e63683d646576)[![Codacy Badge](https://camo.githubusercontent.com/ed5f9453bc1c1062d91fdf3583f5efff7802dc3e544346da4487365dc7fa3f50/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6436313538653032363261383464363739323762373731643132646439643737)](https://www.codacy.com/project/fergusdixon101/payfast-sdk-php/dashboard?utm_source=github.com&utm_medium=referral&utm_content=fergusdixon/payfast-sdk-php&utm_campaign=Badge_Grade_Dashboard)[![StyleCI](https://camo.githubusercontent.com/f331ef7d2eacf6f753734990fa17cb0d840192ed3b2b48cbde42b0f99b5b1206/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3134343835373432372f736869656c643f6272616e63683d646576)](https://github.styleci.io/repos/144857427)[![codecov](https://camo.githubusercontent.com/09dac996a6d478758dec236992f85e2a847b74d5fcb5951799e0314058c52fb5/68747470733a2f2f636f6465636f762e696f2f67682f6665726775736469786f6e2f706179666173742d73646b2d7068702f6272616e63682f6465762f67726170682f62616467652e7376673f746f6b656e3d6831384c795633756567)](https://codecov.io/gh/fergusdixon/payfast-sdk-php)[![Packagist Version](https://camo.githubusercontent.com/57a62e83836214a955cc5dd407d19810353c5f6586cdb3f365f0f41a1fbdce47/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6665726775736469786f6e2f706179666173742d73646b2d7068702e737667)](https://camo.githubusercontent.com/57a62e83836214a955cc5dd407d19810353c5f6586cdb3f365f0f41a1fbdce47/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6665726775736469786f6e2f706179666173742d73646b2d7068702e737667)

A PHP handler for making requests to documented [PayFast](https://www.payfast.co.za) endpoints.

See their [docs](https://developers.payfast.co.za/documentation/)

Features
--------

[](#features)

- CI tools
- Handle [signature generation](https://developers.payfast.co.za/documentation/#api-signature-generation)
- Generate Timestamp
- Make user defined requests
- Support R0 verification charges
- Error handling
- Built in functions
    - Ping
    - Transaction History
    - Query Card Transaction
    - Subscriptions
        - Charge Subscription
        - Fetch Subscription Info
        - Pause Subscription
        - Unpause Subscription
        - Cancel Subscription

Usage
-----

[](#usage)

This PayFast SDK requires config variables passed to it.

`merchantId` and `passPhrase` are mandatory, if not defined other fields will default to values shown below:

```
$config = [
    'merchantId' => 'testId',               // Required
    'passPhrase' => 'testPhrase',           // Required
    'endpoint' => '//api.payfast.co.za',
    'port' => 443,
    'ssl' => true,
    'testing' => false,
];

$payfast = new PayFastSDK($config);
```

### Custom Requests

[](#custom-requests)

You can create a request to any endpoint in PayFast using `$payfast->request->customRequest($verb, $method, $options)`

For example, getting [Transaction History](https://developers.payfast.co.za/documentation/#transaction-history)

```
$verb = 'GET';
$method = '/history';
$options = [
    'from' => '2018-02-01',
    'to' => '2018-03-04',
];
$response = $payfast->request->customRequest($verb, $method, $options)
```

Quirks
------

[](#quirks)

### Signature Generation

[](#signature-generation)

Payfast requires a MD5 hash of the alphabetised submitted variables, header and body variables, as well as the passphrase to ensure the request has not been tampered with.

### Testing

[](#testing)

Payfast provides a [sandbox environment](https://sandbox.payfast.co.za/) to test integrations.

Test requests are sent to the normal endpoint, but append `?testing=true` to the URI.

Acknowledgements
----------------

[](#acknowledgements)

- Add yourself here!

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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

2785d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25303488?v=4)[Fergus Strangways-Dixon](/maintainers/fergusdixon)[@fergusdixon](https://github.com/fergusdixon)

---

Top Contributors

[![fergusdixon](https://avatars.githubusercontent.com/u/25303488?v=4)](https://github.com/fergusdixon "fergusdixon (50 commits)")

---

Tags

mit-licensepayfastpayment-gatewaypaymentsphpsdkpaymentspayfast

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/fergusdixon-payfast-sdk-php/health.svg)

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

###  Alternatives

[unicodeveloper/laravel-paystack

A Laravel Package for Paystack

650975.6k11](/packages/unicodeveloper-laravel-paystack)[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[omnipay/payfast

PayFast driver for the Omnipay payment processing library

24626.9k3](/packages/omnipay-payfast)[mnastalski/przelewy24-php

Przelewy24 PHP library

52101.2k2](/packages/mnastalski-przelewy24-php)[prevailexcel/laravel-nowpayments

A Laravel Package for NOWPayments

1414.2k](/packages/prevailexcel-laravel-nowpayments)[itsmurumba/laravel-mpesa

Laravel Package for Mpesa Daraja API

191.6k](/packages/itsmurumba-laravel-mpesa)

PHPackages © 2026

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