Square Setup
Square handles payment processing for Staccato via Edge Functions.
Create Square Application
- Go to Square Developer Dashboard
- Click ”+ Create New Application”
- Name it “Staccato Coffee”
- Click Create
Get Credentials
From your Square application dashboard:
| Credential | Where to Find | Use |
|---|---|---|
| Application ID | Application → Credentials | AppConfig.squareApplicationId |
| Access Token | Application → Credentials → Sandbox/Production | Edge Function secret |
| Location ID | Application → Locations tab | AppConfig.squareLocationId |
Sandbox vs Production
| Environment | Application ID Prefix | Use |
|---|---|---|
| Sandbox | sandbox-sq0idb-... | Development and testing |
| Production | sq0idp-... | Live payments |
The app auto-selects sandbox in #if DEBUG builds.
Sandbox Test Values
Use these for testing without real charges:
- Card nonce:
cnon:card-nonce-ok - Card nonce (declined):
cnon:card-nonce-declined
Configure Edge Functions
# Set Square secrets for Edge Functions
supabase secrets set SQUARE_ACCESS_TOKEN=your_sandbox_access_token
supabase secrets set SQUARE_LOCATION_ID=your_location_id
# Deploy functions
supabase functions deploy process-payment
supabase functions deploy sync-square-order
# Verify deployment
supabase functions listConfiguration Check
The SquarePaymentService checks if Square is properly configured:
private var isConfigured: Bool {
AppConfig.squareApplicationId != "sandbox-sq0idb-DEMO"
&& AppConfig.squareLocationId != "your-location-id"
}When not configured in debug mode, payments are simulated with a 500ms delay. In release mode, it falls back to “Pay at Counter”.
Apple Pay with Square
To accept Apple Pay through Square:
- Create merchant ID in Apple Developer Portal
- Generate payment processing certificate
- Upload certificate to Square Dashboard → Apple Pay
- See Apple Pay Setup for details