简体   繁体   中英

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." L_SEVERITYCODE0: "Error" L_SHORTMESSAGE0: "Invalid Configuration" TIMESTAMP: "2014-03-18T07:29:45Z" VERSION: "85.0"

my config.php file is

$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

<?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. 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
  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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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