Where to put applicationId and locationId for Web Payments SDK Quickstart

I followed the github repository and put my sandbox token into .env.example. Also tried putting the token into .env.sandbox. I keep getting application and/or locationId is incorrect. Where do I put these values?

Your access token (for server API calls) goes in .env.sandbox (see Credentials section of README). Your applicationId and locationId will need to be inserted in each example replacing {APPLICATION_ID} and {LOCATION_ID} (see here).

Continuing the discussion from Where to put applicationId and locationId for Web Payments SDK Quickstart:

Thank you for the response. I’m still getting an error after replacing applicationId and locationId in all files. Not sure what I’m doing wrong. This is what I did:

  1. Add Sandbox Access token to .env.example
  2. run cp .env.example .env.sandbox
  3. Add const appId = ‘sandbox-sq0idb-p7CscPwMnKlqz5Y1eKHUZw’; for all files
  4. Add const locationId = ‘LYZF618E5H0R6’; for all files
  5. Run Server on http://localhost:3000/
  6. Still get ‘applicationId and/or locationId is incorrect’

Those seem like the right steps so let’s debug a little further. That error message comes from CSS which is applied in a catch for creating payments. Very, very often it’s a simple misconfiguration (which doesn’t seem to be the case here). Logging the error that’s being thrown should shed some more light:

try {
    payments = window.Square.payments(appId, locationId);
- } catch {
+ } catch (err) {
+   console.error(err)