Giter Site home page Giter Site logo

codeboxrcodehub / nagad Goto Github PK

View Code? Open in Web Editor NEW
15.0 1.0 8.0 35 KB

Laravel Nagad Payment Gateway Package. Easy to manage nagad payment system.

Home Page: https://codeboxr.com

PHP 60.11% Blade 39.89%
bd-payment laravel-nagad-payment nagad-gateway nagad-php-payment-gateway laravel laravel-package php nagad-api nagad-api-library payment payments nagad-php-library nagad-php-package

nagad's Introduction

Nagad Payment Gateway for Laravel Framework/PHP project

Downloads Starts

Features

This is a php/laravel wrapper package for Nagad MFS

  1. Create Payment/Take to Payment Page
  2. Verify Payment/Query Payment/Payment Details
  3. Refund Payment

Requirements

  • PHP >=7.4
  • Laravel >= 6

Installation

composer require codeboxr/nagad

vendor publish (config)

php artisan vendor:publish --provider="Codeboxr\Nagad\NagadServiceProvider"

After publish config file setup your credential. you can see this in your config directory nagad.php file

"sandbox"         => env("NAGAD_SANDBOX", true), // if true it will redirect to sandbox url
"merchant_id"     => env("NAGAD_MERCHANT_ID", ""), 
"merchant_number" => env("NAGAD_MERCHANT_NUMBER", ""),
"public_key"      => env("NAGAD_PUBLIC_KEY", ""),
"private_key"     => env("NAGAD_PRIVATE_KEY", ""),
'timezone'        => 'Asia/Dhaka', // By default 
"callback_url"    => env("NAGAD_CALLBACK_URL", "http://127.0.0.1:8000/nagad/callback"), // By default you can change it in your callback url
"response_type"   => "json" // By default json you can change response type json/html 

Set .env configuration

NAGAD_SANDBOX=true // for production use false
NAGAD_MERCHANT_ID=""
NAGAD_MERCHANT_NUMBER=""
NAGAD_PUBLIC_KEY=""
NAGAD_PRIVATE_KEY=""
NAGAD_CALLBACK_URL=""

Usage

1. Create Payment

use Codeboxr\Nagad\Payment\Payment;

return (new Payment)->create($amount, $invoiceNumber)  // 1st parameter is amount and 2nd is unique invoice number 

or

use Codeboxr\Nagad\Facade\NagadPayment;

return NagadPayment::create($amount, $invoiceNumber);

2. Verify Payment

use Codeboxr\Nagad\Payment\Payment;

(new Payment)->verify($paymentRefId) // $paymentRefId which you will find callback URL request parameter

or

use Codeboxr\Nagad\Facade\NagadPayment;

NagadPayment::verify($paymentRefId);

3. Refund Payment

use Codeboxr\Nagad\Payment\Refund;

(new Refund)->refund($paymentRefId,$refundAmount);

or

use Codeboxr\Nagad\Facade\NagadRefund;

NagadRefund::refund($paymentRefId,$refundAmount);

Note: For the refund method, you have to pass two more parameters one is reference no and another reference message

Contributing

Contributions to the Nagad Payment Gateway package are welcome. Please note the following guidelines before submitting your pull request.

  • Follow PSR-4 coding standards.
  • Read Nagad API documentations first. Please contact with Nagad for their api documentation and sandbox access.

License

This repository is licensed under the MIT License.

Copyright 2022 Codeboxr. We are not not affiliated with Nagad and don't give any guarantee.

nagad's People

Contributors

dipudey avatar manchumahara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nagad's Issues

Is it secured to use?

Hello brother

I saw you've created this package for nagad payment gateway. But is it trusted to use?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.