首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法获得未注册的3d-secure卡的身份验证(安全交易)

无法获得未注册的3d-secure卡的身份验证(安全交易)
EN

Stack Overflow用户
提问于 2019-03-31 16:44:00
回答 1查看 50关注 0票数 0

我运行的是PHP7.3,运行在apache服务器上。我使用composer获得了这个库:https://github.com/SecureTrading/PHP-API

对于提供的代码,我现在使用测试站点参考。我已经设法将其用于常规转换。我现在开始管理3D安全交易,使用secure trading提供的测试大师卡:https://docs.securetrading.com/document/testing/。设计为不要求3D身份验证的版本是5000000000000421

接下来提供的代码将总结我认为这应该是如何工作的:我首先创建auth请求,get error 30004,使用CACHETOKENISE请求来获取令牌,运行THREEDQUERY来确定我是否需要这张卡上的完整AUTH sceme,获得N作为答案,然后运行另一个AUTH请求,这次使用transactionreference。我提供了我正在测试的代码的一个版本(显然,为了保护我的隐私,删除了用户名、密码和站点引用名称,但代码在其他方面是相同的)

代码语言:javascript
复制
<?php 
$configData = array(
  'username' => 'api@gigsberg.com',
  'password' => 'xq!Kq$j4',
);
$site_refrance = 'test_gigsberg74319';

?>

<?php
$configData = array(
  'username' => '*****',
  'password' => '*****',
);
$site_refrance = '*****';

if (!($autoload = realpath(__DIR__ . '/vendor/autoload.php'))) {
  throw new \Exception('Composer autoloader file could not be found.');
}

require_once($autoload);
$api = \Securetrading\api($configData);

$requestData = array(
  'sitereference' => $site_refrance,
  'requesttypedescription' => 'AUTH',
  'accounttypedescription' => 'ECOM',
  'currencyiso3a' => 'GBP',
  'mainamount' => '1000',
  'pan' => '5000000000000421',
  'expirymonth' => '12',
  'expiryyear' => '2030',
  'securitycode' => '123',
);

echo '<pre>';
print_r($requestData);
$response = $api->process($requestData)->toArray();
print_r( $response['responses'] ); // $response['responses'][0]['errorcode'] == 30004
echo "\n--------------------------------------\n";

$transactionreference = $response['responses'][0]['transactionreference'];
$requestData = array(
  'sitereference' => $site_refrance,
  'expirymonth' => '12',
  'expiryyear' => '2030',
  'requesttypedescriptions' => array('CACHETOKENISE'),
  'securitycode' => '123',
  'orderreference' => $transactionreference,
  'pan' => '5000000000000421'
);

print_r($requestData);
$response = $api->process($requestData)->toArray();
echo "\n--------------------------------------\n";

$cachetoken = $response['responses'][0]['cachetoken'];
$requestData = array(
  'termurl' => 'https://termurl.com',
  'accept' => 'text/html,*/*',
  'currencyiso3a' => 'GBP',
  'requesttypedescription' => 'THREEDQUERY',
  'accounttypedescription' => 'ECOM',
  'sitereference' => $site_refrance,
  'baseamount' => '1000',
  'pan' => '5000000000000421',
  'expirymonth' => '12',
  'expiryyear' => '2030',
  'cachetoken' => $cachetoken,
);

print_r($requestData);
$response = $api->process($requestData)->toArray(); // $response['responses'][0]['enrolled'] == 'N'
/* Copying from the docs here: https://docs.securetrading.com/document/api/security/3-d-secure/
 * If the enrolled value returned in the response is “Y”, the customer’s card is enrolled in 3-D secure. Please refer to the following table for enrolled values:
 * .
 * .
 * N - The card is not enrolled in the card issuer’s 3-D Secure scheme.  - Perform an AUTH Request, including the transactionreference returned in the THREEDQUERY response.
 * .
 * .
*/
print_r( $response['responses'] ); 
echo "\n--------------------------------------\n";

$transactionreference = $response['responses'][0]['transactionreference'];
$requestData = array(
  'sitereference' => $site_refrance,
  'requesttypedescription' => 'AUTH',
  'accounttypedescription' => 'ECOM',
  'currencyiso3a' => 'GBP',
  'mainamount' => '1000',
  'pan' => '5000000000000421',
  'expirymonth' => '12',
  'expiryyear' => '2030',
  'securitycode' => '123',
  'transactionreference' => $transactionreference
);
print_r($requestData);
$response = $api->process($requestData)->toArray();
print_r( $response['responses'] ); // Still get $response['responses'][0]['errorcode'] == 30004

我希望它会提示我一切正常,但我仍然得到了错误30004,就好像没有提供事务引用一样。你知道我能做些什么,来修复这个代码,防止这个错误吗?提前感谢你,Yair

EN

回答 1

Stack Overflow用户

发布于 2019-03-31 17:35:08

嗯,我看了Api测试,发现了我的错误。在最后一个请求数据上,而不是

代码语言:javascript
复制
$requestData = array(
.
.
'transactionreference' => $transactionreference
.
.
);

我应该使用

代码语言:javascript
复制
$requestData = array(
.
.
'parenttransactionreference' => $transactionreference
.
.
);

不管怎么说,回家这对某人有帮助

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55439192

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档