whitecube / multisafepay-php
此包最新版本(v0.1.0)没有可用的许可信息。
MultiSafepay API的非官方包装器。
v0.1.0
2019-09-09 09:35 UTC
Requires
- php: >=7.1.0
- guzzlehttp/guzzle: ^6.3
- php-http/message: ^1.8
This package is auto-updated.
Last update: 2024-09-12 05:23:29 UTC
README
MultiSafePay API的包装器。
安装
composer require whitecube/multisafepay-php
使用
在使用API之前,您必须指定两件事
- 应用程序环境(接受值是
production
或test
) - 您的MultiSafepay API密钥
$client = new Whitecube\MultiSafepay\Client('production', 'your-api-key'); // Example: Get an existing order $order = $client->orders()->fetch('order-id');
订单
Orders API位于客户端的orders
方法下。
$client->orders()->...
创建订单
查看官方文档。
订单由PHP对象表示,但可以作为常规关联数组提交。
use Whitecube\MultiSafepay\Entities\Order; $order = new Order('my-order-id') ->type('redirect') ->amount(20) ->currency('EUR') ->description('2 movie tickets') ->paymentOptions([ 'notification_url' => 'http://www.example.com/client/notification?type=notification', 'redirect_url' => 'http://www.example.com/client/notification?type=redirect', 'cancel_url' => 'http://www.example.com/client/notification?type=cancel', 'close_window' => '' ]); $client->orders()->create($order); // Or as an associative array $client->orders()->create([ 'order_id' => 'my-order-id', 'type' => 'redirect', 'amount' => 20, 'currency' => 'EUR', 'description' => '2 movie tickets', 'payment_options' => [ 'notification_url' => 'http://www.example.com/client/notification?type=notification', 'redirect_url' => 'http://www.example.com/client/notification?type=redirect', 'cancel_url' => 'http://www.example.com/client/notification?type=cancel', 'close_window' => '' ] ]);
获取订单
查看官方文档。 获取现有订单信息
$client->orders()->fetch('order-id');
更新订单
$client->orders()->update('order-id', [ 'status' => 'completed', //... ]);