The most successful conditional payment system I've seen wasn't the one with the most complex logic. It was the one that released payment in 97% of cases automatically and had a simple, clear path for humans to handle the other 3%.
Everyone thinks their condition is simple. "When the invoice is marked paid." Easy. Except what does "marked paid" mean? Marked by who? The payment processor says paid. But the funds haven't settled. The settlement cleared. But the customer charged back. Now what?
We had a shipping oracle that would sometimes double-report deliveries. Amazon's webhook fired twice. Our oracle fired twice. The contract released payment twice. We added idempotency handling to catch it, but idempotency was the second line of defense. The first line was "hope this doesn't happen."
We built a three-way escrow. Buyer, seller, logistics. Logistics confirms shipment. When shipment is confirmed, 80% of payment releases to the seller. When the buyer confirms receipt, the last 20% releases. Then the logistics partner sends an invoice and payment flows to them from the 20%.
Looks clean. In practice. The logistics partner's invoice was delayed. The 20% sat in escrow for 45 days. The buyer wanted a refund. The contract wouldn't refund because shipment was confirmed. We had to add manual override capabilities, which defeats the whole "no trust required" pitch.
We used Chainlink for one implementation. Most of the time it works. Sometimes the node is slow. Sometimes there's a network split and the price feed doesn't update for 15 minutes. During that 15 minutes, conditional releases are frozen. Customers panic. Our support gets flooded with "where's my payment" tickets.
We built a system that released payment "when the invoice was marked paid in the accounts system." The accounts system updated immediately when the payment processor confirmed the transaction. We didn't wait for settlement. Two weeks later, the customer charged back and we'd already released 5,000 dollars to the vendor.
A smart contract can't know things about the real world without being told. So you need an oracle. The oracle is supposed to watch the real world and report facts to the contract. Invoice paid? Oracle says yes. Shipment delivered? Oracle confirms. The contract sees the signal and releases the payment.
Start with one clear condition. Not three chained conditions, not composite logic, one thing. The oracle says X happened. Build in mandatory delays. If the condition is met, don't release immediately. Wait 24 hours. If the condition gets disputed during that window, freeze release. After 24 hours with no dispute, release.
Once you have a conditional payment contract, people want to chain them together. Nested conditions. A payment that releases when invoice 1 AND invoice 2 are marked paid. A payment that releases for 50% when shipment confirms and 50% when customer accepts. A multi-party escrow where three different entities have to sign off.
The scariest thing about smart contracts isn't that they're broken. It's that they're too honest. They do exactly what the code says. No exceptions. No "oh, we didn't mean to include that edge case." If you encode "release on condition X" and condition X happens for the wrong reason, the payment releases anyway.
The architecture is seductive because it feels like you're removing middlemen. No trust required. The contract enforces the rules. The money goes where it's supposed to go when it's supposed to go there. Reality is that smart contracts are brittle, oracles are unreliable, and someone's definition of "conditions met" doesn't match the contract's implementation.
Second, multiple oracles disagree. If you go decentralized and use three oracles to vote on whether a condition is met, what happens when two say yes and one says no? Contract votes majority. But what if the one that says no is correct and the other two were bribed or buggy? The payment released incorrectly.
For one client, "shipment delivered" meant "the logistics provider confirmed delivery." Except sometimes they confirm delivery and the package never showed up. The customer disputes it. The contract already released the payment. We added a second signal. Customer acceptance. Now both shipment confirmation AND customer acceptance within 7 days triggers release. It's slower. It's safer.
The idea. An escrow that releases payment automatically when conditions are met. Shipment confirmed, payment releases. Invoice marked paid, settlement triggers. Service delivered, token unlocks. Sounds clean. In practice, every single thing that can go wrong does go wrong, and you design for most of them and miss one that shows up at 4 AM on a Saturday.
First, oracles can be wrong or malicious or just slow. If your oracle is centralized, it's a single point of failure. The contract releases payment based on what one service told it. That service goes down or gets hacked or reports bad data. Payment releases when it shouldn't. Or worse, payment doesn't release when it should because the oracle stalled.
The contract doesn't know about charge backs. It only knows "mark paid" happened. So now we had to add a second condition. Payment has not been disputed 30 days after marking paid. This means the contract has to hold the escrow for 30 days minimum. Vendors hated waiting a month for payment. We compromised at 14 days. That meant we ate some charge backs.
Timing attacks and off-by-one horrors. Conditional releases often depend on time. "Release payment when the 30-day period expires." But smart contracts measure time in blocks, not seconds. Block time varies. You think you have a 30-day window. Actually you have a window of 2,700 blocks, which could be 29 days 18 hours or 30 days 6 hours. Don't use absolute time. Use block numbers. That's predictable.
When the contract reverts everything burns. Here's the scenario that keeps you up at night. The contract is supposed to release payment. It validates the conditions. Everything passes. It executes the transfer. The transfer fails (recipient is a contract that rejects transfers, or gas was miscalculated). The transaction reverts. The escrow is still locked. We had this with a 2-of-3 multisig wallet that rejected transfers with certain gas amounts. The escrow stayed locked for 3 days. You need fallback logic. If automatic release fails, after 24 hours anyone can manually trigger it.