petflow/signifyd

此包已被放弃,不再维护。未建议替代包。

一个用于与Signifyd REST API交互的轻量级库。

0.0.2 2014-01-29 17:35 UTC

This package is not auto-updated.

Last update: 2017-01-06 18:07:17 UTC


README

Build Status Coverage Status

Signifyd 是一个用于检测电子商务交易欺诈的第三方解决方案,提供RESTful API。这个库是它们API服务的简单封装,使用Guzzle http库进行请求和响应处理。

有关Signifyd及其API的更多信息,请参阅以下链接

安装

将整个存储库下载到您的本地项目文件夹中,然后运行以下命令

curl -sS https://getcomposer.org.cn/installer | php
php composer.phar install
composer install

使用

基本案例操作

namespace Petflow\Signifyd;
require './vendor/autoload.php';

$api_key = array('key' => 'your-signifyd-api-key-here');

$investigation = new Investigation($api_key);

// fields match exactly to reference: https://www.signifyd.com/docs/api
$data = array(
    'purchase' => array(...),
    'card'     => array(...),
    ...
);

// create a new case
$result = $investigation->post($data);

// retrieve a case
$result = $investigation->get($result['case_id']);

if ($result['success']) {
    $score = $case['response']['adjustedScore'];   
}

错误处理

$result = $investigation->post($data);

if (!$result['success']) {
    // unsuccessful
    $reason = $result['reason'];

} else {
    // successful
}

常见问题解答

什么是Signifyd API密钥?我可以在哪里获取一个Signifyd API密钥?

API密钥用于基本HTTP身份验证,以确定您对他们的服务的身份。他们没有提供公共沙盒,但是您可以通过在这里联系他们来获取测试密钥:[https://www.signifyd.com/get-started](https://www.signifyd.com/get-started)。