Atomic commit-and-redeem
For digital goods that are delivered instantly, splitting commit and redeem into two transactions adds friction and a window where the buyer pays but hasn't redeemed. Atomic commit-and-redeem collapses them into a single on-chain tx via OrchestrationHandlerFacet.
SDK
// The Core SDK doesn't (yet) wrap atomic commit+redeem behind a single helper.
// Two practical options:
//
// 1) Two-step commit then redeem — the buyer's wallet signs twice, but the
// delivery surface stays simple:
const commitTx = await sdk.commitToOffer(offerId, { value: offer.price })
const commitReceipt = await commitTx.wait()
const exchangeId = sdk.getCommittedExchangeIdFromLogs(commitReceipt.logs)
await (await sdk.redeemVoucher(exchangeId)).wait()
//
// 2) Drive the Diamond's OrchestrationHandlerFacet directly via ethers — that
// facet exposes the combined entry point on-chain. See
// Reference → Contracts → Facets → Orchestration.When to use
- Digital delivery with the seller's server returning the asset in the same HTTP response (common with x402).
- Agents that don't want to track a
COMMITTED → REDEEMEDtwo-step state machine. - One-shot purchases with no redemption window logic.
When not to use
- Physical goods. You need the redemption signal to be the buyer received it in their hands, not they committed. Use two-step commit-then-redeem.
- Time-bounded redemption windows. If you want the buyer to redeem within N days, two-step is required.
Atomic offer + commit + redeem
Sellers can publish an offer and atomically commit a buyer in one tx via the SDK's
createOfferAndCommit (orchestration). To also redeem in the same call, drive the
Diamond's OrchestrationHandlerFacet directly — at this SDK version there's no
single helper that wraps offer+commit+redeem.
// 1. Seller signs a FullOffer off-chain
const signedFullOffer = await sdk.signFullOffer(fullOfferDraft)
// 2. Buyer (or the seller acting for the buyer) calls createOfferAndCommit
await sdk.createOfferAndCommit(signedFullOffer)
//
// For the additional redeem step, call OrchestrationHandlerFacet via ethers.See Concepts → Signing → FullOffer and Reference → Core SDK → Orchestration mixin.
Next
- Quickstart → x402 server — atomic flow over HTTP.
- Build with x402 → State-machine integration.
- Reference → Core SDK → Orchestration mixin.