Paypal付款成功收到但收到付款失败消息

时间:2015-06-12 22:34:39

标签: php paypal paypal-ipn

在我的网站上,我使用paypal标准。我做了一个真正的测试和付款收到成功但在我的系统上收到付款失败消息。 Paypal IPN similator也是如此。

详细信息; 我的IPN文件;

      <?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')

和支付网关中的错误登录我的系统;

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 => buyer@paypalsandbox.com
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 => seller@paypalsandbox.com

receiver_email => seller@paypalsandbox.com

receiver_id => seller@paypalsandbox.com

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

提前致谢。

0 个答案:

没有答案