ml-connector
SAP S/4HANAChargebee

SAP S/4HANA and Chargebee integration

SAP S/4HANA runs your finance and procurement. Chargebee runs your subscription billing and revenue recognition. Connecting them keeps your GL accounts in agreement with your billing journal and maps every invoice line to the cost center that generated it. Sales invoices from Chargebee flow to SAP for GL posting, and GL accounts and cost centers from SAP populate the allocation tables Chargebee uses to tag revenue by business unit. ml-connector handles the very different authentication models and sync patterns on each side.

How SAP S/4HANA works

SAP S/4HANA exposes GL accounts, cost centers, suppliers, purchase orders, invoices, and journal entries through OData V2 and OData V4 REST APIs. It authenticates with OAuth 2.0 Client Credentials issued through a Communication Arrangement set up by an SAP administrator; each Communication Arrangement holds its own token endpoint URL and scopes, and tokens are typically valid for 12 hours. SAP S/4HANA has no native webhooks; data is read by polling with timestamp filters or delta tokens. The Cloud Public Edition runs on a shared SAP hostname, while Private Edition and On-Premise deployments require tenant-specific or sap-client parameters.

How Chargebee works

Chargebee is a subscription billing and revenue management platform that exposes customers, subscriptions, invoices, transactions, credit notes, and items through a REST API secured with HTTP Basic Authentication. The API uses offset-based pagination with a maximum page size of 100, and rate limits vary by plan tier: Starter plans allow 150 requests per minute, Performance tiers allow 1000 requests per minute, and Enterprise plans allow 3500 requests per minute. Chargebee sends outbound webhooks for over 200 event types but has no native general ledger or procurement data; it is billing and revenue-focused.

What moves between them

The main flow runs from Chargebee to SAP S/4HANA. After invoices are generated in Chargebee, ml-connector reads the invoice and transaction records and posts them to SAP as GL journal entries, allocated to the cost centers mapped during setup. GL accounts and cost centers flow from SAP to Chargebee so custom fields in Chargebee invoices can reference valid SAP dimensions, ensuring every transaction is tagged with the business unit and cost center that owns it for downstream reporting.

How ml-connector handles it

ml-connector stores the SAP OAuth credentials and Communication Arrangement token endpoint per customer, refreshing the bearer token before expiry to prevent mid-flow authentication failures. On the Chargebee side it authenticates with HTTP Basic Auth, base64-encoding the API key as username with an empty password, and respects the rate limits of your plan tier by tracking concurrent requests and backing off on 429 responses. Because SAP S/4HANA has no webhooks, ml-connector polls both the GL Account and Cost Center APIs on a schedule you define, and polls Chargebee's invoice and transaction endpoints to detect new billing records for posting. Chargebee site names are case-sensitive, and region cannot be changed after account creation, so ml-connector validates both at connection time. GL Account and Cost Center data in SAP is read-only, so ml-connector never writes back to those APIs. Chargebee invoices are fetched via offset pagination, which scales efficiently as new invoices arrive.

A real-world example

A mid-market SaaS company runs SAP S/4HANA for finance and procurement and Chargebee for subscription billing across three business units: Core Product, Professional Services, and Support. Before the integration, the finance team manually exported invoices from Chargebee each month and re-entered revenue lines into SAP's GL, then reconciled each business unit's total against Chargebee's dashboard reports. With SAP S/4HANA and Chargebee connected, each invoice posts to SAP automatically, mapped to the cost center for the business unit that generated it, and the GL accounts are reconciled within hours of invoice generation. Month-end revenue reporting now runs directly from SAP's GL without manual cross-checking.

What you can do

  • Post Chargebee invoices and transactions into SAP S/4HANA's general ledger on a schedule you control, allocated to the cost centers that generated each subscription revenue line.
  • Sync SAP GL accounts and cost centers to Chargebee custom fields so every invoice is tagged with the business unit and cost dimension for downstream reporting.
  • Authenticate SAP S/4HANA with OAuth 2.0 via Communication Arrangements and Chargebee with HTTP Basic Authentication, managing token refresh and API key rotation.
  • Poll both systems on your schedule since SAP has no webhooks, with retries and backoff for Chargebee rate limits across Starter, Performance, and Enterprise tiers.
  • Maintain a full audit trail on every GL posting and invoice sync, with the ability to replay failed records if downstream calls do not complete.

Questions

Which direction does data move between SAP S/4HANA and Chargebee?
The main flow is from Chargebee to SAP S/4HANA. Invoices and transactions flow from Chargebee into SAP as GL journal entries, while GL accounts and cost centers flow from SAP to Chargebee to tag revenue by business unit. SAP GL accounts and cost centers are read-only, so ml-connector does not write to those APIs.
Why does ml-connector poll SAP S/4HANA instead of waiting for webhooks?
SAP S/4HANA has no native webhook system. ml-connector polls the GL Account, Cost Center, and Journal Entry APIs on a schedule you define, using OData timestamp filters or delta tokens to fetch only new or changed records since the last poll. This is more efficient than a full fetch on every run.
How does ml-connector handle the different authentication models?
ml-connector stores both credential sets encrypted: the SAP OAuth endpoint and client credentials for token exchange, and the Chargebee HTTP Basic Auth API key. It refreshes the SAP bearer token before expiry to prevent authentication failures, and it base64-encodes the Chargebee API key on each request with an empty password as per the Chargebee API contract.

Related integrations

Connect SAP S/4HANA and Chargebee

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

Get started