Square Payment not working with 4.10

1 2 3 >
Posted: August 06, 2018 at 3:11 PM Quote #210193
I have a fresh install of 4.1, and setup Square.  

Sandbox works as expected, and also populates a fake location correctly.

It doesn't seem to store the Business Location in the settings dropdown. And after hitting obtain access token it populates the dropdown with Locations (2) then when I save the App Secret, Business Locations, and Access Token all show blank.  Successfully configured message.

When I try to checkout I receive this error "Location is a required parameter for payment requests".  When I view the database it has the locationId set correctly.

I have tried several times and cannot checkout.  I even added the locationID to the javascript in the plugin, and it populates the javascript, but still nothing.

Any help please.  I have some of the Nop-Templates.com Emporium theme and plugins install, tried with normal checkout and one page checkout, and also added the nonce fix for Nop-Templates.com.

In Plugins:
Plugins/Payments.Square/Views/PaymentInfo.cshtml

var paymentForm = new SqPaymentForm({
            applicationId: '@squarePaymentSettings.ApplicationId',
            locationId: '@squarePaymentSettings.LocationId',
            inputClass: 'square-input',






This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Thank you-

Justin
Austin, TX - Website Developer/Data Specialist
http://www.jmacweb.com
Posted: September 21, 2018 at 7:56 AM Quote #212230
Has this been figured out yet? we are having the same issue.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: September 21, 2018 at 9:57 AM Quote #212234
Hi.
Did you try to look at log? What error messages are there?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: September 21, 2018 at 10:01 AM Quote #212235
From my original post:

"When I try to checkout I receive this error "Location is a required parameter for payment requests".  When I view the database it has the locationId set correctly."
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Thank you-

Justin
Austin, TX - Website Developer/Data Specialist
http://www.jmacweb.com
Posted: September 21, 2018 at 10:09 AM Quote #212236
That is not the exact same issue here. The sandbox square account works fine. When I change to the live square account, it pulls from Square the location options, I choose the location from the square options it should be set to and save and nopcommerce confirms it has saved the settings, but if I refresh the screen it has no location saved. thus the error when trying to process a transaction, Location is required, that would be Nopcom not sending a location to square when trying to process the transaction because it didn't save the location setting when the payment was being configured, maybe?

Log Entry 1 {Error while placing order. Error 1: Location is a required parameter for payment requests.}

Log Entry 2 {Nop.Core.NopException: Location is a required parameter for payment requests
   at Nop.Plugin.Payments.Square.SquarePaymentMethod.ProcessPayment(ProcessPaymentRequest paymentRequest, Boolean isRecurringPayment)
   at Nop.Plugin.Payments.Square.SquarePaymentMethod.ProcessPayment(ProcessPaymentRequest processPaymentRequest)
   at Nop.Services.Payments.PaymentService.ProcessPayment(ProcessPaymentRequest processPaymentRequest) in E:\nopCommerce\sources\src\Libraries\Nop.Services\Payments\PaymentService.cs:line 187
   at Nop.Services.Orders.OrderProcessingService.GetProcessPaymentResult(ProcessPaymentRequest processPaymentRequest, PlaceOrderContainer details) in E:\nopCommerce\sources\src\Libraries\Nop.Services\Orders\OrderProcessingService.cs:line 1387
   at Nop.Services.Orders.OrderProcessingService.PlaceOrder(ProcessPaymentRequest processPaymentRequest) in E:\nopCommerce\sources\src\Libraries\Nop.Services\Orders\OrderProcessingService.cs:line 1535}


Log Entry 3 short message {Square payment error: Error calling ListLocations: {"errors":[{"category":"AUTHENTICATION_ERROR","code":"UNAUTHORIZED","detail":"Your request did not include an `Authorization` http header with an access token. The header value is expected to be of the format \"Bearer TOKEN\" (without quotation marks), where TOKEN is to be replaced with your access token (e.g. \"Bearer ABC123def456GHI789jkl0\"). For more information, see https://docs.connect.squareup.com/api/connect/v2/#requestandresponseheaders. If you are seeing this error message while using one of our officially supported client libraries, please report this to [email protected] "}]}.

Log Entry 3 Long message {Square.Connect.Client.ApiException: Error calling ListLocations: {"errors":[{"category":"AUTHENTICATION_ERROR","code":"UNAUTHORIZED","detail":"Your request did not include an `Authorization` http header with an access token. The header value is expected to be of the format \"Bearer TOKEN\" (without quotation marks), where TOKEN is to be replaced with your access token (e.g. \"Bearer ABC123def456GHI789jkl0\"). For more information, see https://docs.connect.squareup.com/api/connect/v2/#requestandresponseheaders. If you are seeing this error message while using one of our officially supported client libraries, please report this to [email protected] "}]}
   at Square.Connect.Api.LocationsApi.ListLocationsWithHttpInfo()
   at Square.Connect.Api.LocationsApi.ListLocations()
   at Nop.Plugin.Payments.Square.Services.SquarePaymentManager.GetActiveLocations()
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: September 21, 2018 at 10:36 AM Quote #212241
Thanks for the details. We'll investigate it.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: September 27, 2018 at 11:28 AM Quote #212508
If you log in to the Square dashboard and set the API to the July version it works fine. It is the current api that must of changed the request header format I am guessing.
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: September 27, 2018 at 11:49 PM Quote #212527
I only see two options in the dropdown in Square:

2018-07-12
2018-09-18 (latest)

Ours was set to 2018-07-12, hence the first post from beginning of Aug.

Can you elaborate?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Thank you-

Justin
Austin, TX - Website Developer/Data Specialist
http://www.jmacweb.com
Posted: October 05, 2018 at 9:17 PM Quote #212855
Maybe switch the the newer API. Try to add it. Then when the payment fails, switch back to the old API. After about 30 attempts and checking another nop4.10 square combo. That finally worked..
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: October 11, 2018 at 12:40 PM Quote #213075
Hi

I am still struggling with this issue. I already tried changing back and forth the API versions and already added the code fix recommended by nop-templates for the 'Nop One Page Checkout' (see below) and added the code
 locationId: '@squarePaymentSettings.LocationId',


And yet, I am still seeing this same error - 'Location is a required parameter for payment requests'

Nop templates code:

function getCardNonceSquare(data) {
            var selectedStoredCardId = $('#@Html.IdFor(model => model.StoredCardId)').val()
            if (!submitForm && (!selectedStoredCardId || selectedStoredCardId == '0')) {
                if (paymentForm) {
                    paymentForm.requestCardNonce();
                }
                return false;
            }
            else if (onePageCheckout) {
                submitForm = false;
                PaymentInfo.save();
            }
        }

        if (realOnePageCheckout) {

            $('.complete-button').on('click', getCardNonceSquare);
        } else {

            $('input.payment-info-next-step-button').on('click', getCardNonceSquare);
        }


Did anyone here find a solution that actually works?

P.s. in my case sandbox mode didn't work either...
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Alexander
1 2 3 >
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.