hansvn / laravel-icepay

关于此包的最新版本(v0.1)没有可用的许可证信息。

Laravel对icepay api的集成

v0.1 2015-09-10 10:58 UTC

This package is not auto-updated.

Last update: 2024-09-18 10:17:15 UTC


README

此包是icepay api的Laravel集成。此包也可以直接使用(即不使用Laravel)。

!重要:此包尚未在所有平台上进行测试!

需求

  • PHP >=5.4

入门

Laravel < 5.0

  1. 安装 hansvn/laravel-icepay

    $ composer require hansvn/laravel-icepay
  2. 更新 `app/config/app.php` 以激活包

    # Add `Hansvn\Icepay\IcepayServiceProvider` to the `providers` array
    'providers' => array(
        ...
        'Hansvn\Icepay\IcepayServiceProvider',
    )
    
    # Add the Icepay alias
    'aliases' => array(
        ...
        'Icepay'          => 'Hansvn\Icepay\Facades\Icepay',
    )
  3. 发布配置文件

    $ php artisan config:publish hansvn/laravel-icepay
  4. 更新 app/config/packages/hansvn/icepay/config.php 并添加您的Icepay API密钥

    return array(
        'MERCHANTID'	=> xxxxx,//<--- Change this into your own merchant ID
        'SECRETCODE'	=> "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",//<--- Change this into your own merchant ID 
        ...
    );
  5. 可选:您可以将日志选项设置为true或false以记录icepay包的日志

    return array(
    	...
        'log'			=> true,
    );

用法

以下是此包的简单用法示例

生成10,00欧元的支付链接

$icepay = \Icepay::paymentObject();
$icepay->setAmount(1000)
			->setCountry("BE")
			->setLanguage("NL")
			->setReference("My Sample Website")
			->setDescription("My Sample Payment")
			->setCurrency("EUR");

$basic = Icepay::basicMode();
$basic->validatePayment($icepay);

return sprintf("<a href=\"%s\">%s</a>",$basic->getURL(),$basic->getURL());

您还可以查看此包的示例用法仓库,该仓库将订单保存到数据库中

贡献

欢迎贡献。

待办事项

  • 编写测试