ranium / laravel-adyen
Adyen支付平台的Laravel包
v1.0.0-alpha
2017-09-25 09:59 UTC
Requires
- php: >=5.6.4
- adyen/php-api-library: ^1.3
- illuminate/support: ^5.4
This package is auto-updated.
Last update: 2024-09-23 19:46:43 UTC
README
描述
A Laravel 5.4+ package/wrapper for Adyen API Library. Adyen is a leading payment processor supporting multiple channels of payment on a single platform.
参考
This package is a wrapper for Adyen PHP API Library. For detailed usage and API reference, please read base library's documentation.
安装
使用composer安装
composer require ranium/laravel-adyen
配置
安装后,发布adyen配置文件
php artisan vendor:publish --provider="Ranium\LaravelAdyen\AdyenServiceProvider"
上述命令将创建 LARAVEL_ROOT/config/adyen.php 配置文件。
注意:此包支持配置多个adyen商户账户。您甚至可以定义公司范围内的设置,这些设置在包实例化时将与特定商户账户的设置合并。这对那些在其所有商户账户中具有某些设置(如web服务用户名和密码)的公司非常有用。他们只需定义一次此类设置,这些设置将与商户账户设置合并。`config/adyen.php` 文件有很好的文档,请参阅相关文档以了解用法/配置。
基本用法
此包主要用于实例化`\Adyen\Client`类。然后,将Adyen客户端传递给各种服务,如支付、定期付款、退款等。
$request = [ 'additionalData' => [ // Client side encrypted card data. See adyen documentation for more info. 'card.encrypted.json' => 'adyenjs_0_1_19$tfnNpk+3IbAAFJ...', ], 'amount' => [ 'value' => 1050, 'currency' => 'GBP', ], // Unique reference. This will be your order number or something similar 'reference' => 'test-' . time(), // Merchant account to use 'merchantAccount' => config('adyen.accounts.default.merchantAccount'), 'shopperEmail' => 'abbas@ranium.in', 'shopperIP' => '123.123.10.10', ]; // Make the adyen client $client = App::make(\Adyen\Client::class); // Instantiate the Payment service $service = new \Adyen\Service\Payment($client); try { $response = $service->authorise($request); } catch (\Adyen\AdyenException $e) { // Handle the error message dd($e->getMessage()); }