我正在尝试通过 php Curl (mycurl) 使用 PaySafe Rest API,但出现错误。我的PHP代码:
$url="https://api.test.paysafe.com/cardpayments/v1/accounts/xxxxxxx/auths";// si erreur ajouter HTTP/1.1
$headers=array('content-type: application/json');
$call_api=new mycurl($url);
$call_api->useAuth(true);
$call_api->setName(" my username");
$call_api->setPass("my password");
$call_api->setHeaders($headers);
$curlopt_postfields=json_encode( array(
'merchantRefNum' => 'merchant ref',
'amount' => 10,
'settleWithAuth'=>true,
'card' => array(
'paymentToken' => 'my token key'
),
'billingDetails' => array(
'street' => '100 Queen Street West',
'city' => 'Toronto',
'state' => 'ON',
'country' => 'CA',
'zip' => 'M5H 2N2'
)
));
$call_api->setPost($curlopt_postfields);
$call_api->setJson();
$call_api->createCurl($url);
//result
$result_api_httpStatus=$call_api->getHttpStatus();
$result_api=$call_api->tostring();
if($result_api_httpStatus==200)
{
echo 'OK';
}
else {
//echo $result_api_httpStatus;
print_r($result_api);
}
这个过程在这里解释
在下面,返回的错误:
{"links":[{"rel":"self","href":"https:\/\/api.test.paysafe.com\/cardpayments\/v1\/accounts\/xxxxxx\/auths\/yyyyyyyyyy"}],"id":"yyyyyyyyyy","merchantRefNum":"merchant number","error":{"code":"1007","message":"Internal Error.","links":[{"rel":"errorinfo","href":"https:\/\/developer.paysafe.com\/en\/rest-api\/cards\/test-and-go-live\/card-errors\/#ErrorCode1007"}]},"settleWithAuth":true}
“消息”:“内部错误。” 但我不知道为什么...
我记得我按照 paysafe.js 的令牌化过程生成令牌,如此处所述
请帮帮我