cardinality: "many_to_one" and a rollup object. For rules that pair one record with one record, see Matching rules.
Prerequisites
- A reconciliation with data streams on Side A and Side B. See Reconciliations.
- A field the grouped records share, such as a payout id or batch id in metadata, or a date field if you group by day.
- For the API, an API key and the reconciliation’s id.
How rollup rules group records
A rollup rule has three parts.- The grouped side.
rollup.sidepicks which side is summed. Witha, the default, several Side A records match one Side B record. Withb, several Side B records match one Side A record. - The groups.
group_bynames the field that forms the groups, androllup.group_by_kindsays how to read it:identifierputs records with the same value, such as the samemetadata.payout_id, in one group and compares the group’s total amount to the other side.date(the default) buckets records by day and walks back from the single record’s date, keeping a running total, to find the days that add up to it. The firstgroup_bykey must be a date field.
- The match. A group matches when its total equals the other record’s amount, or comes within
rollup.toleranceof it.
Conditions on a rollup rule
filters on a rollup rule works differently from a one-to-one rule:
amount eq amountis satisfied by the rollup itself.- Every other condition must be an
eqwithout a tolerance. It keeps a group with a single record that carries the same value, for examplemetadata.invoice_number eq metadata.invoice_ref. - OR groups, other operators and condition tolerances are refused. To allow a gap between the total and the amount, set
rollup.tolerance.
key is always the Side A field and value the Side B field, whichever side the rule groups.
Matching within a variance
rollup.tolerance is how far a group total can be from the single record’s amount and still match, in cents. When the amounts differ, End Close books the difference as an adjustment record, described “Rule variance”, so the match nets to zero. The adjustment lives on the reconciliation’s own adjustments stream, not on one of your data streams. Variances apply only when the group and the record are in the same currency.
Netting debits against credits
By default a rollup adds each record’samount without its direction. A group of three $100 credits and one $20 debit totals $320, so it never matches a $280 payout.
Set rollup.net to true when the single record carries the net of the group, as a payment facilitator’s payout does: a day of sales (credit) less refunds and chargebacks (debit). The group total is then credits minus debits, and End Close compares it to the single record’s signed amount:
- A group that nets to a credit matches a credit record of that amount.
- A group that nets to a debit matches a debit record of that amount, such as a clawback, and never a credit.
rollup.net works with both group_by_kind values, both side values and rollup.tolerance. A variance on a net rule is booked as a credit adjustment on the side whose signed total is lower.
Create a rollup rule in the app
1
Open the reconciliation's rules
Go to Reconciliations, open the reconciliation and choose the Rules tab, then New rule.
2
Choose many-to-one
Pick Many-to-one.
3
Filter (optional)
Under 1. Filter, add conditions the single record must share with the group, such as operator equals operator.
4
Group
Under 2. Group, set Side to group to Side A or Side B. Choose By identifier to group by an exact value such as a batch id, or By date to sum per day. Pick the field in Group by.
5
Net debits against credits (optional)
Under 3. Match, turn on Net debits against credits when the single record is the net of the group, such as a payout for sales less refunds.
6
Add a variance or lookback window (optional)
Choose + Allow variance and enter an amount in dollars to match totals that are slightly off. Choose + Add lookback window to limit how many days back End Close looks for a group.
7
Save
Add a description and save the rule.
Create a rollup rule with the API
Charges to a payout (group Side A)
Card charges are on Side A, each carrying the payout it settled in asmetadata.payout_id. Bank deposits are on Side B. This rule sums the charges in each payout and matches the total to one deposit that arrives within five days:
cURL
One payout to its payments (group Side B)
Here the payout is on Side A, for example a ledger entry for each processor payout, and the individual payments are on Side B, each tagged withmetadata.payout_id. Setting rollup.side to b sums the payments and matches the total to the payout. The second condition ties each group to the payout whose external_id it names, and tolerance accepts up to $1.00 of difference:
cURL
side: "b", group_by names Side B fields and rollup.date_field names a Side A field.
Sales and refunds to a net payout
Settled transactions are on Side A: sales as credits, refunds and chargebacks as debits, each carryingmetadata.payout_ref. Payouts are on Side B with the same reference. With net set to true, the rule matches each payout to its transactions when the payout equals sales minus refunds:
cURL
Rollup settings
Leave out
lookback_days and date_field to match without a time limit. Two rollup rules with the same conditions are not duplicates if they group different sides, group by different fields, or differ in net.
When rollup rules run
Rollup rules run in batch runs. On a continuous reconciliation, End Close starts one a few minutes after an import’s records arrive, if the reconciliation has a rollup rule, and also when you save a rule. On a batch reconciliation, choose Run in the app or callPOST /reconciliations/{id}/run. Rules run in priority order with your one-to-one rules, and a record matched by an earlier rule can’t join a later group.
FAQ
Why didn't a payout match even though the charges add up?
Why didn't a payout match even though the charges add up?
Rollup matches must be unambiguous. If two groups add up to the same deposit, or two deposits fit the same group, End Close leaves them unmatched. Add a condition that ties the group to one record, such as a payout id, or narrow the lookback window.
Why didn't a payout match a group that includes refunds?
Why didn't a payout match a group that includes refunds?
Without
rollup.net, the rollup adds refunds to the total instead of subtracting them. Set rollup.net to true, and check that the payout has the same direction as the group’s net.Can a rollup group records in different currencies?
Can a rollup group records in different currencies?
Yes, if the totals match exactly after conversion to USD.
rollup.tolerance only applies when the group and the single record are in the same currency.Where does the variance go?
Where does the variance go?
Into an adjustment record on the match, described “Rule variance” and dated on the single record. It sits on the reconciliation’s adjustments stream, so your source data streams are unchanged.
Can I match many records to many records?
Can I match many records to many records?
Not with a rule. Many-to-many rules aren’t available yet. Select the records in the reconciliation and choose Reconcile to match them by hand.
Related
Matching rules
One-to-one rules, operators, tolerances and transforms.
Rules and matches
How rules, matches and adjustments fit together.
Stripe
Bring in charges and payouts to reconcile against your bank.
Review exceptions
Work through what your rules leave unmatched.