# Fawry (EGYPT)

Latest Version on Packagist (opens new window) Software License (opens new window) Build Status (opens new window) Quality Score (opens new window) Code Coverage (opens new window) Total Downloads (opens new window)

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 (opens new window) for more information on what has changed recently.

# Testing

$ composer test

# Security

Please review our security policy (opens new window) on how to report security vulnerabilities.

# Contributing

Please see CONTRIBUTING (opens new window) for details.

# Credits

# License

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