gpt4 book ai didi

php - 直接付款在 Paypal 沙箱中不起作用

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

您好,我想在 paypal 测试帐户中测试付款,但我遇到了错误

确认:“失败”上午:“100.00”构建:“9915774”相关 ID:“39d5ad29e8411”货币代码:“美元”L_ERRORCODE0:“10501”L_LONGMESSAGE0:“由于商家配置无效,无法处理此交易。”L_SEVERITYCODE0:“错误”L_SHORTMESSAGE0:“无效配置”时间戳:“2014-03-18T07:29:45Z”版本:“85.0”

我的config.php文件是

$sandbox = TRUE;
// Set PayPal API version and credentials.
$api_version = '85.0';
$api_endpoint = $sandbox ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
$api_username = $sandbox ? 'shafiq2626-facilitator@hotmail.com' : 'shafiq2626-facilitator@hotmail.com';
$api_password = $sandbox ? 'XXXXXX' : 'XXXXX';
$api_signature = $sandbox ? 'XXXXXXXXXXXXXXXXXXXXXXxx' : 'XXXXXXXXXXXXXXXXXXXXXXXXXXxxx';

我的dodirect方法是

<?php
// Include config file
require_once('includes/config.php');

// Store request params in an array
$request_params = array
(
'METHOD' => 'DoDirectPayment',
'USER' => $api_username,
'PWD' => $api_password,
'SIGNATURE' => $api_signature,
'VERSION' => $api_version,
'PAYMENTACTION' => 'Sale',
'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
'CREDITCARDTYPE' => $_REQUEST['cardtype'],
'ACCT' => $_REQUEST['pay_cardnumber'],
'EXPDATE' => $_REQUEST['crd_month'].$_REQUEST['crd_year'],
'CVV2' => $_REQUEST['security_code'],
'FIRSTNAME' => $_REQUEST['vpb_fname'],
'LASTNAME' => $_REQUEST['vpb_lname'],
'STREET' => $_REQUEST['street'],
'CITY' => $_REQUEST['city'],
'STATE' => $_REQUEST['state'],
'COUNTRYCODE' => 'US',
'ZIP' => $_REQUEST['zip'],
'AMT' => '100.00',
'CURRENCYCODE' => 'USD',
'DESC' => 'Testing Payments Pro'
);

// Loop through $request_params array to generate the NVP string.
$nvp_string = '';
foreach($request_params as $var=>$val)
{
$nvp_string .= '&'.$var.'='.urlencode($val);
}

// Send NVP string to PayPal and store response
$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);

// Parse the API response
$result_array = NVPToArray($result);


print_r($result_array);

// Function to convert NTP string to an array
function NVPToArray($NVPString)
{
$proArray = array();
while(strlen($NVPString))
{
// name
$keypos= strpos($NVPString,'=');
$keyval = substr($NVPString,0,$keypos);
// value
$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 json_encode($proArray);
}

请问可能是什么问题以及如何解决。

最佳答案

该特定错误与您的帐户未启用专业版有关。默认情况下,促进者帐户没有启用专业版,因此​​您需要在该帐户上启用它,或者在您的开发人员门户中创建一个单独的帐户,并在其上启用专业版。要在现有的企业沙盒帐户上启用专业版,请按照以下说明进行操作。

  1. 登录 developer.paypal.com
  2. 单击“应用程序”选项卡
  3. 点击左侧菜单中的沙盒帐户
  4. 单击促进者帐户左侧的箭头以展开选项
  5. 点击个人资料链接
  6. 点击您的企业帐户类型旁边的“升级到专业版”

关于php - 直接付款在 Paypal 沙箱中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22473107/

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