This is my package fawry

dev-master 2023-08-25 07:00 UTC

This package is not auto-updated.

Last update: 2024-11-20 13:52:43 UTC


README

Latest Version on Packagist Software License Build Status Quality Score Code Coverage Total Downloads

Fawry is a Laravel package for the Fawry payment gateway (EGYPT).

Contents

Installation

You can install the package via composer:

composer require laravel-pay/fawry

You can publish and run the Translations with:

php artisan vendor:publish --tag="fawry-translations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="fawry-config"

This is the contents of the published config file:

<?php

// config for LaravelPay/Fawry
return [
    "staging" => [
        'url' => env('FAWRY_STAGING_URL', "https://atfawry.fawrystaging.com/"),
        'secret' => env('FAWRY_STAGING_SECRET'),
        'merchant' => env('FAWRY_STAGING_MERCHANT'),
    ],

    "live" => [
        'url' => env('FAWRY_LIVE_URL', "https://www.atfawry.com/"),
        'secret' => env('FAWRY_LIVE_SECRET'),
        'merchant' => env('FAWRY_LIVE_MERCHANT'),
    ],

    // required allowed values [POPUP, INSIDE_PAGE, SIDE_PAGE , SEPARATED]
    'display_mode' => env('FAWRY_DISPLAY_MODE',"POPUP"),
    // allowed values ['CashOnDelivery', 'PayAtFawry', 'MWALLET', 'CARD' , 'VALU']
    'pay_mode'=>env('FAWRY_PAY_MODE',"CARD"),

    "verify_route_name" => env('FAWRY_VERIFY_ROUTE_NAME', "fawry.verify"),

    "locale" => env('FAWRY_LOCALE', "ar"), // ar or en

    "language" => env('FAWRY_LANGUAGE', "ar-eg"), // ar-eg or en-us
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="fawry-views"

Usage

  1. add this to your .env file
FAWRY_STAGING_MERCHANT=""
FAWRY_STAGING_SECRET=""
  1. Pay Route
Route::get("/fawry" , function(){
    $form = Fawry::setOnStagingMode()
        ->setAmount(100.12)
        ->setUserId(11111)
        ->setUserFirstName("ahmed")
        ->setUserLastName("elsayed")
        ->setUserEmail("ahmed_elsayed@gmail.com")
        ->setUserPhone("01000000000")
        ->pay();

    return view("welcome" , [
        "form" => $form['html']
    ]);
});
  1. Verify Route
    note : you can change the verify route name in config file
Route::get("/fawry/verify" , function(){
    $response = Fawry::setOnStagingMode()->verify();
    dd($response);
})->name("fawry.verify");

Changelog

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Security

Please review our security policy on how to report security vulnerabilities.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.