SAP S/4HANA and Square integration
SAP S/4HANA runs enterprise procurement and finance. Square runs payments, commerce, and vendor management. Connecting them keeps your purchase orders, supplier invoices, and payment settlements aligned across both systems. New orders in SAP sync to Square for fulfillment and payment collection, and Square payment records post into SAP's general ledger against the matching suppliers and cost centers. ml-connector handles the very different API styles on each side and moves the data on a schedule you control.
What moves between them
The main flow runs from SAP into Square. Purchase orders and supplier records from SAP sync into Square as Orders and Vendor records so fulfillment and payment collection are tracked in a single place. Payment and refund data flows from Square back into SAP, where ml-connector posts payment GL entries into the general ledger, allocated to the correct supplier account and cost center. Inventory adjustments can also flow from Square to SAP if configured. GL Accounts and Cost Centers in SAP are read-only, so ml-connector maps outbound payments to existing GL dimensions rather than creating new ones.
How ml-connector handles it
ml-connector stores both credential sets encrypted and refreshes SAP OAuth tokens before expiry (typically every 10 hours) by reading the Communication Arrangement token endpoint from your tenant URL, since that endpoint URL cannot be constructed manually and differs per deployment mode. For Square, it stores the refresh token securely and uses it to refresh the 30-day access token on a rolling schedule. Because SAP cloud deployments have no webhook system, ml-connector polls SAP purchase orders and invoice records using LastChangeDateTime filters and delta tokens; Square events are received push-style via registered webhooks with HMAC-SHA256 signature validation. Purchase orders are mapped from SAP suppliers and line-item detail into Square Orders with the supplier as the Vendor and cost center as a reference field. Payment records from Square are then matched against SAP suppliers and cost centers to post GL entries into the general ledger. Because SAP tokens are short-lived and Square refreshes are mandatory every 30 days, ml-connector tracks both expiry windows and refreshes transparently. Rate limits are handled with exponential backoff; every record carries a full audit trail and can be replayed if a downstream call fails.
A real-world example
A regional distributor runs SAP S/4HANA for procurement and accounting across three warehouses and uses Square for unified payment processing and vendor management across all locations. Before the integration, the procurement team created POs in SAP, emailed purchase details to vendors, and manually recorded payments in Square when invoices arrived. At month-end, accounting had to reconcile supplier balances between SAP and Square by hand, often finding mismatches when a PO quantity did not match the paid quantity or a vendor was registered differently in each system. With SAP S/4HANA and Square connected, each PO in SAP flows into Square as an Order attached to the vendor, vendors receive payment notifications through Square, and payment records automatically post into SAP's AP ledger. Month-end close now starts with supplier and payment records already in sync, and the manual reconciliation step is eliminated.
What you can do
- Sync SAP purchase orders into Square Orders, linked to the correct Vendor, so fulfillment and payment tracking are unified.
- Flow Square payments and refunds back into SAP as general ledger entries allocated to the correct supplier and cost center.
- Refresh SAP OAuth tokens transparently before expiry and manage Square's 30-day access token with non-expiring refresh tokens.
- Map SAP GL accounts and cost centers to Square Vendor and reference fields so payments land on valid accounting dimensions.
- Poll SAP on a customizable schedule and receive Square payment events via push webhooks with HMAC-SHA256 signature verification.
Questions
- How does the integration handle SAP's tenant-specific OAuth endpoint and short-lived tokens?
- ml-connector reads the Communication Arrangement token endpoint from your tenant URL (not constructed manually, since it varies by deployment mode) and caches the OAuth token. It refreshes proactively every 10 hours, well before the typical 12-hour expiry, so your purchase orders and payments flow without interruption. If a refresh fails, the next polling cycle retries automatically.
- Which direction does data move between SAP S/4HANA and Square?
- The main flow is SAP to Square for purchase orders and suppliers, then Square to SAP for payments and refunds. Inventory adjustments and customer records can also flow in either direction if configured. GL Accounts and Cost Centers in SAP are read-only, so ml-connector maps outbound payments to existing GL dimensions.
- Does the integration require manual setup in SAP and Square?
- Yes. In SAP, an admin must create a Communication System, User, and Communication Arrangement for OAuth before ml-connector can authenticate. In Square, you need to create an OAuth app or use a Personal Access Token and register the webhook endpoint for payment and order events. ml-connector stores both credential sets encrypted and handles token refresh and webhook signature validation automatically.
Related integrations
More SAP S/4HANA integrations
Other systems that connect to Square
Connect SAP S/4HANA and Square
Free to use. Add your credentials, ping your real systems, and see if we fit.
Get started