我在使用Neteller将资金从我们的商人帐户转移到一个用户时遇到了一些问题。我成功地收到了accessToken,但是当我尝试使用transferOut时,我只得到了无效的凭据?我使用的代码是:
$headers = array(
"Content-type" => "application/json",
"Authorization" => "Bearer " . $accessToken
);
//build the request body structure
$requestParams = array(
"payeeProfile" => array(
"email" => $the_email_address_to_send_to
),
"transaction" => array(
"merchantRefId" => $transaction_id,
"amount" => $amount,
"currency" => $currencyCode
)
);
// encode the requestParams to a string
$requestParams = json_encode($requestParams);
// The curl stuff
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.neteller.com/v1/transferOut");
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestParams);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// Ok lets send this lovely looking curl over
$serverOutput = json_decode(curl_exec($curl));显然,所有变量($transaction_id、$amount、$currency)都是适当设置的。然而,我得到的回应是:
stdClass Object
(
[error] => stdClass Object
(
[code] => 5279
[message] => Authentication credentials are invalid
)
)我很困惑,accessToken肯定是我需要的凭证,他们已经收到了。我是否应该在transferOut的curl后置字段中包含其他内容?
提前感谢
发布于 2015-08-19 13:22:39
$headers看起来不太好--试试$headers = array("Content-type: application/json", "Authorization: Bearer " . $accessToken);吧。至少这是根据http://php.net/manual/en/function.curl-setopt.php的格式
注意,Merchant也需要一定的长度。不知道什么-找不到参考,但8个字符不够长。
https://stackoverflow.com/questions/32010775
复制相似问题