Forum

Thread tagged as: Problem, Shop

Paypal redirect

Can anyone help please?!?! I've got a tight deadline and my checkout is not redirecting to paypal


Perch: 3.1.2 Production mode: Production (100) Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_shop_orders (1.2.6), perch_shop_products (1.2.6), perch_shop (1.2.6), perch_members (1.6.4) DB driver: PDO DB tables: perch3_categories (14), perch3_category_counts (0), perch3_category_sets (1), perch3_content_index (0), perch3_content_items (0), perch3_content_regions (0), perch3_members (0), perch3_members_forms (1), perch3_members_member_tags (0), perch3_members_sessions (1), perch3_members_tags (8), perch3_menu_items (12), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (0), perch3_pages (0), perch3_resource_log (0), perch3_resource_tags (0), perch3_resources (0), perch3_resources_to_tags (0), perch3_settings (28), perch3_shop_addresses (0), perch3_shop_admin_index (30), perch3_shop_brands (1), perch3_shop_cart (1), perch3_shop_cart_data (2), perch3_shop_cart_items (1), perch3_shop_countries (250), perch3_shop_currencies (152), perch3_shop_customers (0), perch3_shop_emails (1), perch3_shop_index (41), perch3_shop_option_values (0), perch3_shop_options (0), perch3_shop_order_items (0), perch3_shop_order_promotions (0), perch3_shop_order_statuses (9), perch3_shop_orders (0), perch3_shop_orders_meta (1), perch3_shop_product_files (0), perch3_shop_product_option_values (0), perch3_shop_product_options (0), perch3_shop_product_tags (0), perch3_shop_products (1), perch3_shop_promotions (0), perch3_shop_sales (0), perch3_shop_search (1), perch3_shop_shipping_zone_countries (1), perch3_shop_shipping_zones (1), perch3_shop_shippings (1), perch3_shop_tax_exhibits (0), perch3_shop_tax_group_rates (1), perch3_shop_tax_groups (1), perch3_shop_tax_locations (1), perch3_shop_tax_rates (1), perch3_shop_variants (0), perch3_user_passwords (0), perch3_user_privileges (66), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1) Users: 1 App runtimes: <?php $apps_list = [ 'perch_members', 'perch_shop' ]; Editor plug-ins: H1: a5bf3ddd62d608aa3bb52d84da52427a L1: 92ace06c853b7486a62a2e2d600d6ee5 F1: 3b606135b33e6a102526838f4152a807 headerColour: #ffffff content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 0 content_collapseList: 1 lang: en-gb installedAt: 3.1.2 update_3.1.2: done latest_version: on_sale_version: perch_shop_update: 1.2.6 headerScheme: light perch_members_login_page: /members/login.php?r={returnURL} perch_shop_price_tax_mode: inc perch_shop_site_url: http://www.the133.co.uk perch_shop_product_url: /shop/products/{slug} perch_shop_default_currency: 47 perch_shop_reporting_currency: 47 perch_shop_invoice_number_format: Invoice%d dashboard: 0 sidebar_back_link: 0 hide_pwd_reset: 0 keyboardShortcuts: 0 content_hideNonEditableRegions: 0 content_frontend_edit: 0 content_skip_region_list: 0 assets_restrict_buckets: 0 PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: pay113 PERCH_DB_SERVER: 213.171.200.99 PERCH_DB_DATABASE: 113Pay PERCH_DB_PREFIX: perch3_ PERCH_TZ: UTC PERCH_EMAIL_FROM: jade@picseli.co.uk PERCH_EMAIL_FROM_NAME: Jade Marling PERCH_LOGINPATH: /menu/admin PERCH_PATH: /home/domains/vol2/539/2073539/user/htdocs/menu/admin PERCH_CORE: /home/domains/vol2/539/2073539/user/htdocs/menu/admin/core PERCH_RESFILEPATH: /home/domains/vol2/539/2073539/user/htdocs/menu/admin/resources PERCH_RESPATH: /menu/admin/resources PERCH_HTML5: 1 PERCH_RUNWAY: PERCH_ERROR_MODE: DIE PERCH_DATE_LONG: %d %B %Y PERCH_DATE_SHORT: %d %b %Y PERCH_TIME_SHORT: %H:%M PERCH_TIME_LONG: %H:%M:%S PERCH_RUNWAY_ROUTED: PERCH_STRONG_PASSWORDS: PERCH_ASSET_VERSION: 6738d5d5f5664f7c5e34 PERCH_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /home/domains/vol2/539/2073539/user/htdocs/menu/admin/templates PERCH_TEMPLATE_FILTERS: PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_XHTML_MARKUP: PERCH_RWD: 1 PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_PARANOID: PERCH_FORCE_SECURE_COOKIES: PERCH_DEFAULT_BUCKET: default PERCH_TRANSLATION_ASSIST: PERCH_PASSWORD_MIN_LENGTH: 6 PERCH_MAX_FAILED_LOGINS: 10 PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR PERCH_VERIFY_UPLOADS: PERCH_PRIV_ASSIST: PERCH_CUSTOM_EDITOR_CONFIGS: PERCH_ENABLE_EXIF: 1 PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: PERCH_SHOP_VERSION: 1.2.6 PERCH_APPS_EDITOR_PLUGIN: markitup PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown Hosting settings PHP: 7.0.32 Zend: 3.0.0 OS: Linux SAPI: cgi-fcgi Safe mode: not detected MySQL client: 5.5.60-MariaDB MySQL server: 5.6.42-log Free disk space: 181.82 TB Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bz2, calendar, ctype, curl, hash, fileinfo, filter, ftp, gettext, gmp, SPL, iconv, intl, pcntl, session, standard, posix, readline, Reflection, Phar, shmop, SimpleXML, sockets, mbstring, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, cgi-fcgi, bcmath, dba, dom, gd, imap, json, ldap, exif, mcrypt, memcached, mysqli, odbc, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, pspell, snmp, soap, tidy, xmlreader, xmlrpc, xmlwriter, xsl, zip, ionCube Loader, Zend OPcache GD: Yes ImageMagick: No PHP max upload size: 20M PHP max form post size: 20M PHP memory limit: 128M Total max uploadable file size: 20M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: Yes PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin PWD: /var/www/fcgi PHP_FCGI_MAX_REQUESTS: 100 ORIG_SCRIPT_NAME: /fcgi-bin/php70-cgi ORIG_PATH_TRANSLATED: /home/domains/vol2/539/2073539/user/htdocs/menu/admin/core/settings/diagnostics/index.php ORIG_PATH_INFO: /menu/admin/core/settings/diagnostics/index.php ORIG_SCRIPT_FILENAME: /var/www/fcgi/php70-cgi SCRIPT_NAME: /menu/admin/core/settings/diagnostics/index.php REQUEST_URI: /menu/admin/core/settings/diagnostics/?extended QUERY_STRING: extended REQUEST_METHOD: GET SERVER_PROTOCOL: HTTP/1.0 GATEWAY_INTERFACE: CGI/1.1 REDIRECT_URL: /menu/admin/core/settings/diagnostics/index.php REDIRECT_QUERY_STRING: extended REMOTE_PORT: 6361 SCRIPT_FILENAME: /home/domains/vol2/539/2073539/user/htdocs/menu/admin/core/settings/diagnostics/index.php SERVER_ADMIN: admin@the113.co.uk CONTEXT_DOCUMENT_ROOT: /var/www/fcgi/ CONTEXT_PREFIX: /fcgi-bin/ REQUEST_SCHEME: http DOCUMENT_ROOT: /home/domains/vol2/539/2073539/user/htdocs REMOTE_ADDR: 91.103.188.194 SERVER_PORT: 80 SERVER_ADDR: 10.10.110.15 SERVER_NAME: the113.co.uk SERVER_SOFTWARE: Apache HTTP_CACHE_CONTROL: no-cache HTTP_PRAGMA: no-cache HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_COOKIE: PHPSESSID=kirnfh58a1olmatr166c07rd11; cmsa=1 HTTP_REFERER: http://the113.co.uk/menu/admin/core/settings/diagnostics/ HTTP_ACCEPT_ENCODING: gzip, deflate HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.5 HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0 HTTP_CONNECTION: close HTTP_X_URL_SCHEME: http HTTP_X_FORWARDED_PROTO: http HTTP_X_REAL_IP: 91.103.188.194 HTTP_X_FORWARDED_HOST: the113.co.uk HTTP_HOST: the113.co.uk UNIQUE_ID: W9Hpf-Fc5g2hs-HjRtX7cgAAAAg REDIRECT_STATUS: 200 REDIRECT_HANDLER: application/x-httpd-php70 REDIRECT_UNIQUE_ID: W9Hpf-Fc5g2hs-HjRtX7cgAAAAg FCGI_ROLE: RESPONDER PHP_SELF: /menu/admin/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1540483455.4947 REQUEST_TIME: 1540483455
Jade Marling

Jade Marling 0 points

  • 3 weeks ago
Robert Ketter

Robert Ketter 99 points
Registered Developer

Can you show your template/code being used to redirect to PayPal. Is this site online where we can actually see the problem in action?

Hi Robert, Sorry for the delay in reply. I ended up having to use an alternative solution as I only had a few hours to complete the whole project. Although I am still experiencing this problem on a different site. Any assistance would be grately appreciated

<?php include('admin/runtime.php');?>


<!DOCTYPE html>
<html dir="ltr" lang="en-gb">




    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="SA1 Creative" />
    <title><?php $my_var = perch_pages_title(true);
    echo $my_var; ?></title>

    <?php
    $domain        = 'http://'.$_SERVER["HTTP_HOST"];
    $url           = $domain.$_SERVER["REQUEST_URI"];
    $sitename      = "Briton Ferry Llansawel AFC";
    $twittername   = "@bflafc";

    PerchSystem::set_var('domain',$domain);
    PerchSystem::set_var('url',$url);
    PerchSystem::set_var('twittername',$twittername);

    perch_page_attributes(array(        
      'template' => 'default.html'    
    ));
    ?>
    <!-- Favicon -->
    <link rel="icon" href="img/favicon.png" sizes="32x32" />
    <link rel="icon" href="img/favicon.png" sizes="192x192" />
    <link rel="apple-touch-icon-precomposed" href="img/favicon.png" />
    <meta name="msapplication-TileImage" content="img/favicon.png" />
    <!-- Mobile Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- Vendor CSS -->
    <link href="css/vendors.css" rel="stylesheet">
    <!-- Theme CSS -->
    <link href="css/style.css" rel="stylesheet">
    <!-- Theme Custom CSS -->
    <link rel="stylesheet" href="css/custom.css">
    <!-- Web Fonts  -->
    <script>
        WebFontConfig = {
            google: {
                families: ['Montserrat:300,400,500,600,700']
            },
            active: function() {
                $(window).trigger('webfontLoaded');
            }
        };

        (function(d) {
            var wf = d.createElement('script'),
                s = d.scripts[0];
            wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
            wf.async = true;
            s.parentNode.insertBefore(wf, s);
        })(document);
    </script>
<?php include_once('includes/cookies.php');?>
<?php include('includes/analyticstracking.php');?>
</head>

<body class="has-site-header-8">

    <?php include('includes/header.php');
    ?>

        <div class="site-content single-entry single-entry--template-4-alt">
            <div class="mnmd-block mnmd-block--fullwidth mnmd-block--contiguous single-header-with-bg">
                <div class="container">
                    <header class="single-header inverse-text">
                        <div class="single-header__inner">
                            <h1 class="entry-title entry-title--lg">Redirecting to PayPal..</h1>

                        </div>
                    </header>
                </div>
            </div>
    <div class="mnmd-block mnmd-block--fullwidth single-entry-wrap">
                <div class="container">
                    <div class="row">

                            <?php 
if (!perch_member_logged_in()) {
    perch_shop_registration_form([
    'template' => 'checkout/customer_create_passwordless.html'
  ]);
}
?>    <?php PerchUtil::output_debug(); ?>
                        <!-- .mnmd-main-col -->
                        <!-- .mnmd-main-col -->
                    </div>
                    <!-- .row -->
                </div>
                <!-- .container -->
            </div>
            <!-- .mnmd-block -->
        </div>
        <!-- .site-content -->

        <!-- .site-content -->
        <?php include('includes/footer.php');?>
        <?php include('includes/sticky-header.php');?>
        <?php include('includes/side-navigation.php');?>
        <a href="#" class="mnmd-go-top btn btn-default hidden-xs js-go-top-el"><i class="mdicon mdicon-arrow_upward"></i></a>
    </div>
    <!-- .site-wrapper -->
    <!-- Vendor -->
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/vendors.js"></script>
    <!-- Theme Scripts -->
    <script type="text/javascript" src="js/scripts.js"></script>
    <!-- Theme Custom Scripts -->
    <script src="js/custom.js"></script>
</body>

</html>

This is standard code that I've used on shops in the past, and it's worked successfully so I don't understand why it's not now?

Hi Jade

You need to be a bit more specific with errors as you haven’t described what’s happening at all.

Did it work when you tested the code on a dev / staging server?

Hi Jonathan,

No it didn't work in the test environment.

Basically what is happening is that the user logs into an account and the it is taken off to the screen where it is supposed to be redirected to Paypal. However, instead of redirecting to paypal, it is stuck onthat page and is not redirecting. I've followed the steps to make the payment gateway, except it's not working? I don't know if I've set something up worng, but I've followed the same procedure as always so it should work?

Thank you for your help, it's much appreciated

Hi

Ideally you'd need to share the page template you are using for checkout and for the return page. The template you've shared doesn't have any checkout functions in it. I think your code is calling the password-less registration form. I haven't used this method myself so can't comment on that setup.

I would have thought though that even without a registration form this is the step before checking out. Paypal will need user details in order to make a payment.

Just to check, you've got exactly the same functionality working on another Shop site using Paypal Express?

Other things to check:

– You're using Paypal Express

– You've generated a new API in Sandbox in Paypal

– You're using the checkout function on your checkout page

  perch_shop_checkout('paypal-express', [
    'return_url' => "blah',
    'cancel_url' => blah',
  ]);

– You're using perch_shop_complete_payment('paypal-express'); on the landing page.

Jon

Thanks Jonathan, I was missing the perch_shop_complete_payment('paypal-express');