简体   繁体   English

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

[英]Do Direct Payment does not working in Paypal sandbox

Hi I want to test payment in paypal test account but I am facing error 嗨,我想在贝宝测试帐户中测试付款,但是我遇到了错误

ACK: "Failure" AMT: "100.00" BUILD: "9915774" CORRELATIONID: "39d5ad29e8411" CURRENCYCODE: "USD" L_ERRORCODE0: "10501" L_LONGMESSAGE0: "This transaction cannot be processed due to an invalid merchant configuration." ACK:“失败” AMT:“ 100.00”内置:“ 9915774” CORRELATIONID:“ 39d5ad29e8411”货币代码:“ USD” L_ERRORCODE0:“ 10501” L_LONGMESSAGE0:“由于无效的商家配置,无法处理此交易。” L_SEVERITYCODE0: "Error" L_SHORTMESSAGE0: "Invalid Configuration" TIMESTAMP: "2014-03-18T07:29:45Z" VERSION: "85.0" L_SEVERITYCODE0:“错误” L_SHORTMESSAGE0:“无效的配置” TIMESTAMP:“ 2014-03-18T07:29:45Z”版本:“ 85.0”

my config.php file is 我的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';

my dodirect method is 我的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);
}

What can be the problem and how this will fix please. 请问可能是什么问题,以及如何解决。

That particular error has to do with not having Pro enabled on your account. 该特定错误与您的帐户未启用Pro有关。 Facilitator accounts do not have Pro enabled by default so you'd either need to enable it on that account or create a separate account inside your developer portal that has Pro enabled on it. 主持人帐户默认情况下未启用专业版,因此​​您需要在该帐户上启用专业版,或者在开发人员门户中创建一个启用了专业版的单独帐户。 To enable pro on an existing business sandbox account follow the directions below. 要在现有的业务沙箱帐户上启用专业版,请按照以下说明进行操作。

  1. Login to developer.paypal.com 登录到developer.paypal.com
  2. Click the Applications Tab 单击应用程序选项卡
  3. Click Sandbox Accounts on the left menu 点击左侧菜单上的沙盒帐户
  4. Click the arrow to the left of your facilitator account to expand the options 点击主持人帐户左侧的箭头以展开选项
  5. Click the Profile link 点击个人资料链接
  6. Click "Upgrade to Pro" next to your Business account type 点击您的企业帐户类型旁边的“升级到专业版”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM