承接 farsh4d/laravel-bank 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

farsh4d/laravel-bank

最新稳定版本:1.0.0

Composer 安装命令:

composer require farsh4d/laravel-bank

包简介

A package to connect to any IPG to make a payment

README 文档

README

Packagist License Latest Stable Version Total Downloads

This is a package to connect to any Internet Payment Gateways.
This package now only supports Mellat IPG for now but we are developing other IPGs ASAP.

Installation

Require this package with composer.

composer require farsh4d/laravel-bank

Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Laravel without auto-discovery:

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

Farsh4d\Bank\Providers\BankServiceProvider::class,

Copy the package config to your local config with the publish command:

php artisan vendor:publish --provider="Farsh4d\Bank\Providers\BankServiceProvider"

Prepare your database

php artisan migrate

Usage

You need 2 routes, one to start a payment and one for callback:

routes.php

Route::get('/payment-start', 'PaymentController@start')->name('payment_start');
Route::any('/payment-callback', 'PaymentController@callback')->name('payment_callback');

Remember to exclude your callback route from CSRF verification.

In start method initialize your desired driver and set required data (price, orderId and callback):

PaymentController.php @start

$amount = 50000;
$orderId = '123456';

$bankDriver = Bank::driver('Mellat');

$bankDriver->price($amount)
    ->orderId($orderId)
    ->callback(route('payment_callback'));

try {
    $bankDriver->ready();
    return $bankDriver->redirect();
} catch (\Exception $e) {
    // Handle failed transaction initiation; ie:
    return view('payment-error');
}

If everything goes right user redirects to IPG and makes a payment and then redirects to your callback.

PaymentController.php @verify

try {
    Bank::verify();
    // Show transaction success view or do sth else; ie:
    return view('payment-success');
} catch (\Exception $e) {
    // Handle failed payment; ie:
    return view('payment-failed');
}

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固