Laravel Payeer Checkout

Laravel Payeer Checkout

Latest Stable Version Total Downloads License
View Package

laravel payeer checkout

Overview: Laravel Payeer Checkout streamlines the process of integrating Payeer payment gateway into Laravel applications. With straightforward setup steps and flexible usage options, developers can facilitate seamless payments for their users.

Installation: Install the package via Composer:

composer require dipesh79/laravel-payeer-checkout

Add the required variables in the .env file:

PAYEER_SHOP_ID="Your Shop Id"
PAYEER_MERCHANT_KEY="Your Merchant Id"

Publish the vendor file for configuration:

php artisan vendor:publish --provider="Dipesh79\LaravelPayeerCheckout\PayeerServiceProvider"

Usage: Redirect the user to the payment page from your controller:

<?php

use Dipesh79\LaravelPayeerCheckout\LaravelPayeerCheckout;

// Your Controller Method
public function payeerPayment()
{
    // Store payment details in DB with pending status
    $payment = new LaravelPayeerCheckout();
    $amount = 123; 
    $order_id = 251264889; // Your Unique Order Id
    $description = "Order Description"; // Your Order Description which will be shown in Payeer dashboard 
    $currency = 'USD'; // This is optional. Default is USD
    return redirect($payment->payeerCheckout($amount, $order_id, $description, $currency));
}

Payment Handling: After successful payment, Payeer will redirect the user to your success URL, where you can update the payment status to 'Success'. Similarly, in case of payment failure, you can update the status to 'Fail' when Payeer redirects the user to the fail URL.

Success Payment Case:

<?php

public function payeerSuccess(Request $request)
{
    $order_id = $request->m_orderid;
    $payment = Payment::where('order_id', $order_id)->first();
    $payment->status = "Success";
    $payment->save();

    // Other Tasks
}

Fail Payment Case:

<?php

public function payeerFail(Request $request)
{
    $payment = Payment::where('order_id', $request->m_orderid)->first();
    $payment->status = "Fail";
    $payment->save();
    // Other Tasks
}

License: MIT

Author: @Dipesh79

Support: For support, email dipeshkhanal79@gmail.com.

This post is licensed under CC BY 4.0 by the author.