Home › Posts › Stop duplicate QuickBooks invoices with requestid

Stop duplicate QuickBooks invoices with requestid

If your Stripe-to-QuickBooks sync sometimes creates the same invoice twice, look at your retries. A create can time out on your side and still succeed at Intuit, so a plain retry makes a duplicate.

QuickBooks Online accepts a requestid query parameter on writes. Retry with the same id and the same body, and QBO returns the original response instead of creating a new record. The trick is making the id stable, not random per attempt:

const requestId = `stripe-${event.id}`;
// POST /v3/company/{realmId}/invoice?minorversion=75&requestid=...

Derive it from the source record, and keep it under QBO's length limit.

API Integrator for QuickBooks Online (US$24) adds requestid to every write, with a test that a retried create sends the same id (against mocked Intuit HTTP).