Sift Science PHP Bindings
Installation
With Composer
-
Add siftscience/sift-partner-php as a dependency in composer.json., (*1)
"require": {
...
"siftscience/sift-partner-php" : "1.*"
...
}
-
Run composer update
., (*2)
-
Now SiftClient
will be autoloaded into your project., (*3)
require 'vendor/autoload.php';
$partner_client = new SiftClient('my_api_key', 'my_partner_id');
Manually
- Download the latest release.
- Extract into a folder in your project root named "sift-partner-php".
-
Include SiftClient
in your project like this:, (*4)
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');
Usage
Create a new account
Here's an example that creates a new merchant account., (*5)
// 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();
Get a list of accounts created by you
$partner_client = new SiftClient('my_api_key', 'my_partner_id');
$response = $partner_client->getAccounts();
$response->isOk();
// 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)
Contributing
Run the tests from the project root with PHPUnit like this:, (*6)
phpunit --bootstrap vendor/autoload.php test/SiftClientTest
License
MIT, (*7)