All Projects → wshurafa → laravel-payfort

wshurafa / laravel-payfort

Licence: other
Laravel Payfort provides a simple and rich way to perform and handle operations for Payfort online payment gateway

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to laravel-payfort

paymentgateway
Dokumentace ČSOB platební brány a jejího eAPI pro platby platebními kartami, Apple Pay, mallpay a platebními tlačítky ČSOB.
Stars: ✭ 104 (+642.86%)
Mutual labels:  online-payments, payment-integration
Paynow-NodeJS-SDK
NodeJS SDK for Zimbabwe's leading payments gateway, Paynow
Stars: ✭ 23 (+64.29%)
Mutual labels:  online-payments, payment-integration
ccashcow
💰 Accept cards & crypto. Payments so easy a cow could do it.
Stars: ✭ 40 (+185.71%)
Mutual labels:  payment-integration
adyen-node-api-library
Adyen API Library for Node.js
Stars: ✭ 82 (+485.71%)
Mutual labels:  payment-integration
laravel-dynamodb-session-driver
DynamoDB Session Driver for Laravel 5
Stars: ✭ 15 (+7.14%)
Mutual labels:  laravel-5-package
laravel-hijri-dates
Hijri dates for Laravel
Stars: ✭ 25 (+78.57%)
Mutual labels:  laravel-5-package
laravel-form-builder
laravel专用表单生成器,快速生成现代化的form表单。包含复选框、单选框、输入框、下拉选择框等元素以及,省市区三级联动,时间选择,日期选择,颜色选择,树型,文件/图片上传等功能。
Stars: ✭ 59 (+321.43%)
Mutual labels:  laravel-5-package
opencart-3-sanalpos
OpenCart 3.x Sanal Pos Entegrasyonu Ücretsiz
Stars: ✭ 18 (+28.57%)
Mutual labels:  payment-integration
voyager-page-blocks
A module to provide page blocks for Voyager 📝
Stars: ✭ 80 (+471.43%)
Mutual labels:  laravel-5-package
Laravel-pushover
A Laravel wrapper for Pushover. Pushover makes it easy to get real-time notifications on your Android, iPhone, iPad, and Desktop (Pebble, Android Wear, and Apple watches, too!)
Stars: ✭ 49 (+250%)
Mutual labels:  laravel-5-package
voyager-portfolio
A Portfolio Module for Laravel Voyager 💋
Stars: ✭ 15 (+7.14%)
Mutual labels:  laravel-5-package
laravel-email-templates
Laravel 5 database driven email templates
Stars: ✭ 23 (+64.29%)
Mutual labels:  laravel-5-package
laravel-two-factor-authentication
A two-factor authentication package for Laravel >= 8
Stars: ✭ 37 (+164.29%)
Mutual labels:  laravel-5-package
laravel-zend-acl
Adds ACL to Laravel via Zend\Permissions\Acl component.
Stars: ✭ 41 (+192.86%)
Mutual labels:  laravel-5-package
shaka-php
🎞 Shaka PHP is a library that uses Shaka Packager for DASH and HLS packaging and encryption, supporting Common Encryption for Widevine and other DRM Systems.
Stars: ✭ 63 (+350%)
Mutual labels:  laravel-5-package
laravel-ses
A Laravel Package that allows you to get simple sending statistics for emails you send through SES, including deliveries, opens, bounces, complaints and link tracking
Stars: ✭ 39 (+178.57%)
Mutual labels:  laravel-5-package
adyen-hybris
Adyen Payment plugin for Hybris
Stars: ✭ 23 (+64.29%)
Mutual labels:  payment-integration
wc-moldovaagroindbank
WooCommerce maib Moldova Agroindbank Payment Gateway
Stars: ✭ 13 (-7.14%)
Mutual labels:  payment-integration
laravel-user-notifications
User notifications for Laravel 5+
Stars: ✭ 24 (+71.43%)
Mutual labels:  laravel-5-package
laravel-ab
Laravel A/B experiment testing tool
Stars: ✭ 108 (+671.43%)
Mutual labels:  laravel-5-package

Laravel Payfort Package

Software License

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.

  • 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.

Installation

You can install the package via composer:

composer require wshurafa/laravel-payfort

You can publish the config file with:

php artisan vendor:publish --provider "LaravelPayfort\Providers\PayfortServiceProvider"

This is the contents of the file that will be published at config/payfort.php :

return [
    /**
     * Defines wether to activate the Payfort sandbox enviroment or not.
     */
    'sandbox' => env('PAYFORT_USE_SANDBOX', false),

    /**
     * The Payfort merchant account identifier.
     */
    'merchant_identifier' => env('PAYFORT_MERCHANT_IDENTIFIER'),

    /**
     * The Payfort account access code.
     */
    'access_code' => env('PAYFORT_ACCESS_CODE'),

    /**
     * The Payfort account sha type (sha256/sha512).
     */
    'sha_type' => env('PAYFORT_SHA_TYPE', 'sha256'),

    /**
     * The Payfort account sha request phrase.
     */
    'sha_request_phrase' => env('PAYFORT_SHA_REQUEST_PHRASE'),

    /**
     * The Payfort account sha response phrase.
     */
    'sha_response_phrase' => env('PAYFORT_SHA_RESPONSE_PHRASE'),

    /**
     * The default currency for you app. Currency ISO code 3.
     */
    'currency' => env('PAYFORT_CURRENCY', 'USD'),

    /**
     * The URL to return after submitting Payfort forms.
     */
    'return_url' => env('PAYFORT_RETURN_URL', '/')
];

Then you have to add the following constants in the .env file:

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.

You can find most of these values in your Payfort account

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:

Authorization/Purchase request (Redirection)

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

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' => '[email protected]'  # 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

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

See Payfort documentation for more info.

Tokenization request

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

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.

See Payfort documentation for more info.

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:

use LaravelPayfort\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.

Handling Direct Transaction Feedback

Same as handling payfort response except that you have to call handlePayfortFeedback instead of handlePayfortCallback

Localization

The redirect page can be translated by simply using the json file of the language wihtin the lang directory of your app.

For example, ar.json file:

{
    ...
    "Payment redirect page": "صفحة إعادة توجيه الدفع",
    "Click here to proceed to payment if you are not automatically redirected": "انقر هنا لمتابعة الدفع إذا لم تتم إعادة توجيهك تلقائيًا",
    ...
}

Contribution

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

Simply, fork => do you work => make pull request.

Write clear comments and description ;-).

License

Laravel Payfort is open-sourced software licensed under the MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].