Search code examples
androidsquare-connect

Square Web API for Android Kills App


I am unable to make a successful connection with the square reader via android request after following documentation found at https://docs.connect.squareup.com/articles/web-api-android

It seems straightforward, but the connection links end up crashing the app or causing it to restart without any error reporting or callback information sent to either S.browser_fallback_url or S.com.squareup.pos.WEB_CALLBACK_URI.

Sample link activated on dev server (127.0.0.1) is: intent:#Intent;action=com.squareup.pos.action.CHARGE;package=com.squareup;S.browser_fallback_url=http://localhost:8080/tb/square;S.com.squareup.pos.WEB_CALLBACK_URI=http://localhost:8080/tb/square;S.com.squareup.pos.CLIENT_ID=secret;S.com.squareup.pos.API_VERSION=v2.0;i.com.squareup.pos.TOTAL_AMOUNT=150;S.com.squareup.pos.CURRENCY_CODE=USD;S.com.squareup.pos.TENDER_TYPES=com.squareup.pos.TENDER_CARD,com.squareup.pos.TENDER_CARD_ON_FILE,com.squareup.pos.TENDER_CASH,com.squareup.pos.TENDER_OTHER;S.com.squareup.pos.REQUEST_METADATA=5a982466e7b46;S.com.squareup.pos.NOTE=This will be a note!;end

For the CLIENT_ID I was instructed to use Application ID found at https://connect.squareup.com/apps/

Firmware on Contactless, Chip reader is 2.9.36 which is connected to the android device via bluetooth.

--edit-- First time through https://ibb.co/kSBUYH https://ibb.co/fyUGDH Second time through https://ibb.co/duFZ0x https://ibb.co/i1MUYH


Solution

  • To bring this out of the comments, the issue was missing the web callback URL being registered in the Square Developer Portal.

    You want to be sure to register your callback URL(s)

    In order for Square Point of Sale to accept a request from your website, Square needs to verify that you have registered a web callback URI for the application in the Application Dashboard.

    First, go to the Application Dashboard, then click on the Point of Sale API tab of your application's settings. Under the Web section, specify your app's web callback URI under the corresponding field.

    If your transaction does not succeed for any reason, you should be receiving a error back to you.