noetix / pin-php
Pin Payment API 库
v2.0.1
2016-06-06 11:32 UTC
Requires
- php: >=5.5.9
- kriswallsmith/buzz: >=0.6
- symfony/options-resolver: >=2.1
Requires (Dev)
- phpunit/phpunit: ~3.7
README
关于
Pin是澳大利亚首个一站式支付API。
- PHP 5.3+ 库
- Curl 传输(通过Buzz)
安装
从GitHub下载项目。下载完成后,您需要使用Composer。
确保包含类自动加载文件。
include 'vendor/autoload.php';
示例
费用
此示例将向测试信用卡收取4.00美元(API需要以分的形式提供金额)的活期API。要使用测试/沙盒API,请参阅下面的示例。
这是一个使用Pin Payments 费用API的示例
<?php // create our request handler $service = new Pin\Handler(array('key' => 'secret_API_key')); // build a new charge request $request = new Pin\Charge\Create(array( 'amount' => 400, 'description' => 'test charge', 'email' => 'roland@pin.net.au', 'ip_address' => '203.192.1.172', 'card' => array( 'number' => '5520000000000000', 'expiry_month' => '05', 'expiry_year' => '2013', 'cvc' => '123', 'name' => 'Roland Robot', 'address_line1' => '42 Sevenoaks St', 'address_city' => 'Lathlain', 'address_postcode' => '6454', 'address_state' => 'WA', 'address_country' => 'AU'), )); // send it $response = $service->submit($request);
退款
这是一个简单的退款处理示例。
这使用了Pin Payments 退款API
$request = new Pin\Charge\Refund('charge_token_here', array('amount'=>'900'));
活期API与测试API
此示例展示了如何添加一个选项,以便您使用测试API(test-api.pin.net.au)而不是活期API。
<?php $service = new Pin\Handler(array('key' => 'secret_API_key', 'test' => true));