Unable to use Sandbox with unverified Square account

Created on 24 February 2025, about 1 month ago

Problem/Motivation

I was trying out Square Payments for a website I'm working on, but I found the sandbox account I created was not working. For some reason the Square settings page has a mix of Sandbox & Production credentials, but on Submit, only the Production endpoint is ever accessed.

Steps to reproduce

  1. Install Commerce Square Connect
  2. Go the the Square settings admin/commerce/config/square
  3. Enter only Sandbox credentials (even in Production fields)
  4. When clicking the Save button, we're redirected to a Square error page

Proposed resolution

Manage the credentials in a more structured manner. One idea would be to create a "Mode" radio setting with "Production" and "Sandbox", which would allow the correct API endpoint to be used in the backend.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.8

Component

Code

Created by

🇦🇺Australia yusufhm NSW, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @yusufhm
  • Pipeline finished with Failed
    about 1 month ago
    Total: 170s
    #432385
  • 🇦🇺Australia yusufhm NSW, Australia

    I've created a minimal working patch for now, which adds a Mode setting to the Square settings form.

    I think this could be improved by either having a single set of credentials and using Mode to determine which endpoint to use, or having two sets of credentials, one each for Sandbox & Production. For the first option however, the logic for creating a Square Payment Gateway would then have to be updated as well. OTOH for the second option, we'll have to work on whether all fields should be optional/required, and we would also need to work out how to auth with the different endpoints (probably have a separate button for each mode).

    I am not sure which one is right for now, since I've just started using Square and I only needed to test the Sandbox locally for now and the patch I made just worked. Happy to look a bit more into it once I have more time and if other people have any feedback.

Production build 0.71.5 2024