switching from sandbox to paypal live

111 views Asked by At

I am getting the following error when switching from sandbox to live paypal.please help me how to solve this error.

Array
(
    [TIMESTAMP] => 2015-06-10T01:59:03Z
    [CORRELATIONID] => 4ce24a1abd742
    [ACK] => Failure
    [VERSION] => 85.0
    [BUILD] => 16770825
    [L_ERRORCODE0] => 10501
    [L_SHORTMESSAGE0] => Invalid Configuration
    [L_LONGMESSAGE0] => This transaction cannot be processed due to an invalid merchant configuration.
    [L_SEVERITYCODE0] => Error
    [AMT] => 555.00
    [CURRENCYCODE] => USD
)

Controller:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Checkout extends CI_Controller {


public function direct_payment() {

$item = $this->session->userdata['item_data']['item'];

$price = $this->session->userdata['item_data']['price'];

$quantity = $this->session->userdata['item_data']['quantity'];

$card_type = $this->input->post('card_type');

$card_fname = $this->input->post('card_fname');

$card_lname = $this->input->post('card_lname');

$creditcard_number = $this->input->post('creditcard_number');

$crd_month=$this->input->post('crd_month');

$crd_year=$this->input->post('crd_year');

$security_code=$this->input->post('security_code'); 

//$order_id  = $this->payment_model->save_order();

$respounse  = $this->payment_model->do_direct_payment($card_type,$card_fname,$card_lname,$creditcard_number,$crd_month,$crd_year,$security_code); 

echo '<pre>';

print_r($respounse);

exit;

if($respounse['ACK'] == 'SuccessWithWarning' or $respounse['ACK']== 'Success' or $respounse['ACK']== 'Pending') {

    //$this->db->update('orders', array('order_status'=>'New', 'transaction_id'=>$respounse['TRANSACTIONID'], 'payment_type' =>'Credit Card', 

    //'payment_status' =>$respounse['ACK'],'payment_recevied'=>$respounse['AMT'], 'payment_symbol'=>$respounse['CURRENCYCODE']), array('id'=> $order_id));

    //$this->cart->destroy();

    //$this->session->set_userdata(array(

    //'last_id'=> $order_id,'transaction'=>$respounse['TRANSACTIONID']));

    $this->session->set_flashdata("succes","Your Order is succesfully placed.");

    redirect("contents/credit");

    } else {

    //$this->db->update('orders', array('order_status'=>'Failed', 'payment_type' =>'Credit Card', 

    //'payment_status' =>$respounse['ACK']), array('id'=> $order_id));

    $this->session->set_flashdata("error","Error occur in your payment transacion.");

    redirect("contents/credit");        

    }   

    }

}

Model:

class payment_model extends CI_Model {

function do_direct_payment($card_type,$card_fname,$card_lname,$creditcard_number,$crd_month,$crd_year,$security_code) {

    $sandbox = TRUE;
    // Set PayPal API version and credentials.

    $api_version = '85.0';

    $api_endpoint = ($sandbox == 0 )? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';

    $api_username = ($sandbox == 0) ? '------' : '-------';

    $api_password = ($sandbox == 0) ? '-------' : '------';

    $api_signature =  ($sandbox == 0) ? '--------' : '-------';

    $request_params = array (
        'METHOD' => 'DoDirectPayment', 
        'USER' => $api_username, 
        'PWD' => $api_password, 
        'SIGNATURE' => $api_signature, 
        'VERSION' => $api_version, 
        'PAYMENTACTION' => 'Sale',                  
        'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
        'CREDITCARDTYPE' => $card_type, 
        'ACCT' => $creditcard_number,                       
        'EXPDATE' => $crd_month.$crd_year,          
        'CVV2' => $security_code, 
        'FIRSTNAME' => 'ibad', 
        'LASTNAME' => 'anjum', 
        'STREET' => '11 gg', 
        'CITY' => 'peshawar', 
        'STATE' => 'state',                     
        'COUNTRYCODE' => 'PK', 
        'ZIP' => '10200', 
        'EMAIL' => '-----',
        'AMT' => 555, 
        '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);
    //print_r($result);

    return $result_array = $this->NVPToArray($result);
}

public 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 $proArray;
}   

}
2

There are 2 answers

0
Sudhir Bastakoti On

As per the docs, the error code 10501 occurs when the billing agreement is disabled or inactive.You should enable your PayPal Payment Pro in your account. You could try doing the following::

  • Open your developer.paypal.com account.

  • Open applications to access your account.

  • Click the account you are trying to upgrade to Payment Pro.

  • Click Profile to find the option Upgrade to Pro in the dialogue box.

0
golddc On

If it worked on your Sandbox, it seems to me an account issue.

For account issues I would recommend getting contact with PayPal (bottom of http://www.paypal.com), and they will get the right team to support you.

Even if later they find it's technical, they will ask merchant technical services to support. But again, I think this is account issue. They will guide you through the necessary process.