cashuanony / phpanonymous
cashu支付网关集成包,由PhpAnonymous为Laravel 5.0及以上版本创建 ^
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-08-29 04:26:55 UTC
README
cashu支付网关集成包,由PhpAnonymous为Laravel 5.0及以上版本创建 ^ 包版本 1.0
安装
在支持composer的composer或终端上运行此命令 composer require cashuanony/phpanonymous:dev-master
下载此包后,您可以在文件app.php的providers数组中添加此行 config/app.php
CashUAony\Phpanonymous\PhpAnonymousCashUProviders::class,
以及包中的aliases数组
'CashU' => CashUAony\Phpanonymous\CashU::class,
现在运行发布命令,将文件cashu.php推送到您的配置文件夹 php artisan vendor:publish
现在您可以在您的路径中看到此文件 config/cashu.php
#内容文件设置
<?php return [ 'sandbox' =>'https://sandbox.cashu.com/secure/payment.wsdl', 'live' =>'https://cashu.com/secure/payment.wsdl', 'follow_sandbox' =>'https://sandbox.cashu.com/cgi-bin/payment/pcashu.cgi', 'follow_live' =>'https://cashu.com/cgi-bin/payment/pcashu.cgi', 'trace' =>true, // true or false if default it "true" '_testmod' =>'0', // 0 for test mode or sandbox 1 for live mode 'secure' =>'default', // default for default encryption | full to Full Encryption '_session_id' =>'', // any key for 6 char or above '_encryption_key'=>'', //encryption with Service Default or Other Service '_merchant_id' =>'', // marchant name for cashu site | Account Name ];
为http://cashu.com创建一个新账户
如果您想创建沙盒账户,请点击此链接并使用测试模式沙盒创建新账户 http://sandbox.cashu.com/Merchants/en/login
##简单示例用法
Route::get('cashu',function(){ $data = []; $data['amount'] = '100'; // your amount here $data['currency'] = 'usd'; // currency type for lowercase $data['display_text'] = 'PAy For Phpanonymous'; // addtional display text like product name or discription anything $data['lang'] = 'ar'; // language arabic or english ( ar , en ) for lowercase $data['item1'] = 'test test'; // item text start for one to five item withcashu $data['item2'] = ''; $data['item3'] = ''; $data['item4'] = ''; $data['item5'] = ''; $data['service_name'] = 'PaymentPhpAnonymous'; // service name with setup on your account return CashU::Go($data); });
简单回调
Route::get('cashu/callback',function(Request $request){ return dd($request->all()); // after finshed proccess return all method status and session id // here you can return array and use key and values from it. //return array like /* 'netAmount'=>'', 'currency'=>'', 'amount'=>'', 'trnDate'=>'', 'session_id'=>'', 'token'=>'', */ });
现在您可以通过配置文件夹中的cashu.php文件将测试模式转换为生产模式
返回您的回调,使用Illuminate请求类或别名类...两者都可以使用
最后
查看回调参数,并根据需要使用它
该包为cashu支付自动提交重定向,只需使用这些参数作为您的cashu沙盒或生产账户即可,别忘了服务加密密钥
如果您有任何问题,您可以通过以下链接加入我们的Facebook群组 https://#/groups/anonymouses.developers/
享受吧!!
再见