cancel
Showing results for 
Search instead for 
Did you mean: 

Things don't appear to be working right now.

Contributor

Things don't appear to be working right now.

I am receiving the above issue every time I tried to take payments through my website. I have gone through every 'solution' found with in the community and still nothing has remidied the issue my website can't process any payments and I have tried to get in touch with PayPal mts but have had no response.

23 REPLIES 23
Frequent Contributor

Re: Things don't appear to be working right now.

Can you provide a copy of the button code you're working with, or provide the URL where I can see the button code on your site?
Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Contributor

Re: Things don't appear to be working right now.

This is the full page of my Paypal code.

 

<?php

namespace Pg\modules\payments\models\systems;

use Pg\modules\payments\models\PaymentDriverModel;


class PaypalModel extends PaymentDriverModel
{
    public $payment_data = array(
        'gid'           => 'paypal',
        'name'          => 'Paypal',
        'settings_data' => 'a:1:{s:9:"seller_id";s:0:"";}',
        'logo'          => 'logo_paypal.png',
    );
    public $settings = array(
        "seller_id" => array("type" => "text", "content" => "string", "size" => "middle"),
    );
    protected $variables = array(
        "business"    => "seller_id",
        "mc_gross"    => "amount",
        "mc_currency" => "currency",
        "custom"      => "id_payment",
        "test_ipn"    => "test_mode",
    );

    public function funcRequest($payment_data, $system_settings)
    {
        $return = array("errors" => array(), "info" => array(), "data" => $payment_data);

        $send_data = array(
            "business"      => $system_settings["settings_data"]["seller_id"],
            "amount"        => $payment_data["amount"],
            "currency_code" => $payment_data["currency_gid"],
            "charset"       => 'utf-8',
            "custom"        => $payment_data["id_payment"],
            "test_ipn"      => "0",
            "rm"            => "2",
            "return"        => site_url(),
            "notify_url"    => site_url() . "payments/responce/paypal",
            "cancel_return" => site_url(),
            "cmd"           => "_xclick",
            "item_name"     => $payment_data["payment_data"]["name"],
        );
        $this->send_data("https://www.paypal.com/cgi-bin/webscr", $send_data, "post");

        return $return;
    }

    public function funcResponce($payment_data, $system_settings)
    {
        $return = array("errors" => array(), "info" => array(), "data" => array(), "type" => "exit");

        // verify
        $verify = $this->verifyData($payment_data);

        if (!$verify) {
            exit;
        }

        foreach ($this->variables as $payment_var => $site_var) {
            $return["data"][$site_var] = isset($payment_data[$payment_var]) ? $this->ci->input->xss_clean($payment_data[$payment_var]) : "";
        }

        $this->ci->load->model("Payments_model");
        $site_payment_data = $this->ci->Payments_model->get_payment_by_id($return["data"]['id_payment']);
        if (floatval($site_payment_data["amount"]) != floatval($return["data"]['amount']) ||
            $site_payment_data["currency_gid"] != $return["data"]['currency']) {
            $error = true;
        }

        //// get status
        $return["data"]["status"] = 0;
        if (isset($payment_data['payment_status'])) {
            switch ($payment_data['payment_status']) {
                case "Completed": $return["data"]["status"] = 1;
                    break;
                case "Pending": $return["data"]["status"] = 0;
                    break;
                default: $return["data"]["status"] = -1;
                    break;
            }
        }

        return $return;
    }

    public function getSettingsMap()
    {
        foreach ($this->settings as $param_id => $param_data) {
            $this->settings[$param_id]["name"] = l('system_field_' . $param_id, 'payments');
        }

        return $this->settings;
    }

    private function verifyData($payment_data)
    {
        $req = 'cmd=_notify-validate';

        foreach ($payment_data as $key => $value) {
            $req .= '&' . $key . '=' . urlencode(stripslashes($value));
        }

        $verify_url = 'www.paypal.com';

        if (function_exists('curl_init')) {
            $ch = curl_init('https://' . $verify_url . '/cgi-bin/webscr');
            curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
            $res = curl_exec($ch);
            curl_close($ch);
        } else {
            $header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
            $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
            $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

            $fp = fsockopen('ssl://' . $verify_url, 443, $errno, $errstr, 10);
            fputs($fp, $header . $req);

            while (!feof($fp)) {
                $res = fgets($fp, 1024);
                break;
            }
        }

        if (strcmp($res, "VERIFIED") == 0) {
            return true;
        } elseif (strcmp($res, "INVALID") == 0) {
        }

        return false;
    }
}

Frequent Contributor

Re: Things don't appear to be working right now.

Hmmm, yeah I don't think is going to work the way you're thinking.  When working with Payments Standard you can't just POST data to PayPal directly like you would with the APIs.

 

Your funcRequest() function is setting $return at the top, and then you're using $this->send_data() but I don't see that send_data() function in there to review it..??  You're returning $return, so I'm assuming send_data() must be populating $return with something else at that point..??

 

I think what you really need to be doing here is setting up a function that builds your HTML button and returns that so you can display directly on your page.  That's the button the user would click to be sent to PayPal.  So your funcRequest() would return the actual HTML button code, you would display that on your page, and it would submit with form action set to PayPal's endpoint.  I would give that a try and see if it helps.

 

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Contributor

Re: Things don't appear to be working right now.

So this is the code of the form used to send payment data. I have changed the URL for the purpose of this post.

 

<form method="post" name="send_form" id="send_form" action="https://www.paypal.com/cgi-bin/webscr"><input type="hidden" name="business" value="#accountID#"><input type="hidden" name="amount" value="1"><input type="hidden" name="currency_code" value="GBP"><input type="hidden" name="charset" value="utf-8"><input type="hidden" name="custom" value="77"><input type="hidden" name="test_ipn" value="0"><input type="hidden" name="rm" value="2"><input type="hidden" name="return" value="http://mywebsite.co.uk/"><input type="hidden" name="notify_url" value="http://mywebsite.co.uk/payments/responce/paypal"><input type="hidden" name="cancel_return" value="http://mywebsite.co.uk/"><input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="item_name" value="Add funds to account"></form><script>document.getElementById("send_form").submit();</script>

 

Could you tell me if there is anything wrong with this script?

Frequent Contributor

Re: Things don't appear to be working right now.

I added my own PayPal account ID and tested this on my server. Seems to be working just fine.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Contributor

Re: Things don't appear to be working right now.

Test transactions work fine but it's once I use it live I get the error, I have asked multipul people to try and they get the same error. It's frustrating as I've tried everything I can and it doesn't seem to work.

Frequent Contributor

Re: Things don't appear to be working right now.

What error are you getting now? I used my live account and it's working as expected, so this particular snippet isn't the problem. It redirected fine for me as I loaded the page, and it allowed me to login and choose funding source.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Contributor

Re: Things don't appear to be working right now.

People can Login and get though to the page where you input all of their payment details on Paypal but once you confirm the transaction that's when the error appears.

Contributor

Re: Things don't appear to be working right now.

This is what I received in an email from MTS, could you give me a little more detail please?

 

I can see the following:
 
FI_DETAILS
PAYMENT_CARD-INSTANT_TRANSFER;
DISALLOWED_REASONS
UNSUPPORTED_BY_PRODUCT:PARENT_FUNDING_COMBINATION_DISALLOWED
 
this has to do with the kind of product you are selling:
 
DISALLOWED_REASONS
UNSUPPORTED_BY_PRODUCT:UNSUPPORTED_DUE_TO_FUNDING_CONSTRAINT