ml-connector
SAP S/4HANATaxJar

SAP S/4HANA and TaxJar integration

SAP S/4HANA runs enterprise finance and procurement. TaxJar calculates and tracks sales tax across multiple states and jurisdictions in real time. Connecting the two ensures every invoice line carries the correct tax liability, those amounts post into SAP's general ledger without manual calculation or re-keying, and your tax obligations are synchronized for timely filing. ml-connector bridges SAP's OData APIs and TaxJar's REST endpoints, managing authentication and keeping tax and financial records aligned.

How SAP S/4HANA works

SAP S/4HANA (Cloud Public, Cloud Private, or On-Premise) exposes suppliers, customers, purchase orders, supplier invoices, sales orders, GL accounts, cost centers, and journal entries through OData V2 and OData V4 REST APIs. Authentication uses OAuth 2.0 with client credentials; tokens are short-lived (typically 12 hours) and must be cached and refreshed before expiry. The tenant URL and token endpoint vary by instance, provided in the Communication Arrangement settings, and must not be constructed manually. SAP S/4HANA publishes no webhooks, so integrations poll via LastChangeDateTime filters or delta tokens. GL accounts and cost centers are read-only and maintained only in SAP. On-Premise deployments require the sap-client query parameter on all requests.

How TaxJar works

TaxJar is a REST API accessed at https://api.taxjar.com/v2/ (production) or sandbox equivalents. Authentication is token-based; merchants provide a single API token from the TaxJar app, passed in the Authorization header as either Token token="<API_TOKEN>" or Bearer <API_TOKEN>. TaxJar does not support OAuth 2.0. The API versions via x-api-version request header (date format) and includes endpoints for real-time tax calculations, order reporting (sales and refunds), customer exemption management, and nexus region lookup. TaxJar offers no webhooks or push events; all integration is poll-based or merchant-initiated via REST POST and PUT. Sandbox is stateless and validates only request and response format.

What moves between them

The primary flow runs from SAP S/4HANA to TaxJar and back. SAP supplier invoices and sales orders are polled on a schedule you define. For each document, ml-connector extracts the invoice line items, ship-to and bill-to addresses, and customer details, then sends those to TaxJar to calculate applicable sales tax rates by jurisdiction. TaxJar returns the calculated tax amounts and jurisdiction rules. ml-connector then posts the tax liability as journal entries back into SAP S/4HANA, allocated to the correct GL accounts and cost centers. Customer exemption certificates are synced from SAP customer records into TaxJar to ensure exempt transactions are handled correctly. The integration maintains an audit trail of every calculation and posting.

How ml-connector handles it

ml-connector stores the SAP OAuth 2.0 client credentials and the TaxJar API token encrypted and validates both before attempting any sync. On the SAP side, it accepts the tenant-specific base URL and token endpoint from the Communication Arrangement, then caches the OAuth token and refreshes it before expiry to avoid mid-sync failures. It polls SAP for new or changed supplier invoices and sales orders using LastChangeDateTime filters, extracting line items, addresses, and customer data. For each batch, ml-connector calls TaxJar's real-time tax endpoint with the invoice details and jurisdiction information, receiving back the calculated tax and jurisdiction mappings. It then constructs SAP journal entries with the tax amounts, maps them to the GL accounts and cost centers from the original invoice, and posts them via OData. If a tax calculation or SAP posting fails, the job is retried with exponential backoff, and the full sequence is tracked in the audit log so failed batches can be replayed once the underlying issue is resolved. Address validation against TaxJar's nexus regions ensures tax rates are calculated for the jurisdictions where you actually have a filing obligation, not spurious ones.

A real-world example

A mid-sized online retailer runs SAP S/4HANA for order management and accounting, and was manually calculating sales tax for each state where they have nexus and entering the tax amounts into SAP journals at month-end. The finance team spent days chasing missing tax amounts, correcting misapplied jurisdictions, and reconciling between their tax notes and the GL. With SAP S/4HANA and TaxJar connected via ml-connector, every sales order that enters SAP automatically gets a tax calculation by jurisdiction, the amounts post into the GL on the same day, and a month-end tax summary is ready for filing because the GL and the taxable transactions are already synchronized. The manual calculation step and the downstream reconciliation are eliminated.

What you can do

  • Capture supplier invoices and sales orders from SAP S/4HANA and send them to TaxJar for real-time sales tax calculation by jurisdiction.
  • Post calculated tax amounts back into SAP S/4HANA as journal entries mapped to the correct GL accounts and cost centers.
  • Sync customer exemption certificates from SAP to TaxJar so exempt customers are handled correctly in tax calculations.
  • Authenticate SAP S/4HANA via OAuth 2.0 with automatic token refresh, and TaxJar via static API token, both stored encrypted.
  • Poll SAP on a defined schedule using LastChangeDateTime filters, retry failed syncs with exponential backoff, and maintain a full audit trail of all calculations and postings.

Questions

How does the integration handle SAP S/4HANA's tenant-specific OAuth setup?
ml-connector accepts the tenant URL and token endpoint from your SAP Communication Arrangement settings and does not attempt to construct them. It caches the short-lived OAuth token and refreshes it before expiry to avoid sync interruptions. SAP admin must create the Communication System, User, and Arrangement before the integration can authenticate.
What records move from SAP S/4HANA to TaxJar and back?
Supplier invoices and sales orders from SAP are sent to TaxJar to calculate sales tax by jurisdiction. TaxJar returns the calculated tax amounts and jurisdiction mappings. ml-connector then posts the tax as journal entries back into SAP, allocated to GL accounts and cost centers. Customer exemption certificates flow from SAP into TaxJar.
Does the integration require manual intervention if a sync fails?
No. ml-connector retries failed tax calculations or SAP postings with exponential backoff. The full sequence is tracked in the audit log, and batches can be replayed if an underlying issue (such as a temporary API outage) is resolved. Address validation ensures calculations are only performed for jurisdictions where you have a filing obligation.

Related integrations

Connect SAP S/4HANA and TaxJar

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started