Order outcomes and transactions
Create pending, call HTTP outside the transaction, then save the outcome.
What it is
Create pending, call HTTP outside the transaction, then save the outcome.
When to use it
Use while assembling or adapting the brokerage practice app.
Syntax
pending -> accepted (valid acceptance)
pending -> rejected (assumed definitive exchange 4xx)
pending -> unknown (timeout, 5xx, malformed response)
Failed final database update -> pendingExample
DB::transaction(fn () => Order::create($attributes));
// HTTP outside DB::transaction; no automatic order retry.
DB::transaction(fn () => $order->update($result));Common mistakes
Confirm exchange error semantics: 408/429 or ambiguous 4xx may require unknown rather than rejected. Pending/unknown need investigation before resubmission. SQLite has no MySQL-style row locks. No balance updates or matching engine are needed for this example.