Page 23 of 75 FirstFirst ... 1321222324253373 ... LastLast
Results 221 to 230 of 750
  1. #221
    Join Date
    Jul 2013
    Location
    Brisbane, Australia
    Posts
    39
    Plugin Contributions
    0

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Quote Originally Posted by DrByte View Post
    The fact that your 2nd echo does not appear means the code before it is failing with fatal errors. Your server's PHP error-logs will contain more information. Clearly something's unusual about your server config which is preventing this from operating normally.
    Thanks, Dr Byte - appreciate the advice on the way forward. I've started investigating how to access those PHP error logs. Will report back after speaking with my ISP (need their intervention to enable PHP error tracking, which is currently turned off) and when I know more. Fingers crossed.

  2. #222
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Quote Originally Posted by dbltoe View Post
    Anyone had a go with the addition of Apple Pay? https://medium.com/square-corner-blo...s-1f85cb6fe433

    It appears that the two javascript files used are combined into jscript_square.php file. My attempt at adding the required info resulted in messing up the form.

    I changed jscript_square.php to
    Code:
    <?php/**
     * Javascript to prep functionality for Square payment module
     *
     * @package square
     * @copyright Copyright 2003-2017 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: Author: Chris Brown <[email protected]> New in v1.5.6 $
     */
    if (!defined(MODULE_PAYMENT_SQUARE_STATUS) || MODULE_PAYMENT_SQUARE_STATUS != 'True' || (!defined('MODULE_PAYMENT_SQUARE_APPLICATION_ID') || MODULE_PAYMENT_SQUARE_ACCESS_TOKEN == '')) {
        return false;
    }
    ?>
    <script type="text/javascript" src="https://js.squareup.com/v2/paymentform"></script>
    
    
    
    
    <script type="text/javascript">
        var cardNonce;
        var paymentForm = new SqPaymentForm({
            //
            locationId: locationId
            //
            applicationId: '<?php echo MODULE_PAYMENT_SQUARE_APPLICATION_ID; ?>',
            inputClass: 'paymentInput',
            inputStyles: [
                {
                    fontSize: '14px',
                    padding: '7px 12px',
                    backgroundColor: "white"
                }
            ],
            cardNumber: {
                elementId: 'square_cc-number',
                placeholder: '•••• •••• •••• ••••'
            },
            cvv: {
                elementId: 'square_cc-cvv',
                placeholder: 'CVV'
            },
            expirationDate: {
                elementId: 'square_cc-expires',
                placeholder: 'MM/YY'
            },
            postalCode: {
                elementId: 'square_cc-postcode',
                placeholder: '11111'
            },
            callbacks: {
                cardNonceResponseReceived: function (errors, nonce, cardData) {
                    if (errors) {
                        console.error("Encountered errors:");
                        var error_html = ""
                        errors.forEach(function (error) {
                            console.error('  ' + error.message);
                            error_html += "<li> " + error.message + " </li>";
                        });
                        document.getElementById('card-errors').innerHTML = '<ul>' + error_html + '</ul>';
                        $('#paymentSubmitButton').disabled = false;
                    } else {
                        // success
                        $('#paymentSubmitButton').disabled = true;
                        $("#card-errors").empty()
                        document.getElementById('card-nonce').value = nonce;
                        document.getElementById('card-type').value = cardData.card_brand;
                        document.getElementById('card-four').value = cardData.last_4;
                        document.getElementById('card-exp').value = ('0'+cardData.exp_month.toString()).substr(-2) + cardData.exp_year.toString().substr(-2);
                        document.getElementsByName('checkout_payment')[0].submit();
                    }
    
    
                },
                unsupportedBrowserDetected: function () {
                    document.getElementById('card-errors').innerHTML = '<p class="error alert">This browser is not supported for Square Payments. Please contact us to let us know!  Meanwhile, please pay using an alternate method; or shop using a different browser such as FireFox or Chrome.</p>';
                    paymentForm.destroy();
                },
    
    
                inputEventReceived: function (inputEvent) {
                    switch (inputEvent.eventType) {
                        case 'focusClassAdded':
                            methodSelect('pmt-square');
                            break;
                        case 'cardBrandChanged':
                            document.getElementById('sq-card-brand').innerHTML = inputEvent.cardBrand;
                            break;
                    }
                },
                methodsSupported: function (methods) {
     								if (methods.applePay === true) {
     									// Show apple pay button
      								var element = document.getElementById('sq-apple-pay');
      								element.style.display = 'inline-block';
     								}
    						}
    						paymentFormLoaded: function () {
                    paymentForm.setPostalCode('<?php echo $order->billing['postcode']; ?>');
                }
            }
        });
    createPaymentRequest: function () {
        return {
            requestShippingAddress: true,
            currencyCode: "USD",
            countryCode: "US",
            total: {
                label: "{{ MERCHANT NAME }}",
                amount: "100.00",
                pending: false,
            },
            lineItems: [
                {
                    label: "Subtotal",
                    amount: "80.00",
                    pending: false,
                },
                {
                    label: "Shipping",
                    amount: "0.00",
                    pending: true,
                },
                {
                    label: "Tax",
                    amount: "10.00",
                    pending: false,
                }
            ]
        };
    };
    // ...
        $(function () {
            $.ajaxSetup({
                headers: {"X-CSRFToken": "<?php echo $_SESSION['securityToken']; ?>"}
            });
            $('form[name="checkout_payment"]').submit(function(e) {
                if($('#pmt-square').is(':checked') || this['payment'].value == 'square' || document.getElementById('pmt-square').checked == true) {
                    e.preventDefault();
                    paymentForm.requestCardNonce();
                }
            });
        });
    </script>
    <style>
    .paymentInput {display:inline;font-size:1em;margin:0 0.1em 10px 0;height:35px;padding-left:5px;width:50%;}
    .paymentInput {background-color: white;border:3px solid #ccc;}
    .paymentInput--error {color: red; border-color: red;}
    </style>
    Done this way, the form is not properly set with input blocks and preset Zip.
    Has anyone being able to figure out the Apple Pay? I've tried similar approaches as this with no good results.

  3. #223
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,018
    Plugin Contributions
    61

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Any chance we'll be getting their hosted pages checkout?
    https://squareup.com/townsquare/host...e-payment-form
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  4. #224
    Join Date
    Nov 2018
    Location
    Montreal
    Posts
    6
    Plugin Contributions
    0

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    My set-up:
    ZC 1.5.5f
    PHP 7.1.23
    mySQL 5.5.60
    Template: BusinessSet_res Black for ZC 1.5.5
    Plugins: Sales report 3.2.0, Group price per item 155, InstantSearch 1.0.2, CEON URI Mapping 4.5.5 and Optional payment method 1.2

    We are running a web store from Canada. We have our default currency set to USD and allow customers to check out in USD, CAD and Euro. Works great with PayPal and payments go into the same respective currency in PayPal.

    Since we where doing upgrades we decided to add Square Payments. Our Square account is in CAD (this is Square's rule - since our business is located in Canada). The installation went smoothly, Square payments show up at checkout, all looks good.

    When we checkout using Square and the order total is in USD the amount captured by Square is correct (as seen both in the Square dashboard and on the Admin Orders details page). That is, the order total in USD times the exchange rate into CAD. Eg. rate is 1:1.3, sale for a $1.00 USD order gets captured by Square as $1.30 CAD.

    Problem: But if the checkout is done in CAD the amount captured by Square is wrong. It only captures the value amount in USD but in CAD. Eg. customers checks out with a product priced in the admin at $1.00 USD but they have their log in currency set to CAD, so they see it as $1.30 CAD, OK so far. At check out, Square then captures the sale as $1.00 CAD. Essentially shorting us by 30% (the current exchange rate) rather then just capturing the $1.30 CAD displayed to the customer and matching the currency used by Square. Afterwords, when logged in as a customers (or admin side) the order details, amounts and currencies display correctly, just not the amount captured by Square (as seen both in the Square dashboard and on the Admin Orders details page).

    There is one warning created in the log file: Illegal string offset 'id' in /homepage/.…./Store/includes/modules/payments/square.php on line 143

    Update: For a test I installed a fresh 1.5.5f with only Square Payment 0.94 and a fresh database with only example products no other plug-in or mods and I get the same results (but without the log warning).

    Any ideas?

  5. #225
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Quote Originally Posted by mprough View Post
    Any chance we'll be getting their hosted pages checkout?
    https://squareup.com/townsquare/host...e-payment-form
    Undecided. What's the business reason behind the request? (it helps for understanding the scope)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #226
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Quote Originally Posted by Spikenzie View Post
    We are running a web store from Canada. We have our default currency set to USD ...

    Our Square account is in CAD (this is Square's rule - since our business is located in Canada).
    Right now the module can handle currency conversions based on when the Square account's currency is different from the customer's checkout currency.

    But it doesn't also consider that your store's "default" currency (upon which all your pricing is based) is different from the Square account's currency.

    I'll try to work out that logic this week and post back. Hmmmm....
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #227
    Join Date
    Nov 2018
    Location
    Montreal
    Posts
    6
    Plugin Contributions
    0

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Thanks DrByte, that would be great.

    An update on the log file warning,

    There is one warning created in the log file: Illegal string offset 'id' in /homepage/.…./Store/includes/modules/payments/square.php on line 143
    This was because I had the Square Payments Payment Zone set to Canada but in my Zone Definitions for Canada I had no sub-zones (provinces) set.

  8. #228
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Quote Originally Posted by Spikenzie View Post
    We are running a web store from Canada. We have our default currency set to USD ...

    Our Square account is in CAD (this is Square's rule - since our business is located in Canada).
    I'm between afternoon events right now so have limited time to test, but I'm wondering if making the following edit may solve the issue for you?

    Line 274 of /includes/modules/payments/square.php
    change:
    if ($order->info['currency'] != $location->currency) {
    to
    if ($order->info['currency'] != $location->currency || $order->info['currency'] != DEFAULT_CURRENCY) {

    Does that sort it out for all the combinations you posted about?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #229
    Join Date
    Nov 2018
    Location
    Montreal
    Posts
    6
    Plugin Contributions
    0

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Yes, all the captured amounts are now correct. Yay, thanks!

    A side effect of this change that I noticed, but is no a big deal, on the admin side (and the note sent to Square) all transactions now say "Converted from: n.nn CAD" or "Converted from: n.nn USD" even when no conversion "math" is required (eg. CAD -> CAD).

  10. #230
    Join Date
    Nov 2018
    Location
    Montreal
    Posts
    6
    Plugin Contributions
    0

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    My mistake, log files warnings are still being generated but not when the sale transaction happens but rather when an order is opened "edited" in the admin side.

    If an order is opened to look at and then you navigate elsewhere one error log file is created (action=edit). If you open an order update it status then three error log files are created (one with action=edit, then action=update_order and finally another action=edit).

    Here are the two types of log warnings in full;

    [18-Nov-2018 22:13:36 America/New_York] Request URI: /testadmin/orders.php?page=1&oID=8&action=edit, IP address: xxx.xxx.xxx.xxx
    #1 square->update_status() called at [/yadayada/myTestSite/includes/modules/payment/square.php:130]
    #2 square->__construct() called at [/yadayada/myTestSite/testadmin/orders.php:441]

    [18-Nov-2018 22:13:36 America/New_York] PHP Warning: Illegal string offset 'id' in /yadayada/myTestSite/includes/modules/payment/square.php on line 143
    and
    [18-Nov-2018 22:13:36 America/New_York] Request URI: /testadmin/orders.php?page=1&oID=8&action=update_order, IP address: xxx.xxx.xxx.xxx
    #1 square->update_status() called at [/yadayada/myTestSite/includes/modules/payment/square.php:130]
    #2 square->__construct() called at [/yadayada/myTestSite/testadmin/orders.php:194]

    [18-Nov-2018 22:13:36 America/New_York] PHP Warning: Illegal string offset 'id' in /yadayada/myTestSite/includes/modules/payment/square.php on line 143
    Everything seems to be working, but at this rate the logs folder will get pretty full.

    Any ideas on how to tame the warnings?

 

 
Page 23 of 75 FirstFirst ... 1321222324253373 ... LastLast

Similar Threads

  1. Bambora/Beanstream Payment Module Support Thread
    By swguy in forum Addon Payment Modules
    Replies: 127
    Last Post: 26 Mar 2021, 04:13 PM
  2. v154 Support Thread: AddToAny for Zen Cart (The Universal Sharing Platform)
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 8 Apr 2019, 02:39 PM
  3. WordPress® for Zen Cart® (wp4zen) [Support Thread]
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 107
    Last Post: 13 Jan 2019, 12:32 PM
  4. Layaway Payment Module Support Thread
    By Danielle in forum Addon Payment Modules
    Replies: 0
    Last Post: 21 Nov 2006, 06:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR