PHPackages                             bermont-digital/payfast-php-sdk-fork - 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. bermont-digital/payfast-php-sdk-fork

AbandonedArchivedLibrary[Payment Processing](/categories/payments)

bermont-digital/payfast-php-sdk-fork
====================================

PayFast PHP Library | Bermont Digital Fork

09PHP

Since May 12Pushed 3y agoCompare

[ Source](https://github.com/bermont-digital/payfast-php-sdk)[ Packagist](https://packagist.org/packages/bermont-digital/payfast-php-sdk-fork)[ RSS](/packages/bermont-digital-payfast-php-sdk-fork/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PayFast PHP SDK FORK
====================

[](#payfast-php-sdk-fork)

See original repo at -
-------------------------------------------------------------------

[](#see-original-repo-at---httpsgithubcompayfastpayfast-php-sdk)

The PayFast PHP SDK provides an easy-to-use library for integrating PayFast payments into your project. This includes Custom Integration, Onsite Integration and all APIs.

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

[](#requirements)

PHP 7.2.5 and later.

Documentation
-------------

[](#documentation)

See the [Developer Docs](https://developers.payfast.co.za/docs)

Composer
--------

[](#composer)

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

```
composer bermont-digital/payfast-php-sdk-fork
```

To use the library, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

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

Getting Started
---------------

[](#getting-started)

### Custom Integration

[](#custom-integration)

Build a checkout form and receive payments securely from the PayFast payment platform.

See the [Developer Docs](https://developers.payfast.co.za/docs#quickstart)

```
try {
    $payfast = new PayFastPayment(
        [
            'merchantId' => '10000100',
            'merchantKey' => '46f0cd694581a',
            'passPhrase' => '',
            'testMode' => true
        ]
    );

    $data = [
        'amount' => '100.00',
        'item_name' => 'Order#123'
    ];

    echo $payfast->custom->createFormFields($data, ['value' => 'PAY NOW', 'class' => 'btn']);
} catch(Exception $e) {
    echo 'There was an exception: '.$e->getMessage();
}
```

### Onsite Payments

[](#onsite-payments)

Integrate PayFast’s secure payment engine directly into your checkout page.

See the [Developer Docs](https://developers.payfast.co.za/docs#onsite_payments)

```
// Include:

try {
    $payfast = new PayFastPayment(
        [
            'merchantId' => '10000100',
            'merchantKey' => '46f0cd694581a',
            'passPhrase' => '',
            'testMode' => false
        ]
    );

    $data = [
        'amount' => '100.00',
        'item_name' => 'Order#123'
    ];

    // Generate payment identifier
    $identifier = $payfast->onsite->generatePaymentIdentifier($data);

    if($identifier!== null){
        echo 'window.payfast_do_onsite_payment({"uuid":"'.$identifier.'"});';
    }
} catch(Exception $e) {
    echo 'There was an exception: '.$e->getMessage();
}
```

### API

[](#api)

#### Recurring Billing

[](#recurring-billing)

The Subscription Payments API gives Merchants the ability to interact with subscriptions on their accounts.

See the [Developer Docs](https://developers.payfast.co.za/api#recurring-billing)

```
try {
    $api = new PayFastApi(
        [
            'merchantId' => '10018867',
            'passPhrase' => '2uU_k5q_vRS_',
            'testMode' => true
        ]
    );

    $fetchArray = $api->subscriptions->fetch('2afa4575-5628-051a-d0ed-4e071b56a7b0');

    $pauseArray = $api->subscriptions->pause('2afa4575-5628-051a-d0ed-4e071b56a7b0', ['cycles' => 1]);

    $unpauseArray = $api->subscriptions->unpause('2afa4575-5628-051a-d0ed-4e071b56a7b0');

    $cancelArray = $api->subscriptions->cancel('2afa4575-5628-051a-d0ed-4e071b56a7b0');

    $updateArray = $api->subscriptions->update('2afa4575-5628-051a-d0ed-4e071b56a7b0', ['cycles' => 1]);

    $adhocArray = $api->subscriptions->adhoc('290ac9a6-25f1-cce4-5801-67a644068818', ['amount' => 500, 'item_name' => 'Test adhoc']);

} catch(Exception $e) {
    echo 'There was an exception: '.$e->getMessage();
}
```

#### Update card

[](#update-card)

The update card endpoint allows you to provide buyers with a link to update their card details on a Recurring Billing subscription or Tokenization charges.

See the [Developer Docs](https://developers.payfast.co.za/docs#recurring_card_update)

```
try {
    $payfast = new PayFastPayment(
            [
                'merchantId' => '10000100',
                'merchantKey' => '46f0cd694581a',
                'passPhrase' => '',
                'testMode' => false
            ]
        );

    echo $payfast->custom->createCardUpdateLink('2afa4575-5628-051a-d0ed-4e071b56a7b0', 'https://www.example.com/return', 'Update your card', ['target' => '_blank']);

} catch(Exception $e) {
    echo 'There was an exception: '.$e->getMessage();
}
```

#### Transaction History

[](#transaction-history)

The transaction history API gives Merchants the ability to interact with their PayFast account.

See the [Developer Docs](https://developers.payfast.co.za/api#transaction-history)

```
try {
    $api = new PayFastApi(
        [
            'merchantId' => '10018867',
            'passPhrase' => '2uU_k5q_vRS_',
            'testMode' => true
        ]
    );

    $rangeArray = $api->transactionHistory->range(['from' => '2020-08-01', 'to' => '2020-08-07', 'offset' => 0, 'limit' => 1000]);

    $dailyArray = $api->transactionHistory->daily(['date' => '2020-08-07', 'offset' => 0, 'limit' => 1000]);

    $weeklyArray = $api->transactionHistory->weekly(['date' => '2020-08-07', 'offset' => 0, 'limit' => 1000]);

    $monthlyArray = $api->transactionHistory->monthly(['date' => '2020-08', 'offset' => 0, 'limit' => 1000]);

} catch(Exception $e) {
    echo 'There was an exception: '.$e->getMessage();
}
```

#### Credit card transaction query

[](#credit-card-transaction-query)

The credit card transaction query API gives Merchants the ability to query credit card transactions.

See the [Developer Docs](https://developers.payfast.co.za/api#credit-card-transactions)

```
try {
    $api = new PayFastApi(
        [
            'merchantId' => '10018867',
            'passPhrase' => '2uU_k5q_vRS_',
            'testMode' => true
        ]
    );

    $creditCardArray = $api->creditCardTransactions->fetch('1124148');

} catch(Exception $e) {
    echo 'There was an exception: '.$e->getMessage();
}
```

#### Refunds

[](#refunds)

The Refunds API Providing gives Merchants the ability to perform refunds on their account.

See the [Developer Docs](https://developers.payfast.co.za/api#refunds)

```
try {
    $api = new PayFastApi(
        [
            'merchantId' => '10018867',
            'passPhrase' => '2uU_k5q_vRS_',
            'testMode' => false
        ]
    );

    $refundFetchArray = $api->refunds->fetch('dc0521d3-55fe-269b-fa00-b647310d760f');

    $refundCreateArray = $api->refunds->create('dc0521d3-55fe-269b-fa00-b647310d760f', ['amount' => 50, 'reason' => 'Product returned', 'acc_type' => 'savings']);

} catch(Exception $e) {
    echo 'There was an exception: '.$e->getMessage();
}
```

Testing for package developers
------------------------------

[](#testing-for-package-developers)

If you implement a new feature, write corresponding unit tests that will uncover bugs, e.g. if you write a function that generates a signature, write a unit test that validates the signature. Once you made changes - be sure to run all the unit tests.

In the root directory, first run (only once)

`composer i`

and to run tests, use

`phpunit --bootstrap vendor/autoload.php tests/`.

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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/26508155?v=4)[Luke](/maintainers/valkyriweb)[@valkyriweb](https://github.com/valkyriweb)

---

Top Contributors

[![clairepf](https://avatars.githubusercontent.com/u/68599211?v=4)](https://github.com/clairepf "clairepf (11 commits)")[![PieterE-PF](https://avatars.githubusercontent.com/u/109581616?v=4)](https://github.com/PieterE-PF "PieterE-PF (7 commits)")[![valkyriweb](https://avatars.githubusercontent.com/u/26508155?v=4)](https://github.com/valkyriweb "valkyriweb (3 commits)")[![lefu007](https://avatars.githubusercontent.com/u/10028848?v=4)](https://github.com/lefu007 "lefu007 (2 commits)")[![Baggins800](https://avatars.githubusercontent.com/u/10725942?v=4)](https://github.com/Baggins800 "Baggins800 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[msilabs/bkash

bKash Payment Gateway API for Laravel Framework.

181.1k](/packages/msilabs-bkash)

PHPackages © 2026

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