ml-connector
SAP ECCPayPal

SAP ECC and PayPal integration

SAP ECC runs finance and procurement on-premises. PayPal processes payments and handles transaction records globally. Connecting the two keeps your payment records and your general ledger synchronized. Payments received and refunds issued through PayPal flow into SAP ECC's general ledger automatically, mapped to the correct vendor invoices and cost centers, eliminating manual reconciliation and re-keying of payment data each month.

How SAP ECC works

SAP ECC exposes vendors, customers, general ledger accounts, cost centers, material masters, purchase orders, and financial documents through RFC/BAPI function modules accessed via SAP .NET Connector or Java Connector on an on-premises agent, as well as OData v2 REST via SAP Gateway at http://<host>:<port>/sap/opu/odata/<namespace>/<service>/. Authentication uses HTTP Basic Auth for OData and IDoc, or RFC Basic Auth for BAPI calls. Key BAPIs include BAPI_ACC_DOCUMENT_POST for posting journal entries, BAPI_VENDOR_GETLIST for vendor master data, and RFC_READ_TABLE for direct table reads. There are no native webhooks; data is polled on demand or at scheduled intervals configured by the SAP Basis team, often via IDoc outbound ports in WE21/WE20.

How PayPal works

PayPal REST APIs provide orders, authorizations, captures, refunds, invoices, transaction search, subscriptions, and payouts over HTTPS at https://api-m.paypal.com. Authentication uses OAuth 2.0 Client Credentials grant with Base64-encoded CLIENT_ID:CLIENT_SECRET to obtain a bearer token with typical 8-hour lifetime. PayPal can push webhook events such as payments, refunds, and invoicing actions as HTTPS POST to registered endpoints with RSA-SHA256 signature verification, or data can be polled via transaction search limited to 31-day windows. Key resources are Orders, Captures, Invoices, and Transactions; PayPal has no native GL account or purchase order objects.

What moves between them

The main flow runs from PayPal into SAP ECC. PayPal payment captures and refunds are read via scheduled REST calls to the transaction search API, then matched against SAP ECC vendor invoice master data. Each payment or refund generates a reconciliation journal entry posted into SAP ECC's general ledger via BAPI_ACC_DOCUMENT_POST, mapped to the vendor and cost center. Invoices created in PayPal can reference SAP document numbers via invoice_id for linkage. Reference data such as vendor master records and GL account dimensions are read from SAP ECC to validate posting targets before any entry is created.

How ml-connector handles it

ml-connector stores PayPal OAuth credentials encrypted and refreshes the bearer token on each request cycle or when a call returns 401. On the SAP side, it requires an on-premises RFC agent (SAP .NET Connector or Java Connector) running on the customer network with network access to both the SAP ECC instance and the PayPal API endpoint. ml-connector uses RFC_READ_TABLE to pull vendor and cost center master data for validation, then posts journal entries using BAPI_ACC_DOCUMENT_POST with an explicit BAPI_TRANSACTION_COMMIT call to lock the document and prevent left-behind locked records. PayPal transaction searches are limited to 31-day windows, so ml-connector tracks the last read timestamp and queries in rolling batches. Refunds are matched to the original capture transaction to preserve the PO reference and payment context. Since SAP ECC BAPI_ACC_DOCUMENT_POST lacks native idempotency keys, ml-connector uses the REF_DOC_NO field populated with a hash of the PayPal transaction ID and timestamp to detect and skip duplicate postings on retry. All records carry a full audit trail and can be replayed if a downstream GL posting fails.

A real-world example

A mid-sized distributor runs SAP ECC on-premises for order-to-cash and finance, and uses PayPal for online and international payment acceptance across web sales and partner channels. Before the integration, the accounting team manually exported PayPal transaction reports every week, matched payment receipts against invoice records in SAP, and posted payment GL entries by hand, a process taking 6 to 8 hours per week and frequently producing reconciliation mismatches when invoices were voided or partially refunded. With SAP ECC and PayPal connected, each payment capture and refund flows into SAP ECC as a GL entry within minutes, automatically matched to the invoice and customer, with the vendor reference preserved. Week-end payment reconciliation is now a 15-minute review instead of manual re-keying, and the general ledger AR accounts stay in agreement with PayPal's transaction record.

What you can do

  • Read PayPal payment captures and refunds on a scheduled interval and post matching GL entries into SAP ECC general ledger, mapped to vendors and cost centers.
  • Match PayPal transactions to SAP ECC invoices via reference number and prevent duplicate postings on retry using SAP's REF_DOC_NO field.
  • Validate vendor master data and GL accounts in SAP ECC before posting so every journal entry targets a valid dimension.
  • Manage RFC on-premises agent connection lifecycle and PayPal OAuth2 token refresh on each request cycle or on 401 response.
  • Detect duplicate postings and provide a full audit trail for every payment record so reconciliation mismatches can be traced and replayed if needed.

Questions

How does ml-connector post payments into SAP ECC when SAP ECC is on-premises and PayPal is a cloud service?
ml-connector requires an on-premises RFC agent (SAP .NET Connector or Java Connector) running on the customer network with outbound network access to both the SAP ECC instance and PayPal API. The agent maintains an open RFC connection to SAP ECC, and ml-connector calls BAPI_ACC_DOCUMENT_POST through that agent to post the GL entry. PayPal OAuth tokens are refreshed on each request, and the RFC connection is authenticated using the SAP basis credentials configured in the agent's config file.
What happens if a PayPal refund is issued after the original payment GL entry has been posted?
ml-connector tracks the last read timestamp and queries PayPal transactions in rolling 31-day windows. When a refund is detected, it is matched to the original capture transaction using PayPal's transaction relationship, then a reversing GL entry or a separate refund entry is posted into SAP ECC using the same BAPI_ACC_DOCUMENT_POST call, with the vendor and cost center from the original payment. The REF_DOC_NO field includes both the capture ID and refund ID so duplicate detection works correctly.
Why does ml-connector use REF_DOC_NO instead of an idempotency key?
SAP ECC's BAPI_ACC_DOCUMENT_POST has no built-in external idempotency key field like modern cloud APIs do. The REF_DOC_NO field is a standard SAP external reference field commonly used for duplicate detection by upstream systems. ml-connector populates it with a hash of the PayPal transaction ID and timestamp, allowing SAP Basis teams to query the GL document table (BSEG) and detect if an entry with that external reference already exists before posting.

Related integrations

Connect SAP ECC and PayPal

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

Get started