gpt4 book ai didi

php - paypal api沙箱和实时发送错误10501在第二次调用

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

我在使用 paypal api 沙箱和 live 时遇到了奇怪的问题当我第一次调用它时它工作正常但在第二次调用时它给了我 1051 错误这是我的代码

<?php
require_once('includes/config.php');
$request_params = array
(
'METHOD' => 'DoDirectPayment',
'USER' => $api_username,
'PWD' => $api_password,
'SIGNATURE' => $api_signature,
'VERSION' => $api_version,
'PAYMENTACTION' => 'Sale',
'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
'CREDITCARDTYPE' => 'VISA',
'ACCT' => 'MYCARDNUMBER',
'EXPDATE' => '092019',
'CVV2' => '456',
'FIRSTNAME' => 'mouner',
'LASTNAME' => 'mostafa',
'STREET' => '707 W. Bay Drive',
'CITY' => 'Largo',
'STATE' => 'FL',
'COUNTRYCODE' => 'US',
'ZIP' => '33770',
'AMT' => '100.00',
'CURRENCYCODE' => 'USD',
'DESC' => 'Testing Payments Prod'
);
$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);
echo $result.'<br /><br />';
curl_close($curl);
$result_array = NVPToArray($result);
echo '<pre />';
print_r($result_array);
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);
// decoding the respose
$proArray[$keyval] = urldecode($valval);
$NVPString = substr($NVPString,$valuepos+1,strlen($NVPString));
}
return $proArray;
}

配置文件有我的沙盒 url 和 api 详细信息

API 响应

Array
(
[TIMESTAMP] => 2016-08-22T00:53:51Z
[CORRELATIONID] => 9f0a90722a334
[ACK] => Failure
[VERSION] => 85.0
[BUILD] => 000000
[L_ERRORCODE0] => 10501
[L_SHORTMESSAGE0] => Invalid Configuration
[L_LONGMESSAGE0] => This transaction cannot be processed due to an invalid merchant configuration.
[L_SEVERITYCODE0] => Error
[AMT] => 100.00
[CURRENCYCODE] => USD
)

最佳答案

您的 Sandbox 帐户似乎没有 PRO 帐户。您将需要一个专业帐户来运行 DoDirectPayment API 调用。

我建议您从 developer.paypal.com 创建另一个帐户->创建沙盒帐户->升级到 PRO。

关于php - paypal api沙箱和实时发送错误10501在第二次调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39068190/

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