lakshmaji / payubiz
payubiz
1.0.3
2017-06-04 07:50 UTC
Requires
- symfony/http-foundation: ~2.6|~3.0
README
这是什么
- 将PayUbiz服务与Laravel应用程序集成。
版本
1.0.1
安装
- 此包在Packagist上可用,我们可以在项目根目录的终端中执行以下命令简单地下载它。
composer require lakshmaji/payubiz
- 将服务提供者添加到 providers 数组中
Lakshmaji\PayUbiz\PayUbizServiceProvider::class,
- 将外观添加到 aliases 数组中
'PayUbiz' => Lakshmaji\PayUbiz\Facade\PayUbiz::class,
- 尝试使用composer(依赖项)更新应用程序
composer update
- 发布配置文件
php artisan vendor:publish
- 将凭据填充到config/payubiz.php中并启用生产模式。
return [ /* |-------------------------------------------------------------------------- | PayUbiz Authentication Secret |-------------------------------------------------------------------------- | | Don't forget to set this. | */ 'merchant_id' => 'gtSsEw', 'secret_key' => 'eRyshYFb', 'test_mode' => true ];
将PayUbiz服务与应用程序集成
以下示例说明了PayUbiz包的使用方法
<?php namespace Trending\Http\Controllers\File; use Carbon; use PayUbiz; use Illuminate\Http\Request; use Trending\Http\Controllers\Controller; /** * ----------------------------------------------------------------------------- * PayUbizTest - a class illustarting the usage of PayUbiz package * ----------------------------------------------------------------------------- * This class having the functionality to do payment using * PayUbiz services * * @since 1.0.0 * @version 1.0.0 * @author lakshmaji */ class PayUbizTest extends AnotherClass { public function doPayment() { // get input data $data = $this->request->all(); // All of these parameters are mandatory! $params = array( 'txnid' => $data['transaction_id'], 'amount' => $data['amount'], 'productinfo' => $data['product_info']', 'firstname' => $data['user_name'], 'email' => $data['user_email']', 'phone' => $data['mobile_number'], 'surl' => 'https:///payubiz_app_development/public/back', 'furl' => 'https:///payubiz_app_development/public/back', ); // Call to PayUbiz method $result = PayUbiz::initializePurchase($params); // Redirect to PayUbiz Payment Gateway services return $result; } /** * A method to process the results returned from the PayUbiz services * */ public function processResultFromPayUbiz() { $result = PayUbiz::completePurchase($_POST); $params = $result->getParams(); echo $result->getStatus()."\n"; echo $result->getTransactionId()."\n"; echo $result->getTransactionStatus()."\n"; echo $result->getStatus()."\n"; } } // end of class PayUbizTest // end of file PayUbizTest.php
方法
PayUbiz::initializePurchase(<PARAMETERS_REQUIRED_BY_PAYUBIZ>);
PayUbiz::completePurchase($_POST);
许可证