2017 © Pedro Peláez
 

library payfort-laravel

payfort-laravel is a simple package to process payments throught Payfort payment gateway.

image

pacexyz/payfort-laravel

payfort-laravel is a simple package to process payments throught Payfort payment gateway.

  • Wednesday, September 27, 2017
  • by S3dy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Payfort Package

Software License, (*1)

Laravel Payfort provides a simple and rich way to perform and handle operations for Payfort (MEA based online payment gateway) check here to read more Payfort.
This package supports a set of Payfort operations as listed below, other operations are open for future work and contribution., (*2)

  • AUTHORIZATION/PURCHASE
  • TOKENIZATION
  • SDK_TOKEN
  • CHECK_STATUS

You have to read the Payfort documentation very well before proceeding in using any package, the package author will not write about Payfort operations, what and how to use., (*3)

Install

You can install Laravel Payfort package to your laravel project via composer command:, (*4)

$ composer require pacexyz/payfort-laravel

Configuration

After installing the Laravel Payfort library, register the PayfortLaravel\Providers\PayfortServiceProvider in your config/app.php configuration file:, (*5)

'providers' => [
    // Other service providers...

    PayfortLaravel\Providers\PayfortServiceProvider::class,
],

Also, add the Payfort facade to the aliases array in your app configuration file:, (*6)

'Payfort' => PayfortLaravel\Facades\Payfort::class

After that, run the following command to publish the configurations file:, (*7)

$ php artisan vendor:publish --provider "PayfortLaravel\Providers\PayfortServiceProvider"

This will create a new config file named payfort.php in config folder. Then you have to add the following constants in the .env file, you can find most of these values in your Payfort account. PAYFORT_USE_SANDBOX=true # Defines wether to activate the payfort sandbox enviroment or not. PAYFORT_MERCHANT_IDENTIFIER=s2b3rj1vrjrhc1x # The payfort merchant account identifier PAYFORT_ACCESS_CODE=s31bpM1ebfNnwqo # The payfort account access code PAYFORT_SHA_TYPE=sha256 # The payfort account sha type. sha256/sha512 PAYFORT_SHA_REQUEST_PHRASE=keljhgiergh # The payfort account sha request phrase PAYFORT_SHA_RESPONSE_PHRASE=lkejgoegj # The payfort account sha response phrase PAYFORT_CURRENCY=USD # The default currency for you app. Currency ISO code 3. PAYFORT_RETURN_URL=/payfort/handle # The url to return after submitting payfort forms., (*8)

Basic Usage

Once all configuration steps are done, you are ready to use payfort operations in your app. Here is some examples on how to use this package:, (*9)

Authorization/Purchase request (Redirection)

To display payfort authorization or purchase page, in your controller's method add the following code snippet:, (*10)

return Payfort::redirection()->displayRedirectionPage([
    'command' => 'AUTHORIZATION',              # AUTHORIZATION/PURCHASE according to your operation.
    'merchant_reference' => 'ORDR.34562134',   # You reference id for this operation (Order id for example).
    'amount' => 100,                           # The operation amount.
    'currency' => 'QAR',                       # Optional if you need to use another currenct than set in config.
    'customer_email' => 'example@example.com'  # Customer email.
]); 

Other optional parameters that can be passed to displayRedirectionPage method as follows: * token_name * payment_option * sadad_olp * eci * order_description * customer_ip * customer_name * merchant_extra * merchant_extra1 * merchant_extra2 * merchant_extra3, (*11)

Payfort page will be displayed and once user submits the payment form, the return url defined in the environment configurations will be called., (*12)

See Payfort documentation for more info., (*13)

Tokenization request

To display payfort tokenization page, in your controller's method add the following code snippet:, (*14)

return Payfort::redirection()->displayTokenizationPage([
    'merchant_reference' => 'ORDR.34562134',   # You reference id for this operation (Order id for example).
]); 

Payfort page will be displayed and once user submits the payment form, the return url defined in the config file will be called., (*15)

See Payfort documentation for more info., (*16)

Handling Payfort Authorization/Purchase response

Handling callback (return)

In your handling controller that handle the return url, you can simply use the PayfortResponse trait as follows:, (*17)

use PayfortLaravel\Traits\PayfortResponse as PayfortResponse;

class PayfortOrdersController extends Controller{
    use PayfortResponse;

    public function processReturn(Request $request){
        $payfort_return = $this->handlePayfortCallback($request);
        # Here you can process the response and make your decision.
        # The response structure is as described in payfort documentation
    }
}

See Payfort documentation for more info., (*18)

Handling Direct Transaction Feedback

Same as handling payfort response except that you have to call handlePayfortFeedback instead of handlePayfortCallback, (*19)

Contribution

Want to improve this package or found a bug ?. Open an issue or do this contribution by yourself and get this honor., (*20)

Simply, fork => do you work => make pull request., (*21)

Write clear comments and description ;-)., (*22)

License

Laravel Payfort is open-sourced software licensed under the MIT license, (*23)

The Versions

27/09 2017

dev-master

9999999-dev

payfort-laravel is a simple package to process payments throught Payfort payment gateway.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Saud Bawazeer

payment http payfort laravel payfort