Compare Salesforce opportunities with Stripe payments and balances

Give your agent one account view of open Salesforce pipeline, paid Stripe invoices and remaining balances, with a tested example that handles missing due dates.

Connect Salesforce and Stripe in Combined to see commercial opportunity beside billing reality. Keep open pipeline, paid-invoice amounts, outstanding balances and overdue balances as distinct metrics. Aggregating each side before the account join gives your agent a useful account briefing without inflating money totals.

Start with the business decision

Ask: “For accounts with open opportunities, how much was paid on invoices in the last 90 days, what remains outstanding, and which balances are overdue?” This prepares an account owner for an expansion conversation. A strong pipeline and an unpaid balance can exist at the same customer.

The question is account-level. An invoice does not necessarily belong to a particular opportunity. Keep invoice and opportunity identifiers in the evidence, but only attribute a payment to a specific deal when your commercial system maintains that relationship.

Connect the records the question needs

Connect Salesforce and Stripe. Discover Salesforce Account, Opportunity and stage metadata. Stripe's customers and invoices supply the basic billing view; other records can explain refunds, disputes or specific payment activity.

Prepare account linkage, opportunity amount, currency and closed state. For invoices, find customer ID, status, amount paid, amount remaining, paid timestamp and due date. Stripe exposes these as different concepts; an invoice's original total is not its remaining balance. Stripe invoice reference. Keep test-mode records outside the production analysis.

Make the identity map explicit

Map each Stripe customer to the relevant Salesforce account. Record the Stripe account or connected-account boundary too if the organization operates multiple billing entities. A single Salesforce account can own several billing customers; roll those customers up once after validating the map.

Sum open opportunities separately from invoices. Then join by account and currency. Joining two opportunities directly to three invoices creates six rows before aggregation. The resulting totals can look plausible while being wrong. The downloadable fixture keeps these calculations independent and includes a company with no matching billing activity.

Define the metric and reporting window

Open pipeline is a current-state sum, while paid invoices use a payment timestamp from June 12 inclusive to September 10 exclusive, 2026 UTC. The example includes only USD and divides Stripe minor units by 100. Its paid metric excludes partial payments on still-open invoices, so label it “paid amounts on paid invoices,” not all cash receipts or net revenue.

Outstanding uses positive remaining amounts on open invoices. Overdue is the subset with a due date before the snapshot. Stripe permits a null due date for automatic collection; keep that balance in an “undated” bucket instead of silently calling it current or overdue. Due-date and remaining-amount definitions. Define an aging policy separately for that collection method.

Run the worked example

Atlas has $20,000 of open pipeline and $3,000 paid on qualifying paid invoices. Its open invoices have $700 remaining: $500 dated overdue and $200 with no due date. A void invoice and a payment before the reporting window are excluded. Birch's $6,000 pipeline remains visible despite having no billing record in the complete sample.

Download the runnable SQL fixture and its expected result. The fixture uses synthetic records and normalized teaching tables. Run it in DuckDB; discover your own Combined datasets before adapting the calculation.

Expected result from the synthetic fixture
AccountPipelinePaid invoicesOutstandingOverdueUndated
Atlas$20,000$3,000$700$500$200
Birch$6,000$0$0$0$0

Give your agent an exact assignment

Use my Salesforce and Stripe sources through Combined.
Inspect logical schemas, stage definitions, the account/customer map
and source freshness before calculating. Use USD for this first report.
Aggregate current open opportunity amounts by account.
Separately sum amounts paid on paid invoices with paid timestamps in
[2026-06-12, 2026-09-10), UTC. Calculate current open remaining balance,
its overdue subset, and balances with no due date as separate columns.
Join account aggregates. Do not assign invoices to individual deals
without an explicit link, or label this result net revenue or all cash.
Return account, invoice IDs, metrics, missing coverage, exact bounds,
source timestamps and query receipt. Read only; no collection actions.

Return supporting records and the next decision for each account. Display a bounded list while calculating over the complete dataset.

Check coverage before acting on the answer

Billing states can change after payment retries, credits or invoice revisions. Compare the query's source timestamp with the time of the proposed customer conversation. A zero is justified only when mapping and invoice coverage are complete. If the next question is net collection or revenue retention, add the relevant refund, credit and service-period rules explicitly instead of adjusting this summary by intuition.

Combined gives your agent a managed data layer across these sources, so the next question does not require another export. Start with 5 million MAR without a card, connect your apps, and use the Claude Code walkthrough or MCP setup reference.

Sources and further reading

Explore the documentation behind this guide. Product details checked on September 10, 2026.