Post Stripe payments to QuickBooks with fee splits

By General Input

When a Stripe payment lands, automatically record a clean QuickBooks sales receipt with the processing fee broken out on its own line, so month-end reconciles cleanly.

Integrations

  • Stripe
  • QuickBooks Online

Type

Deterministic Code

Categories

  • Finance
  • Operations

Build a deterministic code workflow that records every successful Stripe charge as a sales receipt in QuickBooks Online, with the Stripe processing fee broken out as its own line so month-end reconciliation lines up cleanly. This is a fixed pipeline with no judgement calls, so build it as a code workflow, not an agent.

Trigger: a Stripe webhook on the charge.succeeded event.

When the webhook fires, run these steps in order:

1. Call Stripe Retrieve Charge using the charge ID from the webhook payload, and expand balance_transaction so the Stripe fee is included. Pull the gross amount, the Stripe fee amount, the customer email, the customer name, the charge ID, the currency, and the description or statement descriptor.

2. Call QuickBooks Query Entities to look up an existing Customer where PrimaryEmailAddr.Address equals the Stripe email. If exactly one Customer is found, use that Id.

3. If no Customer is found, call QuickBooks Create Customer with DisplayName set to the Stripe customer name (fall back to the email local-part if the name is missing) and PrimaryEmailAddr.Address set to the Stripe email. Use the returned Id.

4. Call QuickBooks Create Sales Receipt with two SalesItemLineDetail lines:

- Line 1: the gross charge amount, mapped to a product or service item that points at your sales income account.

- Line 2: a negative-amount line equal to the Stripe fee, mapped to an item that points at a Stripe Processing Fees expense account.

Set DepositToAccountRef to a Stripe Clearing bank account, CustomerRef to the Id from step 2 or 3, TxnDate to the charge created date, and put the Stripe charge ID in PrivateNote (and in a custom field if one exists) so the receipt can be deduplicated on retries.

Important details: Stripe returns amounts in the smallest currency unit (cents for USD), but QuickBooks expects decimal dollars, so divide by 100 (or the correct exponent for the currency) before posting. Before creating the receipt, run a quick Query Entities lookup for an existing Sales Receipt whose PrivateNote contains the Stripe charge ID and skip the create if one already exists, to keep retries idempotent. If the QuickBooks Query Entities call returns more than one Customer for the same email, pick the first active one and log a warning.

The user should be able to configure the Stripe Clearing deposit account, the Stripe Processing Fees expense account, and the default revenue item without editing code.

Related prompts

Explore more prompts
Let support send one-off Loops emails without an engineerCustomer lifecycle inspector for Loops, Stripe and PostHogMonth-end Stripe finance pack, stored and shared in SlackRank your Intercom queue by what each customer pays youCatch the trials quietly dying before the card gets chargedWork every open Stripe dispute from one chargeback war roomSee which HoneyBook packages and seasons make you moneyLook up any customer's support, billing and CRM in one pageRun your monthly Freshdesk support billing in one sittingInvestor update studio that builds your board deck monthly