startupmasters/laravel-epay

v1.0.1 2016-11-25 15:33 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:25:20 UTC


README

Laravel-epay 包

##安装

将以下内容添加到您的 composer.json 文件中

"startupmasters/epay":"1.0.*"

##更新 composer 文件

composer update

##在 config\app.php 中的 'providers' 数组中

StartupMasters\Epay\Epay\EpayServiceProvider::class,

...

在 'aliases' 数组中

   'Epay'  => StartupMasters\Epay\Facades\Epay::class

##发布配置文件

php artisan vendor:publish --tag=config

##如何使用:添加到 config-epay.php

<?php
return [
	'submit_url' 	=> 'URLToSend', 
	'secret' 		=> 'Here you must type your client secret key from epay site', // client secret
	'client_id' 	=> 'Here you must type your client id from epay site', // client id
	'expire_days' 	=> 1, // expire time for transations in days
	'success_url' 	=> 'SuccessURL', // where to return user after transaction complete
	'cancel_url' 	=> 'FailURL', // return user to this url if transaction is canceled
];

注意

 test url is : https://devep2.datamax.bg/ep2/epay2_demo/
 production url is : https://www.epay.bg/

添加到您的支付控制器中

$epay = Epay::generateInputFields([
            'invoice' => 'InvoiceID', // invoice ID
            'amount' => 'amount', // amount(not as a string)
            'descr' => 'Some about order' // info about order
        ],'pageType');
return view('payment')->with('epay', $epay);

注意:'pageType' 是您要加载的网关类型。如果您想通过 Epay 网站进行支付,请使用:'paylogin'。在其他情况下,您可以使用 BORICA 网关进行支付,因此使用:'credit_paydirect'。您的 blade 视图应类似于以下内容

<form method="post" action="{{ config('config-epay.submit_url') }}">

    {{ csrf_field() }}
    {!! $epay !!}
    <button type="submit">Submit</button>

</form>

参考:Epay 网站的文档 -> https://www.epay.bg/v3main/img/front/tech_wire.pdf(语言抱歉)