-
Re: Square Payment Module for Zen Cart [Support Thread]
Ya, it's the same issue. Notice how there's no "break" between fields in the AIM module, just like in the Square module?
It's a typical Template-Monster deficiency to be missing correct styling for features they didn't implement/test in their demo (payment modules are often left out).
You'll need to do a bit of CSS styling to tweak things for your template.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Where would i start to fix this? And what would i do?
Thanks
-
Re: Square Payment Module for Zen Cart [Support Thread]
I am using Zen 1.5.4
I can not get rid of the Square (Access Token needed)
I followed all the suggestions. Can anyone take a look?
Got these errors
ERROR: module not loaded due to missing language file: /home/cps/public_html/catalog/includes/languages/english/modules/payment/ZenCartChargeRequest.php
ERROR: module not loaded due to missing language file: /home/cps/public_html/catalog/includes/languages/english/modules/payment/square_admin_notification.php
Those 2 files aren't in the download
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
JoeH
Got these errors
ERROR: module not loaded due to missing language file: /home/cps/public_html/catalog/includes/languages/english/modules/payment/ZenCartChargeRequest.php
ERROR: module not loaded due to missing language file: /home/cps/public_html/catalog/includes/languages/english/modules/payment/square_admin_notification.php
Those 2 files aren't in the download
These two files should actually be located in \includes\modules\payment\square_support and they are not language files, I'm not sure why you're getting missing language file errors for them.
You don't say which version of ZC you are using but if you installed this mod yourself (before it was included in the stock ZC) or upgraded recently you might want to check you have files in the correct locations.
edit: saw your earlier post re ZC version, so you probably did install it yourself. Checking you have the correct file locations might also help with that post.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
simon1066
These two files should actually be located in \includes\modules\payment\square_support and they are not language files.
Correct.
Quote:
Originally Posted by
simon1066
I'm not sure why you're getting missing language file errors for them.
The error is because ZC attempts to automatically load a language file for all files in the modules directory. So putting files in the modules directory will cause this problem if the files don't belong there.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
DrByte
Correct.
The error is because ZC attempts to automatically load a language file for all files in the modules directory
I did not know that, thank you for the explanation.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Thanks
So what do I need to do to fix it? All files are in the right place
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
JoeH
Thanks
So what do I need to do to fix it? All files are in the right place
Um, if you're still getting the error messages you quoted, then no the files are not in the right place. Or else they're also in places where they don't belong.
-
Re: Square Payment Module for Zen Cart [Support Thread]
I went through each file one at a time. Please how do I find it?
-
Re: Square Payment Module for Zen Cart [Support Thread]
If your errors are the following:
Quote:
Originally Posted by
JoeH
ERROR: module not loaded due to missing language file: /home/cps/public_html/catalog/includes/languages/english/modules/payment/ZenCartChargeRequest.php
ERROR: module not loaded due to missing language file: /home/cps/public_html/catalog/includes/languages/english/modules/payment/square_admin_notification.php
... then you need to delete the following files, because they should have been placed in another subdirectory:
/home/cps/public_html/catalog/includes/modules/payment/ZenCartChargeRequest.php
/home/cps/public_html/catalog/includes/modules/payment/square_admin_notification.php
-
Re: Square Payment Module for Zen Cart [Support Thread]
Thanks!
Got rid of those and the error message is gone. But the accesse token error is still there
I really do appreciate your help
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
DrByte
To get descriptive output for debugging, you can TEMPORARILY edit square_handler.php and change line 11, which says:
and change false to true.
NOTE that this may prevent normal transactions from operating properly until you put it back to false.
With $verbose=true, it will give output with one of:
not configured = module doesn't have an Application ID set
failure = token expired more than 15 days ago, or no token available to refresh
refreshed = the job refreshed the token
not refreshed = a refresh was attempted, but did not complete properly
not expired = a token exists but it is younger than 3 weeks old, so no need to refresh
Thanks for that info and your other replies, Dr Byte. Apologies for my delayed reply: I've been away.
Changing line 11 unfortunately resulted no output produced (i.e. no error log or email received).
So I experimented further. By adding simple echo requests at different points in the square_handler.php file I found that it did produce output - but only when added BEFORE the 2 'require....' statements at lines 12 & 13 (i.e. I gather output was produced in the header). After that point, no output was produced.
To be clear, my amended code from line 11:
Quote:
$verbose = true; //GM Changed from false for testing
echo $verbose . ' ' . $mode . ' ' . '- results when echo placed BEFORE require statements'; //GM Line added for testing
require 'includes/application_top.php';
require DIR_WS_CLASSES . 'payment.php';
echo $verbose . ' ' . $mode . ' ' . '- results when echo placed after require statements'; //GM Line added for testing
produced this output in the email and no error log:
Quote:
1 cli - results when echo placed BEFORE require statements
Despite more experimenting, I couldn't work out why output didn't include the messages you cited nor the later echo statements - and more importantly, whether this meant the cron job did not successfully complete its task to refresh the token. Any ideas? Thanks.
-
1 Attachment(s)
Re: Square Payment Module for Zen Cart [Support Thread]
Anyone know this is for UK banks, cant find the RBS Routing number?
Attachment 18066
-
Re: Square Payment Module for Zen Cart [Support Thread]
Getting this error when testing the module
"YOUR TRANSACTION COULD NOT BE COMPLETED DUE TO A MISCONFIGURATION IN OUR STORE. PLEASE REPORT THIS ERROR TO THE STORE OWNER: SQ-MISCONF"
Any idea why?
-
Re: Square Payment Module for Zen Cart [Support Thread]
I got rid of the error messages in admin. But when I test it by trying to buy something I get this:
Error We could not initiate your transaction because of a problem with the card data you entered. Please correct the card data, or report this error to the Store Owner: SQ-NONCE-FAILURE
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
JoeH
I got rid of the error messages in admin. But when I test it by trying to buy something I get this:
Error We could not initiate your transaction because of a problem with the card data you entered. Please correct the card data, or report this error to the Store Owner: SQ-NONCE-FAILURE
SQ-NONCE-FAILURE appears when the javascript code in your template has errors and is preventing the javascript for the module from executing properly.
This is often caused by other plugins that are using outdated javascript or old versions of jQuery. It can also happen if you're using a template designed for an older version of Zen Cart and therefore have an old jscript_framework.php file in your template's jscript folder.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
JakeLawless
Anyone know this is for UK banks, cant find the RBS Routing number?
Attachment 18066
Best to ask your Bank, or contact Square Support for help in filling in banking details inside your Square account.
Quote:
Originally Posted by
JakeLawless
Getting this error when testing the module
"YOUR TRANSACTION COULD NOT BE COMPLETED DUE TO A MISCONFIGURATION IN OUR STORE. PLEASE REPORT THIS ERROR TO THE STORE OWNER: SQ-MISCONF"
Any idea why?
SQ-MISCONF appears when your attempted transaction triggers the "INVALID_REQUEST_ERROR" response from Square's servers.
There are two steps to take for sorting this out:
1. Look at the debug log that was generated in your server's /logs folder, as it will contain more details about the complete communication between your server and Square.
2. Contact Square Support and tell them the information in the log file from #1 above. Their servers will contain all your transaction attempt history and their techs will be able to explain what's gone wrong with your specific transaction attempts.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
GerriM
Quote:
Originally Posted by
DrByte
To get descriptive output for debugging, you can TEMPORARILY edit square_handler.php and change line 11, which says:
and change false to true.
NOTE that this may prevent normal transactions from operating properly until you put it back to false.
With $verbose=true, it will give output with one of:
not configured = module doesn't have an Application ID set
failure = token expired more than 15 days ago, or no token available to refresh
refreshed = the job refreshed the token
not refreshed = a refresh was attempted, but did not complete properly
not expired = a token exists but it is younger than 3 weeks old, so no need to refresh
Thanks for that info and your other replies, Dr Byte. Apologies for my delayed reply: I've been away.
Changing line 11 unfortunately resulted no output produced (i.e. no error log or email received).
So I experimented further. By adding simple echo requests at different points in the square_handler.php file I found that it
did produce output - but only when added BEFORE the 2 'require....' statements at lines 12 & 13 (i.e. I gather output was produced in the header). After that point, no output was produced.
To be clear, my amended code from line 11:
Quote:
$verbose = true; //GM Changed from false for testing
echo $verbose . ' ' . $mode . ' ' . '- results when echo placed BEFORE require statements'; //GM Line added for testing
require 'includes/application_top.php';
require DIR_WS_CLASSES . 'payment.php';
echo $verbose . ' ' . $mode . ' ' . '- results when echo placed after require statements'; //GM Line added for testing
produced this output in the email and no error log:
Quote:
1 cli - results when echo placed BEFORE require statements
Despite more experimenting, I couldn't work out why output didn't include the messages you cited nor the later echo statements - and more importantly, whether this meant the cron job did not successfully complete its task to refresh the token. Any ideas? Thanks.
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.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
DrByte
SQ-NONCE-FAILURE appears when the javascript code in your template has errors and is preventing the javascript for the module from executing properly.
This is often caused by other plugins that are using outdated javascript or old versions of jQuery. It can also happen if you're using a template designed for an older version of Zen Cart and therefore have an old jscript_framework.php file in your template's jscript folder.
Thanks!
But how do I find out how to fix it?
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
JoeH
Quote:
Originally Posted by
DrByte
SQ-NONCE-FAILURE appears when the javascript code in your template has errors and is preventing the javascript for the module from executing properly.
This is often caused by other plugins that are using outdated javascript or old versions of jQuery. It can also happen if you're using a template designed for an older version of Zen Cart and therefore have an old jscript_framework.php file in your template's jscript folder.
Thanks!
But how do I find out how to fix it?
Ya, that's the challenging part. Teaching someone javascript-debugging is hard to do in a single post! Can't really do that here. There are a dozen discussions of the same issue earlier in this thread, all with varying examples of the same situation as yours. So I'd start there.
Additionally, you can use your browser's "console log" to inspect the actual javascript errors that are occurring when the checkout_payment page is being loaded, and when the submit button is clicked. Using the information reported there can help you understand what javascript conflicts might exist and need fixing.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
DrByte
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.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
dbltoe
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. :( :no:
-
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
-
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?
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
mprough
Undecided. What's the business reason behind the request? (it helps for understanding the scope)
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
Spikenzie
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....
-
Re: Square Payment Module for Zen Cart [Support Thread]
Thanks DrByte, that would be great.
An update on the log file warning,
Quote:
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.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
Spikenzie
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?
-
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).
-
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;
Quote:
[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
Quote:
[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?
-
Re: Square Payment Module for Zen Cart [Support Thread]
To get rid of that 'id' error, a temporary fix is this ...
In that file, on line 140 you'll see the first line below. Add the second line:
Code:
if (!isset($order->billing['country'])) return;
if (!isset($order->billing['country']['id'])) return;
I may use a different approach in the future, but for now that should suffice.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
Spikenzie
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).
Okay, looking again around line 274, let's test one more change, to get rid of the CAD->CAD message.
Add the extra condition, as shown, including the { } braces:
Code:
// force conversion to Square Account's currency:
if ($order->info['currency'] != $location->currency || $order->info['currency'] != DEFAULT_CURRENCY) {
global $currencies;
$payment_amount = round($order->info['total'] * $currencies->get_value($location->currency), 2);
$currency_code = $location->currency;
if ($order->info['currency'] != $location->currency) {
$this->currency_comment = '(Converted from: ' . round($order->info['total'] * $order->info['currency_value'], 2) . ' ' . $order->info['currency'] . ')';
}
// @TODO - if Square adds support for transmission of tax and shipping amounts, these may need recalculation here too
}
While you're at it, do you mind testing another optimization I'd like to use. Does this still give the same converted price correctly for the actual payment collected?
Code:
// force conversion to Square Account's currency:
if ($order->info['currency'] != $location->currency || $order->info['currency'] != DEFAULT_CURRENCY) {
global $currencies;
$payment_amount = $currencies->rateAdjusted($order->info['total'], true, $location->currency);
$currency_code = $location->currency;
if ($order->info['currency'] != $location->currency) {
$this->currency_comment = '(Converted from: ' . round($order->info['total'] * $order->info['currency_value'], 2) . ' ' . $order->info['currency'] . ')';
}
// @TODO - if Square adds support for transmission of tax and shipping amounts, these may need recalculation here too
}
-
Re: Square Payment Module for Zen Cart [Support Thread]
Hey DrByte, all of your suggestions worked!
Quote:
To get rid of that 'id' error, a temporary fix is this ...
No more id log warnings,
Quote:
Okay, looking again around line 274, let's test one more change, to get rid of the CAD->CAD message.
"Converted from:" text appears at correct time
and
Quote:
...do you mind testing another optimization...
the optimization you wanted me to test still calculates the correct converted amounts (or not converted amounts when that is the case) Note: my tests were under $5.00
Thanks!
-
Re: Square Payment Module for Zen Cart [Support Thread]
Great! I've posted a new v0.95 version of the module, including these fixes.
-
Re: Square Payment Module for Zen Cart [Support Thread]
All of a sudden, Square is bouncing with INVALID_ENUM_VALUE with the detail - "is not a valid enum value for 'billing_address.country' "
Is this something 0.95 might fix or do we need to come up with a country field to satisfy a new requirement.
[27-Nov-2018 17:04:48 UTC] Request URI: /index.php?main_page=checkout_process, IP address: 72.190.125.38
#1 trigger_error() called at [/home/spicdavi/public_html/includes/modules/payment/square.php:338]
#2 square->before_process() called at [/home/spicdavi/public_html/includes/classes/payment.php:245]
#3 payment->before_process() called at [/home/spicdavi/public_html/includes/modules/checkout_process.php:84]
#4 require(/home/spicdavi/public_html/includes/modules/checkout_process.php) called at [/home/spicdavi/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#5 require(/home/spicdavi/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/spicdavi/public_html/index.php:36]
[27-Nov-2018 17:04:48 UTC] PHP Notice: Square Connect [configuration] error.
Response Body:
stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[category] => INVALID_REQUEST_ERROR
Code:
=> INVALID_ENUM_VALUE
[code]
[detail] => `` is not a valid enum value for `billing_address.country`.
[field] => billing_address.country
)
)
)
Response Headers:
Array
(
[0] => HTTP/1.1 400 Bad Request
[Content-Type] => application/json
[Vary] => Origin, Accept-Encoding
[X-Content-Type-Options] => nosniff
[X-Download-Options] => noopen
[X-Frame-Options] => SAMEORIGIN
[X-Permitted-Cross-Domain-Policies] => none
[X-Xss-Protection] => 1; mode=block
[Date] => Tue, 27 Nov 2018 17:04:47 GMT
[keep-alive] => timeout=60
[Strict-Transport-Security] => max-age=631152000
[content-length] => 182
)
in /home/spicdavi/public_html/includes/modules/payment/square.php on line 338
-
Re: Square Payment Module for Zen Cart [Support Thread]
More info to the above. Both transaction attempts were American Express with Free Shipping. Both were finally successful in ordering, but neither has responded to requests for what difficulties they had when ordering.
-
1 Attachment(s)
Re: Square Payment Module for Zen Cart [Support Thread]
I have found a potential store user problem with this plug-in. It is not so much a bug but rather an issue that could cause financial problems for shop owners and unsatisfied customers.
This is the scenario, you let customers shop in multiple currencies but Square only takes payments in the currency in the country that the shop is based. We are in Canada but our store is set to a default currency of USD. If a Canadian customer checks out and their cart is set to USD their CC will be billed in CAD at about 30% more then their cart total. There is no warning from Square (or rather this plug-in) that they are going to do a currency conversion. See the potential problem?
I've been trying for a long time to create something I'm calling a clarity message that would appear at check-out, something like;
Square checkout only processes payments in (your square's currency), your order total is (your order total in some other currency), your CC will be billed (your order currency converted to your square's currency).
I had it working and nice looking from the user side; it would show the clear we will be charging your CC something else (if that was the case) or a generic "Secure check out with Square Payments" type message if no conversion was required.
I did this by using simon1066's post #126 to add an image, where he wrote:
Quote:
Here's one way to add an image:
,and the logic from DrByte's post # 232 where he wrote
Quote:
if ($order->info['currency'] != $location->currency) {
Problems where two fold, where I needed to insert the "if" logic into the code to get the payment title it caused errors on the admin side in modules payments menu and in places other than checkout the message would appear sort of like "your payment will be (nothing printed here) $."
I now have a static work around without amounts that look like this;
Attachment 18145
but, it does not appear correctly on the admin / customer orders pages or the order confirmation emailed to users. And, I don't think the message without amounts it is clear enough for some people.
Any ideas?
-
Re: Square Payment Module for Zen Cart [Support Thread]
Fresh install 155f
PHP: 7.1.24
Square Payment Module 0.95
One Page Checkout (OPC) 2.0.5
Dr. Bytes,
OPC turned on
Category set up as Document - General called Printable Brochure
Product enabled under it called Document - Product which I have the pdf & zip of the brochure to download
When clicking confirm to order when logged in to download pdf/zip the cursor just spins and does not complete the order
Also using guest check out the cursor just spin and does not complete the order
OPC turned off
I can successfully purchase the downloadable brochure pdf/zip sucessfully.
This is the error console below.
Attachment 18146
-
Re: Square Payment Module for Zen Cart [Support Thread]
Note that the jQuery issue that @haredo describes occurs when the cart contains only unpriced items, e.g. the demo product A Free Product - All (index.php?main_page=product_info&cPath=24&products_id=57), i.e. the payment method for the order is set to FreeOrder/freecharger.
This is similar in nature to the issue that was previously corrected when PayPal Express Checkout/Shortcut-Button was selected.
-
Re: Square Payment Module for Zen Cart [Support Thread]
FWIW, I was able to correct the integration issue by editing the /includes/modules/pages/checkout_payment/jscript_square.php (it's also copied to the /checkout_one/jscript_square.php for the OPC integration) and changing:
Code:
if ($payment_modules->in_special_checkout()) {
return false;
}
to
Code:
if ($payment_modules->in_special_checkout() || (isset($payment_modules->paymentClass) && $payment_modules->paymentClass->code != 'square')) {
return false;
}
The result is that Square's jQuery module doesn't load if the payment class is selected and it's not Square.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
lat9
FWIW, I was able to correct the integration issue by editing the /includes/modules/pages/checkout_payment/jscript_square.php (it's also copied to the /checkout_one/jscript_square.php for the OPC integration) and changing:
Code:
if ($payment_modules->in_special_checkout()) {
return false;
}
to
Code:
if ($payment_modules->in_special_checkout() || (isset($payment_modules->paymentClass) && $payment_modules->paymentClass->code != 'square')) {
return false;
}
The result is that Square's jQuery module doesn't load if the payment class is selected and it's not Square.
Please note, after additional thought, that's not going to work! The change needs to be made to the jQuery processing itself; otherwise, the payment method can't be changed to Square after a previous selection of a payment method.
Back to the drawing board ...
-
Re: Square Payment Module for Zen Cart [Support Thread]
I've submitted a change-request to the Zen Cart GitHub, see this commit for details of the proposed change.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Cindy,
:smile:
I changed:
Code:
Line 13: if ($payment_modules->in_special_checkout()) {
replaced:
if ($payment_modules->in_special_checkout() || empty($square) || !$square->enabled) { |
|
1. /includes/modules/pages/checkout_payment/jscript_square.php
2. /includes/modules/pages/checkout_one/jscript_square.php
The download worked perfectly!!!
Mark,
-
Re: Square Payment Module for Zen Cart [Support Thread]
Thanks for the report, Mark. Turns out that the issue was raised when/if the Square payment method was zone-restricted as well; causing the jQuery error if the payment method was not enabled for the zone associated with the current billing address.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
dbltoe
All of a sudden, Square is bouncing with INVALID_ENUM_VALUE with the detail - "is not a valid enum value for 'billing_address.country' "
Is this something 0.95 might fix or do we need to come up with a country field to satisfy a new requirement.
[27-Nov-2018 17:04:48 UTC] Request URI: /index.php?main_page=checkout_process, IP address: 72.190.125.38
#1 trigger_error() called at [/home/spicdavi/public_html/includes/modules/payment/square.php:338]
#2 square->before_process() called at [/home/spicdavi/public_html/includes/classes/payment.php:245]
#3 payment->before_process() called at [/home/spicdavi/public_html/includes/modules/checkout_process.php:84]
#4 require(/home/spicdavi/public_html/includes/modules/checkout_process.php) called at [/home/spicdavi/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#5 require(/home/spicdavi/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/spicdavi/public_html/index.php:36]
[27-Nov-2018 17:04:48 UTC] PHP Notice: Square Connect [configuration] error.
Response Body:
stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[category] => INVALID_REQUEST_ERROR
Code:
=> INVALID_ENUM_VALUE
[code]
[detail] => `` is not a valid enum value for `billing_address.country`.
[field] => billing_address.country
)
)
)
Response Headers:
Array
(
[0] => HTTP/1.1 400 Bad Request
[Content-Type] => application/json
[Vary] => Origin, Accept-Encoding
[X-Content-Type-Options] => nosniff
[X-Download-Options] => noopen
[X-Frame-Options] => SAMEORIGIN
[X-Permitted-Cross-Domain-Policies] => none
[X-Xss-Protection] => 1; mode=block
[Date] => Tue, 27 Nov 2018 17:04:47 GMT
[keep-alive] => timeout=60
[Strict-Transport-Security] => max-age=631152000
[content-length] => 182
)
in /home/spicdavi/public_html/includes/modules/payment/square.php on line 338
@dbltoe ... do you have any idea why the billing country is blank? It's obtained by lookup from the customer's default address, unless they change that address during checkout. The only reason I can think of why it would be blank is if they somehow were allowed to select a country which is not supported by your store, or if you've changed the "country name" or ISO codes in your Admin to something other than the default.
-
Re: Square Payment Module for Zen Cart [Support Thread]
(Access Token needed) Still shows in red.
Everything is set correctly.
Everything (files) in correct location.
Yes I refreshed admin page 1 million times (not a million, but close)
Gots me baffled.
All latest versions installed.
Help, will give monatary compensation if this gets figured out.
It is on a Dreamhost server.
-
Re: Square Payment Module for Zen Cart [Support Thread]
It's generally that you need to take special care that all of the access token is removed and the entire access token is entered. The length of the token often makes you think you got it all when you didn't.
-
Re: Square Payment Module for Zen Cart [Support Thread]
EDIT: Problem resolved
ZC 156 builtin Square setup
install on sandbox server with demo data
drop tables
import db from backup of live db
run zc_install
RED: Access Token needed error
Seems that the setup is asking for input from our square account for which no field exists or I am not comprehending the field labels in setup.
Square setup.
Populate the fields as necessary.
There is NO Access token field in the zc square setup but there is one in our square account
Application ID copy/pasted from our Square account
Application Secret (OAUTH) copy/pasted from our square account
EDIT: It helps if you read all the setup instructions. I missed the line where zc provided a link which needed to be pasted into our Square Account
Problem resolved.
-
Re: Square Payment Module for Zen Cart [Support Thread]
a new problem for me.
I get this error when testing
We could not initiate your transaction because of a problem with the card data you entered. Please correct the card data, or report this error to the Store Owner: SQ-NONCE-FAILURE
All the credit card info is correct (used 3 different cards
-
Re: Square Payment Module for Zen Cart [Support Thread]
SQ-NONCE-FAILURE happens when the javascript on the page is unable to properly obtain a payment token from Square. This is almost always because there are javascript errors on your page. Javascript errors are common when mixing multiple plugins or adding extra things to the template. You'll need to investigate the errors in your template.
-
Re: Square Payment Module for Zen Cart [Support Thread]
-
Re: Square Payment Module for Zen Cart [Support Thread]
Use your browser's "Developer Tools" (for FireFox and Chrome, that's opened by pressing the F12 key if running on Windows). That will open up (by default) additional information in the bottom portion of your display.
Click on the Console tab and you'll see various messages associated with files' loading and javascript/jQuery information and (most importantly) errors. That should allow you to hone in on the culprit.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
DrByte
Undecided. What's the business reason behind the request? (it helps for understanding the scope)
Some people prefer less worries about the PCI security parts.
I have an issue maybe you can provide some insight. This is a clone outdoorcountrydecor com, the other is working fine. There are no errors and they reside on the same server. Zen 1.5.5F, PHP 7.1.26, Square 0.96.
I cannot get Oauth to confirm. The cloned site is in the same Square account, as well as 3 others working fine with their own location IDs, same as this one.
HTTPS is fine, couldn't locate any JS errors, zero logs being produced, uninstalled & reinstalled, re-uploaded module files & again un-re-installed, created a new ap and swapped out the numbers, changes the Oauth token manually, redirect url is correct.... nothing, you push green button to authorize, takes you to square, login, back to the site with url paramenters... stalls, never finishes or completes. Refreshs do nothing either.
~Melanie
-
Re: Square Payment Module for Zen Cart [Support Thread]
I was wondering if someone might be able to help me out with the square module (v.96) not redirecting correctly and not authorizing. I updated my site and did a clean install (currently using v1.5.5f) and the module is no longer working. Before doing a fresh install it was working just fine. Since I've never had this issue I'm not sure how to go about finding a solution. I looked on the forums and didn't see any posts on a similar topic. I could have over looked it, and if I did I do apologize.
What is happening is when I click the green authorize button it loads the square login page, I log in and taken to blank page with no message. If I try refreshing the admin page it still shows (Access Token needed).
Both my application ID and OAuth are correct and the redirect link is set to https://mysite.com/square_handler.php (which the file is in the root directory).
The only difference is before doing a fresh install I worked on and designed the new site in a test directory before transferring it to the root directory.
If anyone has any advice or can point me in the right direction to fix this issue I would be very appreciative.
Thanks,
Steve
-
Re: Square Payment Module for Zen Cart [Support Thread]
@mprough and @jewelm,
You can do some basic debugging by editing line 11 of the square_handler.php and setting false to true.
@jewelm, Are you sure you brought the square.handler.php file over from test to production? Square needs to be told the correct URL and of course the file needs to exist.
What happens when you go to https://your_site.com/square_handler.php ? (yes, HTTPS) Normally you want to just see a white page. But if you're getting an error (ie: 404-not-found, etc) then you'll need to fix that, cuz Square will also see the error and thus will fail.
After setting $verbose=true like I mentioned above, visiting the square_handler.php with your browser should give you some text about the current token status according to your store. You can use that for troubleshooting.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Oh wow thank you for the quick reply DrByte. Yeah everything was transferred over correctly (other than this, everything is working just fine) The configure files have also been updated.
If I load the square_handler.php page it does load to a blank page. No errors.
I've just been trying to narrow down things to figure where to look and while in the square app if I change the redirect url from https://mysite.com/square_handler.php to just https://mysite.com then the redirect does work. (using admin>payments>square>click green authorize button>login>redirected to site homepage).
Does this indicate an issue with the square_handler.php file itself?
Thanks again.
Edit: Changing the redirect url was just a test to see if logging into square would work and trigger the redirect. I know it wouldn't be able to authorize or get the access token to get the module to run.
-
Re: Square Payment Module for Zen Cart [Support Thread]
An Update to my previous post. This evening I spent some time trying to figure it out and haven't come up with any solutions. I ended up installing a default zen cart (no custom templates or extra plugins) v1.5.5f into a new directory (/dev) and the same issue happened.
The redirect blank screen and url I am seeing after logging in from clicking the green authorize button is:
https://mysite.com/dev/square_handler.php?code= (an OAuth that is different than mine that changes with each attempt) &state= (set of random numbers that also change after each attempt)#_=_
Not sure if that is any indication, but that is where I am at currently.
As stated earlier everything was working just fine a few days ago. I wanted to clean up the sites back end and database. So I created a test directory, installed a clean v1.5.5f and new database. Installed all the plugins and template I use, got it back up in running and transferred it to the root directory. The only thing I did not set up was the payment modules, which is just paypal and square, until the updated site was on the root directory. Paypal set up just fine and payments process during checkout.
Nothing was changed on my host or in my square account. I did try creating a new square app, but same issue and url happened.
-Steve
-
Re: Square Payment Module for Zen Cart [Support Thread]
I can confirm with Jewelm of this also for myself
@DrByte this
Quote:
You can do some basic debugging by editing line 11 of the square_handler.php and setting false to true.
whether authorizing or simply loading the page in my browser simply says failure
-
Re: Square Payment Module for Zen Cart [Support Thread]
I am also having issues getting the module set up. I have verified the Application ID, and Application Secret (Oauth) values match what is configured in the app on my Square account. I have also verified the Oauth Redirect URL is correct.
When I click the green button to get the token, I am taken to my square account login page. After entering my credentials, I receive an HTTP 417 error, which is an 'Expectation failed' error, which indicates that the expectation in the Expect header of the web request could not be met.
I enabled the additional messages ($verbose = true) and get the message 'failure'.
While attempting to troubleshoot, I disabled the .htaccess file for this site, which only contained rewrite rules to prevent site image scraping (still currently disabled).
I am running Zen Cart 1.5.6a, Database patch level 1.5.6, PHP 5.6.40 (I plan to move this to 7 as soon as I can - there are other dependencies on my hosting account that presently prevent this), MySQL 5.5.5-10.1.38-MariaDB, Square Payments Module 0.96.
I am open to any suggestions to get this working, and will provide any additional information as necessary (and appropriate, of course).
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
radiowave911
I am also having issues getting the module set up. I have verified the Application ID, and Application Secret (Oauth) values match what is configured in the app on my Square account. I have also verified the Oauth Redirect URL is correct.
When I click the green button to get the token, I am taken to my square account login page. After entering my credentials, I receive an HTTP 417 error, which is an 'Expectation failed' error, which indicates that the expectation in the Expect header of the web request could not be met.
I enabled the additional messages ($verbose = true) and get the message 'failure'.
While attempting to troubleshoot, I disabled the .htaccess file for this site, which only contained rewrite rules to prevent site image scraping (still currently disabled).
I am running Zen Cart 1.5.6a, Database patch level 1.5.6, PHP 5.6.40 (I plan to move this to 7 as soon as I can - there are other dependencies on my hosting account that presently prevent this), MySQL 5.5.5-10.1.38-MariaDB, Square Payments Module 0.96.
I am open to any suggestions to get this working, and will provide any additional information as necessary (and appropriate, of course).
I am getting the exact same issue as stated above, my square_handler appends the following code after the .php (square_handler.php?code=sq0cgp-j_F4unDPtGZ02XK5gVKs1Q&state=5c7806a1d350a#_=_) None of that extra stuff is my account creds. I changed to True as well on thatsquare_handler.php file and the word failure is all that shows up, as mentioned by radiowave above. Running 1.5.6a - Square 0.96 - PHP version: 5.6.30 - Server version: 5.7.25 - MySQL Community Server (GPL).
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
cacoeman
my square_handler appends the following code after the .php (square_handler.php?code=sq0cgp-j_F4unDPtGZ02XK5gVKs1Q&state=5c7806a1d350a#_=_) None of that extra stuff is my account creds. I changed to True as well on thatsquare_handler.php file and the word failure is all that shows up, as mentioned by radiowave above.
Those extra parameters/code after the ".php" in the URL are sent from Square, and are part of the handshake involved in setting the token between your site and Square's servers.
This afternoon I'll try to simulate the "failure" response you're talking about. Maybe they've recently changed something that's causing it? I'll post back when I have some findings.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Great, thank you. I tried the same things that other folks did on the Square side, replaced my access token, replaced app secret, made a new app, removed and reinstalled Square 0.96. Nothing changed the outcome.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Ya, there's definitely a problem here. Dunno where it came from yet ...
Investigating ...
-
Re: Square Payment Module for Zen Cart [Support Thread]
Okay -- I think I've found a fix.
(Looks like Square changed how they do their responses ... as part of other improvements they're making.)
I believe you can resolve this problem by replacing the contents of your square_handler.php file with the code I've just updated here:
https://raw.githubusercontent.com/ze...re_handler.php
-
Re: Square Payment Module for Zen Cart [Support Thread]
Dude... you straight up saved my bacon. That worked like a charm. I have to sell tickets from that website and they go on sale tomorrow. PM me your paypal or cryptocurrency address, I would like to very much send you a tip. Thank you.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Did some more testing and still came up with the same issue. The last thing I tried was installing default zencart 1.5.6a on a separate server that my original site was not on nor has never had zen cart on it. Updated the square module to 0.96 before running the authorize process and again made a new square app for this test. Same results.
All these test were done on php 7. Tried rolling back to 5.6, but didn't change anything.
Edit: Posted this before I saw the most recent posts. Sorry about that. But DrBytes fix a few posts up did fix the issue on my end. Thank you!
-
Re: Square Payment Module for Zen Cart [Support Thread]
Woot! Glad it fixed it for you. We'll roll the fix into a new release.
Thanks for reporting back!
-
Re: Square Payment Module for Zen Cart [Support Thread]
-
Re: Square Payment Module for Zen Cart [Support Thread]
I have installed when clicking the green button then logging into square the redirect says this page is not working, I have ssl and was able with a different cart to enable square, htaccess just says rewrite enabled. the redirect is correct in Oauth. at a loss, using 1.55f..default template.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
clebarron
I have installed when clicking the green button then logging into square the redirect says this page is not working, I have ssl and was able with a different cart to enable square, htaccess just says rewrite enabled. the redirect is correct in Oauth. at a loss, using 1.55f..default template.
Sorry didnt see these pages, the fix worked for me and no longer a problem
-
Re: Square Payment Module for Zen Cart [Support Thread]
Just to add another confirm with details for Google:
Had the Square "Access Token" issue described in prior posts. Page showed an HTTP 417 error.
Access Token was not updated in the database.
Applied fix mentioned in Post 264:
https://www.zen-cart.com/showthread....87#post1355387
Issue resolved.
-
Re: Square Payment Module for Zen Cart [Support Thread]
having trouble figuring out how to fix the SQ-NONCE-FAILURE error when trying to process CC via Square.
helmet-decals.com
I have 3 errors (2 are "ReferenceError: Can't find variable: $" with index.php line references - lines 198 and 287). The other is "Failed to load resource: the server responded with a status of 404 (Not Found)" referencing https://helmet-decals.com/includes/t.../sb_header.png. (which doesn't exist)
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
helmetdecals
having trouble figuring out how to fix the SQ-NONCE-FAILURE error when trying to process CC via Square.
helmet-decals.com
I have 3 errors (2 are "ReferenceError: Can't find variable: $" with index.php line references - lines 198 and 287). The other is "Failed to load resource: the server responded with a status of 404 (Not Found)" referencing
https://helmet-decals.com/includes/t.../sb_header.png. (which doesn't exist)
Did you apply the changes that @DrByte suggested in post #264 of this support-thread?
-
Re: Square Payment Module for Zen Cart [Support Thread]
I am using the Zencart_zen template. it works in the templates that come with Zen-Cart
-
Re: Square Payment Module for Zen Cart [Support Thread]
I did and it did not work. I can get it to work with the default templates from zen-cart but not with my custom "Zencart_zen". btw this custom does not have a jscript folder
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
DrByte
Okay -- I think I've found a fix.
(Looks like Square changed how they do their responses ... as part of other improvements they're making.)
I believe you can resolve this problem by replacing the contents of your square_handler.php file with the code I've just updated here:
https://raw.githubusercontent.com/ze...re_handler.php
I thought I was going crazy trying to get Square to work with v156a. I kept getting HTTP 417 errors. But then I saw this post and applied the copy/replace of the square_handler.php contents. Saved the file and re-tried it. And it works! Thank you!
-
Re: Square Payment Module for Zen Cart [Support Thread]
I found the problem just don't know how to fix it. The problem is in my template/common/html_header.php. Once I remove this I can except payments with not problem but then my "success' page is missing "contact us" and other buttons. I think the problem is in the jscript (the html_header.php points to jscript but my template doesn't have a jscript folder). Here is my html_header.php:
<?php
/**
* Common Template
*
* outputs the html header. i,e, everything that comes before the \</head\> tag <br />
*
* @package templateSystem
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: html_header.php 15761 2010-03-31 19:31:27Z drbyte $
* @version $Id: html_header.php 0000 2007-02-25 10:37:00Z kuroi $
* Based on a post by duncanad
*/
/**
* load the module for generating page meta-tags
*/
require(DIR_WS_MODULES . zen_get_module_directory('meta_tags.php'));
/**
* output main page HEAD tag and related headers/meta-tags, etc
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
<title><?php echo META_TAG_TITLE; ?></title>
<meta name="keywords" content="<?php echo META_TAG_KEYWORDS; ?>" />
<meta name="description" content="<?php echo META_TAG_DESCRIPTION; ?>" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="author" content="<?php echo STORE_NAME .', ' . TEMPLATE_DESIGN_TEXT . ', shopping cart program by Zen Cart™, http://www.zen-cart.com eCommerce';?>" />
<meta name="generator" content="shopping cart program by Zen Cart™, http://www.zen-cart.com eCommerce" />
<?php if (defined('ROBOTS_PAGES_TO_SKIP') && in_array($current_page_base,explode(",",constant('ROBOTS_PAGES_TO_SKIP'))) || $current_page_base=='down_for_maintenance') { ?>
<meta name="robots" content="noindex, nofollow" />
<?php } ?>
<?php if (defined('FAVICON')) { ?>
<link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<?php } //endif FAVICON ?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
<?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
<link rel="canonical" href="<?php echo $canonicalLink; ?>" />
<?php } ?>
<?php
/**
* load all template-specific stylesheets, named like "style*.css", alphabetically
*/
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^style/', '.css');
while(list ($key, $value) = each($directory_array)) {
echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
}
/**
* load all template-specific stylesheets, named like "ie_*.css", alphabetically
* for stylesheets targeted at all versions of IE
*/
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^ie_/', '.css');
while(list ($key, $value) = each($directory_array)) {
echo '<!--[if IE]>' . "\n";
echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />' . "\n";
echo '<![endif]-->' . "\n";
}
/**
* load all template-specific stylesheets, named like "ie7*.css", alphabetically
* for stylesheets targeted at specific versions of IE
*/
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^ie[5-9]_/', '.css');
while(list ($key, $value) = each($directory_array)) {
$ver = substr ($value, 2, 1);
echo '<!--[if IE ' . $ver . ']>' . "\n";
echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />' . "\n";
echo '<![endif]-->' . "\n";
}
/**
* load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
*/
$manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
$tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
$tmp_pagename = ($this_is_home_page) ? 'index_home' : $current_page_base;
if ($current_page_base == 'page' && isset($ezpage_id)) $tmp_pagename = $current_page_base . (int)$ezpage_id;
$sheets_array = array('/' . $_SESSION['language'] . '_stylesheet',
'/' . $tmp_pagename,
'/' . $_SESSION['language'] . '_' . $tmp_pagename,
'/c_' . $cPath,
'/' . $_SESSION['language'] . '_c_' . $cPath,
'/m_' . $manufacturers_id,
'/' . $_SESSION['language'] . '_m_' . (int)$manufacturers_id,
'/p_' . $tmp_products_id,
'/' . $_SESSION['language'] . '_p_' . $tmp_products_id
);
while(list ($key, $value) = each($sheets_array)) {
//echo "<!--looking for: $value-->\n";
$perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . $value . '.css';
if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
}
/**
* load printer-friendly stylesheets -- named like "print*.css", alphabetically
*/
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^print/', '.css');
sort($directory_array);
while(list ($key, $value) = each($directory_array)) {
echo '<link rel="stylesheet" type="text/css" media="print" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
}
/**
* load all site-wide jscript_*.js files from includes/templates/YOURTEMPLATE/jscript, alphabetically
*/
$directory_array = $template->get_template_part($template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.js');
while(list ($key, $value) = each($directory_array)) {
echo '<script type="text/javascript" src="' . $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value . '"></script>'."\n";
}
/**
* load all page-specific jscript_*.js files from includes/modules/pages/PAGENAME, alphabetically
*/
$directory_array = $template->get_template_part($page_directory, '/^jscript_/', '.js');
while(list ($key, $value) = each($directory_array)) {
echo '<script type="text/javascript" src="' . $page_directory . '/' . $value . '"></script>' . "\n";
}
/**
* load all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically
*/
$directory_array = $template->get_template_part($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.php');
while(list ($key, $value) = each($directory_array)) {
/**
* include content from all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically.
* These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
*/
require($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value); echo "\n";
}
/**
* include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
*/
$directory_array = $template->get_template_part($page_directory, '/^jscript_/');
while(list ($key, $value) = each($directory_array)) {
/**
* include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
* These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
*/
require($page_directory . '/' . $value); echo "\n";
}
// DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
?>
</head>
<?php // NOTE: Blank line following is intended: ?>
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
earmsby
I've had this payment module running nicely now for a month or two. Definitely prefer it over PayPal that I was using previously. However, I'm wondering if there is a way to modify the module to send the customer/cardholder name to Square. All the payments come through as "Unknown Name" in the square dashboard. It would be very handy to have the customer's name or the cardholder name for bookkeeping purposes in Square. I'm curious as to whether the module is already supposed to do this and it's just not working in my installation of it or whether this is functionality that could be added. I'm willing to tinker if I knew where to start.
I asked this question last year and got one answer of:
Quote:
I believe that's something you need to take up with the folks at Square.
They would never process a card without the cardholder's name so, they must have it. If it doesn't show up in your Square report, it's probably because their system is not coded to do it.
But elsewhere in the thread I read:
Quote:
At the present time, in v0.9 of the module, there is no creation of customers into your Square account.
I noticed that my store is still using version 0.90 o the plugin. I'm running ZC version 1.5.5e and PHP version 7.0
Would moving to the latest version of the Square module have any effect on the customer name (and other info) being brought in to Square rather than all sales showing as "unknown" or is this just not the way the module works?
-
Re: Square Payment Module for Zen Cart [Support Thread]
Just received an email from square developers about depreciating renew token.. just wondering does the current module cover these new changes.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
clebarron
Just received an email from square developers about depreciating renew token.. just wondering does the current module cover these new changes.
I received the same notice. I've been talking to their tech team about it. They assure me that right now no action is required since we're currently integrated with a prior API version. I'm investigating what cautions need to be taken for the next update. For now, according to them, you'll be fine. (fingers crossed)
EDIT/UPDATE: it turns out a change IS required. A new 0.97 version has been posted. See next post for details.
-
Re: Square Payment Module for Zen Cart [Support Thread]
IMPORTANT NOTE:
Square made some changes on March 13, 2019 which change how the module authorization tokens work.
You NEED to update your module to version 0.97 (just released today) in order for your token refreshes to work properly. And new installs won't work if you're using an older version of this module (ie: 0.96 or older).
This 0.97 update includes TWO important factors:
a) the square_handler.php update mentioned a few posts back (#264 on Feb 28)
b) a forced (slightly older) API Version header sent with each transaction (so you don't have to override it manually in your Square account)
Fortunately, if you were already using 0.96, updating to 0.97 involves only updating 2 files. See details in the module download at: Square Payments for Zen Cart
-
Re: Square Payment Module for Zen Cart [Support Thread]
version 0.97 Square Payment not working.
I have my Application ID & Application Secret filled from my square APP like instructions call for. Location ID is blank and wont show my store numbers.
I get (Access Token needed) in red.
When I run my square_handler.php I get a HTTP ERROR 417
I don't have any url redirects in turned on in my htaccess
This is a sub domain with its own url, that shouldn't affect anything?
I am so confused why something that is so straight forward looking doesn't working.
Any thoughts or should I call Square?
Thanks
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
kadeepro
I am so confused why something that is so straight forward looking doesn't working.
Agreed. But let's collaborate to find a solution.
Quote:
Originally Posted by
kadeepro
version 0.97 Square Payment not working.
I have my Application ID & Application Secret filled from my square APP like instructions call for. Location ID is blank and wont show my store numbers.
I get (Access Token needed) in red.
I don't have any url redirects in turned on in my htaccess
Quote:
Originally Posted by
kadeepro
This is a sub domain with its own url, that shouldn't affect anything?
A subdomain technically shouldn't be a problem, as long as the complete URL is set in your Square OAuth settings.
Quote:
Originally Posted by
kadeepro
When I run my square_handler.php I get a HTTP ERROR 417
How EXACTLY are you getting that?
... cuz in the code, unless altered, a 417 is only sent if running it from a command-line, not a browser
... further, the text string "HTTP ERROR 417" is never sent in human-visible text
That said, a 417 response means that either the module is Disabled in your admin (status set to 'false'), or the token is not set/valid.
Next, what exactly happens when you click the green button in your Admin to get an access token? Step by step.
-
Re: Square Payment Module for Zen Cart [Support Thread]
I got it working.
The green button logging back in to square this time fixed it. I had tried it before but it didn't activate module it just logged in to square.
I was had got the HTTP ERROR 417 by going to my https://www.url/square_handler.php before I had logged back in to square using the green button in Admin.
Thanks
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quick question.
In the previous version I was able to see in admin/orders.php a detail of the sale, which included the fee squareup charged for the transaction, quite useful for bookkeeping to process all the sales for the day from one screen. Is it possible to bring that feature back?
Thanks.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Anyone had a chance to peruse the proposed changes for the Square API and the ability to sell in decimal quantities? Looks like beta is up and finalization is 12 June.
Something we need to plan for?
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
dbltoe
Anyone had a chance to peruse the proposed changes for the Square API and the ability to sell in decimal quantities? Looks like beta is up and finalization is 12 June.
Something we need to plan for?
Are you saying Square does not/will not currently accept fractional units/decimal units?
I had only tested our Square account using integer units and am getting ready to disable our merchant account & enable Square to see how the fees worked out in the real world test.
90% of our products are sold in tenth ounce increments.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
dbltoe
Anyone had a chance to peruse the proposed changes for the Square API and the ability to sell in decimal quantities? Looks like beta is up and finalization is 12 June.
Something we need to plan for?
Quote:
Originally Posted by
RixStix
Are you saying Square does not/will not currently accept fractional units/decimal units?
I had only tested our Square account using integer units and am getting ready to disable our merchant account & enable Square to see how the fees worked out in the real world test.
90% of our products are sold in tenth ounce increments.
I don't recall having any trouble with fractional quantities. Hmmmm...
-
Re: Square Payment Module for Zen Cart [Support Thread]
Having an issue, found out when a customer tried to make a purchase. "The provided OAuth access token has expired. You must renew the access token via the Renew Access Token endpoint".
As far as I can tell, you should be able to do this through the Square payment module in the admin panel, but I don't see any buttons or functions to do that. I'm also on 0.97 so I'm not sure what's going on.
-
Re: Square Payment Module for Zen Cart [Support Thread]
And now I had a payment go through with no issues. I'm not sure what's going on here...
-
Re: Square Payment Module for Zen Cart [Support Thread]
You may need to set up a CRON job on your server to renew the token every three days or so. There's instructions in the README.html file in the mod package
Quote:
Automatic Token Refreshing via cron
This is optional. For low-traffic stores, this is recommended.
In the initial setup, you clicked that "green button" to activate the module by setting what's called a Refresh Token. This token will expire in 45 days if no transactions are made. (30 days expiration, plus 15 days grace period.) After the 30 days you will see the green "Get Access Token" button again in your store Admin, and will need to click it to reactivate the module as you did during initial setup.
With regular transaction activity the token will refresh itself, but this can come at the expense of a brief delay for random customers. To avoid the possibility of such delays, or expiration due to inactivity, we recommend that you set up a "cron job" on your server to automatically handle token refreshes without interfering with customer checkout activity.
To set up the cron job, go to the cron settings in your website hosting company's control panel, and create a new task to run every 3 days at 1am. The command for the task will be:
php /home/user/your/path/to/wherever/is/square_handler.php
Again, if your token expires, Square will no longer show up during checkout for your customers. But you can fix it manually by clicking the green button to "login and authorize your account" as described in the Configuration section above.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Thank you for this module, Dr. Byte. We've been using Paypal for card payments for years but some people seem to run a mile as soon as they see the Paypal brand. I set up a Square account a few days ago along with this module. It took me about half an hour from not having an account to running a test transaction in Zen Cart.
Anyway, I see that Square has just updated their API to handle the European PSD2/SCA (Strong Customer Authentication) regulations that come into force in a couple of months. I'm assuming this module will need an update to handle that?
-
Re: Square Payment Module for Zen Cart [Support Thread]
I looked around but couldn't locate the similar occurrence I'm experiencing with one of my stores.
This is what I'm getting all of the sudden in the log files after everything was working just fine.
The payment module isn't giving me any error on the admin side for which I assumed the installation was done correctly (?). I've removed the module and installed it again, no error messages, but it isn't working as it should. Some credit card payments do go through just fine though, which is strange.
ZC Version 1.5.6a
Square version 0.97
[05-Aug-2019 03:55:55 America/Detroit] Request URI: /index.php?main_page=checkout_process, IP address:XXXXXXXXX
#1 trigger_error() called at [/includes/modules/payment/square.php:340]
#2 square->before_process() called at [/includes/classes/payment.php:245]
#3 payment->before_process() called at [/includes/modules/checkout_process.php:85]
#4 require(/includes/modules/checkout_process.php) called at [/includes/modules/pages/checkout_process/header_php.php:14]
#5 require(/includes/modules/pages/checkout_process/header_php.php) called at [/home/koolwedd/public_html/index.php:36]
--> PHP Notice: Square Connect [configuration] error.
Response Body:
stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[category] => INVALID_REQUEST_ERROR
[code] => NOT_FOUND
[detail] => Card nonce not found in this application environment. Please ensure an application ID belonging to the same environment is used to generate the nonce.
)
)
)
Response Headers:
Array
(
[0] => HTTP/1.1 404 Not Found
[Content-Type] => application/json
[Square-Version] => 2018-12-05
[Vary] => Origin, Accept-Encoding
[X-Content-Type-Options] => nosniff
[X-Download-Options] => noopen
[X-Frame-Options] => SAMEORIGIN
[X-Permitted-Cross-Domain-Policies] => none
[X-Xss-Protection] => 1; mode=block
[Date] => Mon, 05 Aug 2019 07:55:41 GMT
[keep-alive] => timeout=60
[Strict-Transport-Security] => max-age=631152000
[content-length] => 230
)
in /includes/modules/payment/square.php on line 340.
Any idea what could be happening?
Thank you.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
all of the sudden ... after everything was working just fine.
reinstalled ... no error messages, but it isn't working as it should. Some credit card payments do go through just fine though, which is strange.
That sort of message usually means you've generated an app token for one store but are using it on another. But that wouldn't happen on already-running stores like yours unless someone is in your admin and messing with your own configuration settings, which is unlikely.
Due to the intermittent nature of the problem, I'd suggest reaching out to Square Support. It feels like maybe something amuck on their servers.
If you can get a tech person on their end to look into their logs (on their end) for those specific rejections (or new ones you can trigger in real time) then they can probably tell you what's causing it, or identify whether something's operating oddly on their end.
For context, you can tell them that you're using Square-Connect-PHP/2.20181205.0 (and passing 'Square-Version: 2018-12-05' with each transaction).
(In case they ask: I haven't upgraded it to a newer one yet for 2 reasons: you're not using any of the newer features they've added, and upgrading it requires a huge rewrite to the token infrastructure that I had to create long before they built one in. They've advised me that passing the API version number as described above is exactly the right approach in this case.)
-
Re: Square Payment Module for Zen Cart [Support Thread]
Quote:
Originally Posted by
BillJ
Thank you for this module, Dr. Byte.
I set up a Square account a few days ago along with this module. It took me about half an hour from not having an account to running a test transaction in Zen Cart.
Woot!
Quote:
Originally Posted by
BillJ
Anyway, I see that Square has just updated their API to handle the European PSD2/SCA (Strong Customer Authentication) regulations that come into force in a couple of months. I'm assuming this module will need an update to handle that?
Yes, I need to find some time to review what's needed for that. My schedule for August is pretty full, so unlikely to explore until next month. PM me if you need to talk about accelerating that.
-
Re: Square Payment Module for Zen Cart [Support Thread]
Thank you DrByte for the quick reply.
I would think something else is happening since nothing has changed in the square account, just updated ZC to 1.5.6a and installed the module with the exact same information it's had. Also weird the event seems to be intermittent.
I'll post whatever solution square provides me with in case someone else here has a similar issue.
-
Re: Square Payment Module for Zen Cart [Support Thread]
ZC v1.5.6c
PHP v7.2.10
Square v0.97
Successfully captured funds within Admin (Square) but received this warning when doing so
Code:
[22-Aug-2019 16:51:02 Europe/London] Request URI: /myadmin/orders.php?page=1&oID=1271&action=doCapture, IP address: my.ip.123.456
#1 square->_doCapt() called at [/home/mydomain/public_html/myadmin/orders.php:285]
--> PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/mydomain/public_html/includes/modules/payment/square.php on line 1017.
Lines 1017 - 1022 of square.php
Code:
if (count($errors_object)) {
$error = $this->parse_error_response($errors_object);
$messageStack->add_session(MODULE_PAYMENT_SQUARE_TEXT_UPDATE_FAILED . ' [' . $error['detail'] . ']', 'error');
return false;
}
-
Re: Square Payment Module for Zen Cart [Support Thread]
Also, just noticed this warning, at time of above order
Code:
[17-Aug-2019 11:22:25 Europe/London] Request URI: /index.php?main_page=checkout_process, IP address: my.customersip.123.456
#1 square->before_process() called at [/home/mydomain/public_html/includes/classes/payment.php:246]
#2 payment->before_process() called at [/home/mydomain/public_html/includes/modules/checkout_process.php:92]
#3 require(/home/mydomain/public_html/includes/modules/checkout_process.php) called at [/home/mydomain/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#4 require(/home/mydomain/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/mydomain/public_html/index.php:36]
--> PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/mydomain/public_html/includes/modules/payment/square.php on line 355.
Lines 355 - 359 of square.php
Code:
if (count($errors_object)) {
$error = $this->parse_error_response($errors_object);
$messageStack->add_session('checkout_payment', MODULE_PAYMENT_SQUARE_TEXT_ERROR . ' [' . $error['detail'] . ']', 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
}
-
Re: Square Payment Module for Zen Cart [Support Thread]
Made the mistake of not searching for this warning with Google and so have now found a possible remedy in this post:
https://www.zen-cart.com/showthread....93#post1353393
-
Re: Square Payment Module for Zen Cart [Support Thread]
Have Just received this as email from Square. A little worrying given the short notice.
Quote:
Squares Payment Form and Connect v2 APIs have been updated with everything you need to make your website or application compliant with Strong Customer Authentication (SCA) -- the new European regulation to make customer-initiated online payments more secure. SCA requires that merchants pass additional information about their customers to their payments provider with each transaction in order to reduce online fraud.
Youll need to make updates to your integrations by September 14th, 2019, when the regulation goes into effect. Dont wait until the last minute! If you have questions about the update process, please contact developer support.
https://developer.squareup.com/docs/sca-overview
Is zen cart compliant or am I going to have to stop using square for Payments?
I could forward e-mail if required.