yousef/payment-gateway

This package makes everything is simple, this payment method support (Visa, MasterCard)

2.9 2022-08-28 10:00 UTC

README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

This package makes everything is simple, Payment method supported (Visa, MasterCard)

Installation

Install via composer

composer require yousef/payment-gateway

Configuration

Add the PaymentGatewayServiceProvider class in your config/app.php file.

<?php
return [
    // ...
    
    'providers' => [
        Yousef\PaymentGateway\PaymentGatewayServiceProvider::class,
        
    ];

    // ...
];

Publish vendor config files if you need to replace by your own.

php artisan vendor:publish

Usage

Let's say you need use master, visa to pay orders online in your store, now using Payment Gateway package every thing is easy to integrate more readability and Testability. Payment Gateway package support multi currency like [KWD, AED, BHD, QAR, JOD] and anyone can add easy to modify.

<?php

    Payment::createSession($amount, $transactionId, $currency);
    
    Payment::pay($transactionId);
    

Add, modify currency configuration multi-currency-gateway.php

return [
    ...,
    'KWD' => [
        'certificate_verify_peer' => env('CERTIFICATE_VERIFY_PEER', false),
        'certificate_verify_host' => env('CERTIFICATE_VERIFY_HOST', 0),
        'gateway_url' => env('GATEWAY_URL', ''),
        'username'=> env('MERCHANT_USERNAME_KWD', ''),
        'merchant_id' => env('MERCHANT_ID_KWD', 0),
        'password'=> env('MERCHANT_PASSWORD_KWD', ''),
        'merchant_email' => env('MERCHANT_EMAIL_KWD', 0),
        'debug' => env('DEBUG', false),
        'version' => env('VERSION', 61),

        'operations' => [
            'new_session' => 'CREATE_CHECKOUT_SESSION',
            'retrieve_order' => 'RETRIEVE_ORDER',
        ]
    ],

Custom exception classes

    NotCaptured::class
    InvalidAmount::class  
    InvalidTransactionId::class

Add own configuration in .env file the DEFAULT_CURRENCY is USD

VERSION=""
GATEWAY_URL=""

MERCHANT_ID_USD=""
MERCHANT_EMAIL_USD=""
MERCHANT_USERNAME_USD=""
MERCHANT_PASSWORD_USD=""

MERCHANT_ID_KWD=""
MERCHANT_EMAIL_KWD=""
MERCHANT_USERNAME_KWD=""
MERCHANT_PASSWORD_KWD=""

Getting Help

If you're stuck getting something to work, or need to report a bug, please post an issue in the Github Issues for this project.

Contributing

If you're interesting in contributing code to this project, clone it by running:

git clone git@github.com:yousefdev20/laravel-payment-gateway.git

License

This project is open-sourced software licensed under the MIT license.