placeto / sdk-3ds-server
此包最新版本(V1.4)没有可用的许可证信息。
用于连接3ds服务器API的软件开发套件
V1.4
2022-11-14 21:56 UTC
Requires
- php: >=7.4
- ext-json: *
- guzzlehttp/guzzle: ^7.5
- psr/log: ^1.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.12
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: 3.*
- symfony/var-dumper: ^4.3
This package is not auto-updated.
Last update: 2024-10-01 06:42:29 UTC
README
用于连接3DS服务器API的软件开发套件
安装
您应该添加PlacetoPay仓库
{
"repositories": [
{
"type": "composer",
"url": "https://dev.placetopay.com/repository"
}
]
}
然后,您可以通过composer安装该包
composer require placeto/sdk-3ds-server
您需要做的第一件事是创建Server3DS类的实例,并将凭证(令牌、基础URL)作为参数传递。示例
return new Server3DS([
'token' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIzIQvhzVU',
'baseUrl' => 'https://3dss-test.placetopay.com/api',
]);
可用方法
createMerchant()
要创建商家,您必须从Server3DS类实例调用createMerchant()方法,并将请求字段(数组)作为参数传递给API。示例
$request = [
"name" => "EGM Ingenieria sin froteras" . mt_rand(),
"brand" => "placetopay",
"country" => "COL",
"currency" => "COP",
"document" => [
"type" => "RUT",
"number" => "123456789-0"
],
"url" => "https://www.placetopay.com",
"mcc" => 742,
"isicClass" => 111,
"branch" => [
"name" => "Ofic principal." . mt_rand(),
"brand" => "placetopay dos",
"country" => "COL",
"currency" => "COP"
],
"subscriptions" => [
[
"franchise" => 1,
"acquirerBIN" => 400900,
"version" => 2
],
],
"invitations" => [
"admin@admin.com" => "juan.pabon@evertecinc.com"
]
];
$response = $this->server3DS()->createMerchant($request);
createSession()
要创建新的会话,您必须从Server3DS类实例调用createSession()方法,并将请求字段(数组)作为参数传递给API。示例
$request = [
'acctNumber' => '4111111111111111',
'cardExpiryDate' => '2411',
'purchaseAmount' => '8.25',
'redirectURI' => 'http://www.placetopay.com',
'purchaseCurrency' => 'COP'
];
$response = $this->server3DS()->createSession($request);
transactionInformation()
要获取交易信息,您必须从Server3DS类实例调用transactionInformation()方法,并将transactionID(字符串)作为参数传递给API。示例
$transactionID = '135';
$response = $this->server3DS()->transactionInformation($transactionID);
addBranchesMerchants()
要向商家添加分支,您必须从Server3DS类实例调用addBranchesMerchants()方法,并将请求字段(数组)和URL的商家ID作为参数传递给API。示例
$request = [
"branches" => [
[
"name" => 'namebranch,
"brand" => "Evertec Medellin",
"country" => "COL",
"currency" => "COP",
"url" => "https://example-uno.com"
],
[
"name" => 'namebranch2,
"brand" => "Evertec Bogotá",
"country" => "COL",
"currency" => "COP",
"url" => "https://example-dos.com"
],
],
];
$merchantID = '135';
$response = $this->server3DS()->addBranchesMerchants($request, $merchantID);
使用getResponse()方法仅获取响应中的消息。
$response->getResponse()
要获取创建商家时在响应中获得的令牌,请调用getToken()方法。
$response->getToken()