Paypal Payment Recieve Successfully But Get Payment Failure Message

687 views Asked by At

On my site i use paypal standart. I made a real test and payment recieved succesfull but get payment failure message on my system. Also results are same on Paypal IPN similator.

Details; My IPN file;

      <?php
class PayPal extends PaymentAPIHandler {
    var $gateway_name = 'PayPal';
    var $test_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
    var $url = 'https://www.paypal.com/cgi-bin/webscr';
...
....
 /**
    * Verify Response
    * Check to make sure the response is valid and not fraudulent
    * @return boolean
    */
    function verifyResponse() {
        if(isset($this->response['tx'])) {
            if(!empty($this->settings['paypal_pdt_token'])) {
                $parameters = 'cmd=_notify-synch&tx='.urlencode($_GET['tx']).'&at='.urlencode($this->settings['paypal_pdt_token']);
                $http_request = $this->PMDR->get('HTTP_Request');
                $http_request->settings = array(
                    CURLOPT_HEADER=>0,
                    CURLOPT_RETURNTRANSFER=>1,
                    CURLOPT_POST=>1,
                    CURLOPT_POSTFIELDS=>$parameters,
                    CURLOPT_CAINFO => PMDROOT.'/includes/cacert.pem',
                    CURLOPT_HTTPHEADER=>array('Host: www.paypal.com')

                );
                $response = $http_request->get('curl',$this->url);
                $response_parts = explode("\n", preg_replace('/\r\n|\r/', "\n", $response));
                if($verified_response = array_shift($response_parts) != 'SUCCESS') {
                    if(!is_null($http_request->error_number)) {
                        $this->errors[] = $http_request->error_message;
                    }
                    $this->errors[] = 'Invalid response: '.$verified_response;
                    $this->errors[] = 'Sent Parameters: '.$parameters;
                    unset($verified_response);
                    return false;
                }
                unset($verified_response);
                foreach($response_parts as $part) {
                    $value = explode('=',$part);
                    if($value[0] != '') {
                        $this->response[$value[0]] = urldecode($value[1]);
                    }
                }
            } elseif($this->response['st'] != 'Completed') {
                return false;
            }
        } else {
            $parameters_ignore = array('cmd');
            $parameters = 'cmd=_notify-validate';
            foreach ($this->response as $key=>$value) {
                if(in_array($key,$parameters_ignore)) {
                    continue;
                }
                $parameters .= "&$key=".urlencode(stripslashes($value));
            }
            unset($parameters_ignore);
            $http_request = $this->PMDR->get('HTTP_Request');
            $http_request->settings = array(
                CURLOPT_HEADER=>0,
                CURLOPT_RETURNTRANSFER=>1,
                CURLOPT_POST=>1,
                CURLOPT_POSTFIELDS=>$parameters,
                CURLOPT_CAINFO => PMDROOT.'/includes/cacert.pem',
                CURLOPT_HTTPHEADER=>array('Host: www.paypal.com')

and erros in payment gateway log in my system ;

payment_type => instant

payment_date => Fri Jun 12 2015 23:50:27 GMT+0300 (GTB Yaz Saati)

payment_status => Failed

address_status => confirmed

payer_status => verified

first_name => John

last_name => Smith

payer_email => [email protected]
payer_id => TESTBUYERID01

address_name => John Smith

address_country => United States

address_country_code => US

address_zip => 95131

address_state => CA

address_city => San Jose

address_street => 123 any street

business => [email protected]

receiver_email => [email protected]

receiver_id => [email protected]

residence_country => US

item_name => something

item_number => AK-1234

quantity => 1

shipping => 3.04

tax => 2.02

mc_currency => USD

mc_fee => 0.44

mc_gross => 12.34

mc_gross1 => 12.34

txn_type => web_accept

txn_id => 644696571

notify_version => 2.1

custom => xyz123

invoice => abc1234

test_ipn => 1

verify_sign => AFcWxV21C7fd0v3bYYYRCpSSRl31AwghKO7W8eQu9tuhieamEKWpf7PS

Errors:
Invalid response:

Access Denied

You don't have permission to access
 http://www.paypal.com/cgi-bin/webscr on this server.
Reference #18.d7b874e.1434142529.4860b30

Thanks in advance.

0

There are 0 answers