siftscience / sift-partner-php
Sift Science Partnership API PHP 库
0.0.3
2016-06-30 23:27 UTC
Requires
- php: >=5.0.0
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-09-24 16:21:28 UTC
README
安装
使用 Composer
-
在 composer.json 中添加 siftscience/sift-partner-php 作为依赖项。
"require": { ... "siftscience/sift-partner-php" : "1.*" ... }
-
运行
composer update
。 -
现在
SiftClient
将自动加载到您的项目中。require 'vendor/autoload.php'; $partner_client = new SiftClient('my_api_key', 'my_partner_id');
手动
-
下载最新版本。
-
将其解压缩到项目根目录下名为 "sift-partner-php" 的文件夹中。
-
如下所示在项目中包含
SiftClient
require 'sift-partner-php/lib/Services_JSON-1.0.3/JSON.php'; require 'sift-partner-php/lib/SiftRequest.php'; require 'sift-partner-php/lib/SiftResponse.php'; require 'sift-partner-php/lib/SiftClient.php'; $partner_client = new SiftClient('my_api_key', 'my_partner_id');
用法
创建新账户
这是一个创建新商户账户的示例。
// Note: this will only work once, afterwards you will receive an
// error as the merchant account with these details has already been created
$partner_client = new SiftClient('my_api_key', 'my_partner_id');
$response = $partner_client->new_account(
"merchantsite.com", // the url for the merchant's site
"shopowner@merchantsite.com", // an email belonging to the merchant
"johndoe@merchantsite.com", // an email used to log in to Sift
"s0m3l0ngp455w0rd" // password associated with that log in
);
$response->isOk();
获取您创建的账户列表
$partner_client = new SiftClient('my_api_key', 'my_partner_id');
$response = $partner_client->getAccounts();
$response->isOk();
配置所有商户的 http 通知端点和阈值。
// Note: The %s must appear exactly once in your notification url.
$partner_client = new SiftClient('my_api_key', 'my_partner_id');
$response = $partner_client->updateNotificationConfig('http://your.url.endpoint/someting?id=%s', 0.60); //This sets the threshold to a 60 (0.60*100)
贡献
使用 PHPUnit 从项目根目录运行测试,如下所示
phpunit --bootstrap vendor/autoload.php test/SiftClientTest
许可证
MIT