Results 1 to 10 of 800

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,527
    Plugin Contributions
    127

    Default Re: Square WebPay support thread.

    > PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE" in .../store/includes/modules/payment/square_webPay.php:106

    Right above line 105 add

    if (null === $this->sort_order) return;
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: Square WebPay support thread.

    Quote Originally Posted by dbltoe View Post
    I don't know if the same is true for your admin but, with the errors found on your home page, you may find that basic errors are creating problems for you.
    ...
    Fixing basic CSS and HTML errors might make things run smoother
    noting that none of these fixes has absolutely anything to do with problem being reported. nor anything to do with square_webPay.

    please do NOT hijack this thread.

    Quote Originally Posted by swguy View Post
    > PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE" in .../store/includes/modules/payment/square_webPay.php:106

    Right above line 105 add

    if (null === $this->sort_order) return;
    @swguy, i am NOT a fan of this solution for so many reasons. lets start with this:

    https://www.php-fig.org/psr/psr-12/#51-if-elseif-else

    and then continue with what happens in the admin with the affiliate link? as well as other details?

    i will post some new code shortly.

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,527
    Plugin Contributions
    127

    Default Re: Square WebPay support thread.

    This is the standard mechanism that modules use to avoid logs from undefined variables in recent versions of PHP. Compare any other payment module and you'll see this pattern.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: Square WebPay support thread.

    Quote Originally Posted by swguy View Post
    This is the standard mechanism that modules use to avoid logs from undefined variables in recent versions of PHP. Compare any other payment module and you'll see this pattern.
    i have no idea what standard mechanism means. and just because it was done that way does not make it right.

    i would suggest spending more time testing prior to posting code. your early return completely changes how square is presented to the store owner prior to install. and either we want our code to conform to PSR or we do not. i prefer my code to conform to said standards as i am a fan of the PHP Standards Recommendation (PSR).

    back to the problem at hand; here is the fix for said code. changes start at line 105.

    PHP Code:
    // from:

                
    $environment Environment::PRODUCTION;
                if (
    MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE === 'Sandbox') {
                    
    $environment Environment::SANDBOX;
                }

                
    $this->client = new SquareClient([
                    
    'accessToken' => MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN,
                    
    'environment' => $environment,
                ]);

    // to:
                
    $environment Environment::PRODUCTION;
                if (
    defined('MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE') && MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE === 'Sandbox') {
                    
    $environment Environment::SANDBOX;
                }

                
    $this->token'';
                if (
    defined('MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN')) {
                    
    $this->token MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN;
                }

                
    $this->client = new SquareClient([
                    
    'accessToken' => $this->token,
                    
    'environment' => $environment,
                ]); 
    @WayneStephens please let me know if that works for you.

    also, noting that these errors exist and are logged in php 7.4; in php 8.0, they are now fatal errors.

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Aug 2009
    Posts
    48
    Plugin Contributions
    0

    Default Re: Square WebPay support thread.

    Quote Originally Posted by carlwhat View Post
    @WayneStephens please let me know if that works for you.
    That fixed it, thanks! And no other errors coming up so far while testing.
    20th Century Glass - Antique & Collectable Glass Store

  6. #6
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: Square WebPay support thread.

    Quote Originally Posted by WayneStephens View Post
    That fixed it, thanks! And no other errors coming up so far while testing.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  7. #7
    Join Date
    Jun 2009
    Location
    Sparta, TN
    Posts
    158
    Plugin Contributions
    0

    Default Re: Square WebPay support thread.

    carlwhat - I'm getting Square Alert error:

    Code:
    Jun-18-2022 02:53:15
    =================================
    
    Error Dump: [ACCESS_TOKEN_EXPIRED]: The provided OAuth access token has expired. You must renew the access token via the Renew Access Token endpoint.
    
    Sent to Square: SquareModelsCreatePaymentRequest Object
    (
        [sourceId:SquareModelsCreatePaymentRequest:private] => cnon:LETTERNUMBERCODE
        [idempotencyKey:SquareModelsCreatePaymentRequest:private] => LETTERNUMBERCODE
        [amountMoney:SquareModelsCreatePaymentRequest:private] => SquareModelsMoney Object
            (
                [amount:SquareModelsMoney:private] => ####
                [currency:SquareModelsMoney:private] => USD
            )
    
        [tipMoney:SquareModelsCreatePaymentRequest:private] => 
        [appFeeMoney:SquareModelsCreatePaymentRequest:private] => 
        [delayDuration:SquareModelsCreatePaymentRequest:private] => 
        [autocomplete:SquareModelsCreatePaymentRequest:private] => 
        [orderId:SquareModelsCreatePaymentRequest:private] => 
        [customerId:SquareModelsCreatePaymentRequest:private] => 
        [locationId:SquareModelsCreatePaymentRequest:private] => LV7VYYRF6PYHC
        [teamMemberId:SquareModelsCreatePaymentRequest:private] => 
        [referenceId:SquareModelsCreatePaymentRequest:private] => 
        [verificationToken:SquareModelsCreatePaymentRequest:private] => verf:LETTERNUMBERCODE
        [acceptPartialAuthorization:SquareModelsCreatePaymentRequest:private] => 
        [buyerEmailAddress:SquareModelsCreatePaymentRequest:private] => EMAIL######################
        [billingAddress:SquareModelsCreatePaymentRequest:private] => SquareModelsAddress Object
            (
                [addressLine1:SquareModelsAddress:private] => 
                [addressLine2:SquareModelsAddress:private] => 
                [addressLine3:SquareModelsAddress:private] => 
                [locality:SquareModelsAddress:private] => 
                [sublocality:SquareModelsAddress:private] => 
                [administrativeDistrictLevel1:SquareModelsAddress:private] => 
                [postalCode:SquareModelsAddress:private] => 
                [country:SquareModelsAddress:private] => 
            )
    
        [shippingAddress:SquareModelsCreatePaymentRequest:private] => SquareModelsAddress Object
            (
                [addressLine1:SquareModelsAddress:private] => 
                [addressLine2:SquareModelsAddress:private] => 
                [addressLine3:SquareModelsAddress:private] => 
                [locality:SquareModelsAddress:private] => 
                [sublocality:SquareModelsAddress:private] => 
                [administrativeDistrictLevel1:SquareModelsAddress:private] => 
                [postalCode:SquareModelsAddress:private] => 
                [country:SquareModelsAddress:private] => 
            )
    
        [note:SquareModelsCreatePaymentRequest:private] => CUSTOMER_ORDER_INFORMATION Vinyl Decal Superstore
        [statementDescriptionIdentifier:SquareModelsCreatePaymentRequest:private] => 
        [cashDetails:SquareModelsCreatePaymentRequest:private] => 
        [externalDetails:SquareModelsCreatePaymentRequest:private] => 
    )
    Also a debug log:

    Code:
    [18-Jun-2022 15:00:30 America/Chicago] Request URI: /VDSstore/ADMINFOLDER/index.php?cmd=modules&set=payment&module=square_webPay&action=edit, IP address: 152.97.210.26
    #1 square_webPay->getLocationsPulldownArray() called at [/includes/modules/payment/square_webPay.php:1405]
    #2 zen_cfg_pull_down_squareWebPay_locations() called at [/ADMINFOLDER/modules.php(335) : eval()'d code:1]
    #3 eval() called at [/ADMINFOLDER/modules.php:335]
    #4 require(/ADMINFOLDER/modules.php) called at [/ADMINFOLDER/index.php:11]
    --> PHP Warning: Invalid argument supplied for foreach() in /includes/modules/payment/square_webPay.php on line 794.
    From our correspondence "the squareWebPay_handler.php renews the token". For some reason, my file is not renewing the token.

    I've gone to my square account and "replaced" the token manually. Is there more I need to do for this to work next time?

    Thank you.
    My store - closed 12/05/2023
    1.5.7d (upgraded from 1.5.7b), clone a template (cloned Responsive Classic Template), Sitemap XML v4.0, Square WebPay, PayPal Express Checkout, PHP Version: 7.4.29 (Zend: 3.4.0)

 

 

Similar Threads

  1. Square Payment Module for Zen Cart [Support Thread]
    By DrByte in forum Addon Payment Modules
    Replies: 820
    Last Post: 16 May 2026, 01:07 AM
  2. Hebrew Support - latest release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 22
    Last Post: 26 Jan 2026, 06:47 AM
  3. Square Support for SqPaymentForm ending 15th July 2022
    By brittainmark in forum Addon Payment Modules
    Replies: 1
    Last Post: 9 Apr 2022, 02:40 PM
  4. v156 Square Payments and strange request from Square
    By ianhg in forum General Questions
    Replies: 4
    Last Post: 14 Nov 2020, 11:14 AM
  5. v156 PWA, Offline support Push notifications addon [Support Thread]
    By perfumbg in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 23 May 2019, 02:27 PM

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