PHPackages                             rarashed/payfast-sdk - 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. rarashed/payfast-sdk

ActiveLibrary

rarashed/payfast-sdk
====================

A library for handling payfast payment gateway integration

1.0.0(1y ago)111MITPHP

Since Dec 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/RaRashed/payfast-php)[ Packagist](https://packagist.org/packages/rarashed/payfast-sdk)[ RSS](/packages/rarashed-payfast-sdk/feed)WikiDiscussions main Synced 1mo ago

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

Payfast Package
===============

[](#payfast-package)

The `PayFast` package allows easy integration with payment gateway in one unified API. It is simple to install, configure, and use.

---

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

[](#installation)

You can install the package via Composer:

```
composer require rarashed/payfast-sdk
```

\#OR

```
composer require rarashed/payfast-sdk:dev-main
```

\#Code example

```
use RaRashed\PayFastSdk\PayFast;

$payfast = new PayFast(
    'merchant_id', // Your Merchant ID
    'merchant_name', // Your Merchant Name
    'secured_key', // Your Secured Key
    'token_api_url', // Your Token API URL
    'redirect_url', // Your Redirect URL
    'success_url', // Your Success URL
    'fail_url', // Your Failure URL
    'checkout_url' // Your Checkout URL
);

$payment_data = [
    'payment_amount' => 100.50,
    'payer_information' => [
        'name' => 'John Doe',
        'phone' => '1234567890',
        'email' => 'payer@example.com'
    ],
    'created_at' => now(),
];

$response = $payfast->processPayment($payment_data);
```

\#Pay HTML Form Code

```
$redirectUrl = "https://ipguat.apps.net.pk/Ecommerce/api/Transaction/PostTransaction"; // Test redirect URL

    PayFast Payment
