Skip to documentation content

Set up Square

Place Carden preparation and signed Square payment events around a merchant-owned Square Order and Payment implementation.

On this page

Confirm backend ownership

  • Select the merchant and Carden environment used by the Square backend.
  • Keep Square access tokens, application secrets, source tokens, and idempotency keys in that backend. Carden needs no Square access token.
  • Create a Carden key for the Square integration; a Stripe or QuickBooks key is rejected even if it has a similarly named scope.
  • Choose linked QuickBooks preparation, inline CanonicalInvoice preparation, reporting only, or separate service keys.

Connect Square payment events

  1. Open Integrations > Square and select Set up Square webhook, then Create webhook endpoint.
  2. Copy the notification URL Carden provides.
  3. In the Square Developer Console, open your application, go to Webhooks → Subscriptions, switch to the environment that matches the Carden environment (Sandbox or Production), and add a subscription with that exact URL.
  4. Select these events: payment.created, payment.updated, refund.created, refund.updated, dispute.created, dispute.state.updated.
  5. Save the subscription, copy its signature key, and paste it into Carden.
  6. Take a sandbox payment. Setup shows Delivery verified after the first signed event and counts captured payments separately.

Square signs the notification URL together with the raw body, so the subscription URL must match Carden's URL exactly. Carden encrypts the signature key and never returns it; the key verifies deliveries only and cannot call Square. The first signed event binds the endpoint to that Square seller (merchant_id); events from another seller are rejected. To rotate, replace the key in Square and select Update signature key in Carden.

Create an Order, then attach its Payment

  1. Configure QuickBooks as a source, or supply a complete authoritative invoice inline.
  2. Create a Square-integration Carden key with enrichment:write and payments:write; add invoices:read only for linked-source access.
  3. Ask Carden to prepare Square Order context and review the exact total and source references.
  4. Add the actual location_id and a Square idempotency_key, then call CreateOrder once.
  5. Call CreatePayment once with its own idempotency key, payment source, returned order_id, and matching amount.
  6. Set CreatePayment reference_id to the Carden preparation.id. Signed Square events then link the payment to its invoice; a payment report is optional.
Square Carden endpoints
POST /api/v1/square/order-enrichment
POST /api/v1/square/order-enrichment/from-invoice
POST /api/v1/square/payment-preparations/from-invoice  (HTTP API only)
POST /api/v1/square/payment-reports
POST /api/integrations/square/webhooks/{endpointId}  (called by Square)

Do not merge Carden preparation metadata into CreateOrder. Save it beside the merchant attempt and use preparation.id only for later Carden correlation.

Supply provider-owned fields

  • Use the merchant's actual Square location; Carden never chooses or fabricates one.
  • Generate Square idempotency keys in the merchant payment system and keep Order and Payment identities separate.
  • Use actual catalog IDs only when the merchant has established them; the Carden fragment uses factual ad hoc lines.
  • Pass the actual Square order_id to CreatePayment and persist paymentId, orderId, and locationId for reconciliation.
  • Set CreatePayment reference_id to preparation.id (36 characters, within Square's 40-character limit); never put other data in it if you want automatic invoice linking.

Validate before production

  1. Prepare a known sandbox invoice and inspect Order arithmetic.
  2. Create the Order and Payment once with merchant-owned idempotency.
  3. Confirm signed events arrive for APPROVED, COMPLETED, CANCELED, FAILED, refund, and dispute cases and appear under Recent events.
  4. Exercise duplicate Carden delivery, denied provider scope, ambiguous Square transport outcomes, and out-of-order provider events.
  5. Confirm that a Carden report failure never repeats CreateOrder or CreatePayment.