I'm using the latest dev version (8.x-1.x-dev updated 24 May 2020)

When trying to configure new payment gateway, there's no location for sandbox.

No sandbox location

I do have two sandbox locations on https://developer.squareup.com/apps/*randomStrings*/locations

Thanks

Comments

slashsharp created an issue. See original summary.

alibama’s picture

similarly borked in drupal 7 - any known cures?

jmester13’s picture

Hey All,

I'm also having this experience with the plugin. This is my first attempt ever at my own Drupal patch and this is probably just scratching the surface for a proper fix.

/commerce_square/src/Plugin/Commerce/PaymentGateway/Square.php

Line 90 Enter your test_location_id. I got mine from the locations page in square.
Line 120 Commented out

This allowed me to save the payment gateway. Obviously removing required is a hack move, but it seems to get us saving at least.

I'll report back on how my testing goes from this point forward.

brandonratz’s picture

Same issue here. The Production Locations sync properly but not Sandbox. I haven't tried hard coding the location_id as I'm testing in a production environment.

Using version 1.4.0

brandonratz’s picture

nhepner1’s picture

Okay - I've got this figured out I think.

Was having this issue and beating my head into a wall on this. Did some light digging and found out that the API request for the sandbox locations was returning "401 Unauthorized".

So I investigated this a bit and it took me longer than I'm proud to admit.

Essentially, I went on autopilot and copied the "Sandbox Application Secret" and pasted it into the Square settings page (admin/commerce/config/square). It felt obvious.

This is wrong.

You want the "Sandbox Access Token". This is a little harder to find, but it's on the same page. Scroll all the way to the bottom of the OAuth screen in the Square Developer Dashboard, and under Test Account Authorizations, you'll see the Default Test Account. Click on that and you should get a modal with the access token.

I'm not totally sure if this is the issue you're experiencing, but this definitely explains why my sandbox locations weren't loading, but my prod ones were.

socialnicheguru’s picture

I can confirm that @nhepner1 is a superstar.

Yes what he outlined is correct.

Once that is done the Sandbox location is available.

Can the readme be updated?

socialnicheguru’s picture

Title: No sandbox location available » [Workaround] No sandbox location available. Specify "Sandbox Access Token" NOT "Sandbox Application Secret"