gpt4 book ai didi

php - paypal的 'HKD'方法支持货币 "DoDirectPayment"?

转载 作者:太空宇宙 更新时间:2023-11-03 16:07:18 25 4
gpt4 key购买 nike

我正在尝试在我的网站上实现“DoDirectPayment”方法。我有 paypal 沙盒帐户,并且有 paypal api。当我将货币设置为“美元”时,我的代码会返回成功消息。但是,当我设置“HKD”货币时,它会返回“由于货币不受支持,无法处理此交易”消息。

这里我附上了我的代码。请检查并给我一些解决方案。

$api_version = '78.0';
$api_endpoint = 'https://api-3t.sandbox.paypal.com/nvp';

$api_username = 'platfo_1255077030_biz_api1.gmail.com';
$api_password = '1255077037';
$api_signature = 'Abg0gYcQyxQvnf2HDJkKtA-p6pqhA1k-KTYE0Gcy1diujFio4io5Vqjf';



$creditcardtype = 'VISA';
$cardno = '4854897648835021';
$expdate = '112020';
$cvv = '176';
$PRICE = '50.00';
$currency_code = 'HKD';
$request_params = array(
'USER' => $api_username,
'PWD' => $api_password,
'SIGNATURE' => $api_signature,
'VERSION' => $api_version,
'PAYMENTACTION' => 'SALE',
'CREDITCARDTYPE' => $creditcardtype,
'ACCT' => $cardno,
'EXPDATE' => $expdate,
'CVV2' => $cvv,
'AMT' => $PRICE,
'CURRENCYCODE' => $currency_code,
'FIRSTNAME'=>'James',
'LASTNAME'=>'Smith',
'STREET'=>'FirstStreet',
'CITY'=>'SanJose',
'STATE'=>'CA',
'COUNTRYCODE'=>'US',
'ZIP'=>95131
);
$request_params['METHOD'] = 'DoDirectPayment';


$nvp_string = '';
foreach($request_params as $var=>$val)
{
$nvp_string .= '&'.$var.'='.urlencode($val);
}

$curl = curl_init();
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_URL, $api_endpoint);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string);

$result = curl_exec($curl);
curl_close($curl);
$response = NVPToArray($result);
echo '<pre>';
print_r($response);
echo '</pre>';


function NVPToArray($NVPString)
{
$proArray = array();
while(strlen($NVPString))
{
$keypos= strpos($NVPString,'=');
$keyval = substr($NVPString,0,$keypos);
$valuepos = strpos($NVPString,'&') ? strpos($NVPString,'&'): strlen($NVPString);
$valval = substr($NVPString,$keypos+1,$valuepos-$keypos-1);
$proArray[$keyval] = urldecode($valval);
$NVPString = substr($NVPString,$valuepos+1,strlen($NVPString));
}
return $proArray;
}

这是输出信息 http://i.imgur.com/JMMG4I3.png

提前致谢

最佳答案

引用https://developer.paypal.com/docs/classic/api/currency_codes/?mark=currency , 在“直接信用卡产品的多币种支持”部分,如果您的沙盒账户国家是美元,支持的货币有澳元、加元、欧元、英镑、日元、美元,因此不支持港币。

关于php - paypal的 'HKD'方法支持货币 "DoDirectPayment"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36232713/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com