> ## Documentation Index
> Fetch the complete documentation index at: https://base-a060aa97-docs-devrel-859-eth-getproof-historical-proof.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Capture an Authorization

> Capture all or part of an escrowed authorization, in one capture or across multiple fulfillment increments, before the authorization expires.

Capture an authorization when the order is ready to settle. The operator transfers all or part of the escrowed amount to the receiver and fee receiver without collecting from the payer again. Capture the full amount at once, capture less when the final total changes after checkout, or capture multiple increments as an order ships.

<Info>
  This guide's payment flow is based on the [Commerce Payments Protocol](https://github.com/base/commerce-payments).
</Info>

## Check and Capture

Read `paymentState(paymentInfoHash)` before capture. The amount must be nonzero, no greater than `capturableAmount`, and submitted strictly before `authorizationExpiry`.

The operator supplies an absolute `feeAmount` in raw token units. The protocol validates it against the per-capture `minFeeBps` and `maxFeeBps` stored in `PaymentInfo`.

```typescript TypeScript lines wrap expandable highlight={8-11,16-17} theme={null}
export async function captureAuthorization(
  payment: StoredProtocolPayment,
  amount = payment.paymentInfo.maxAmount,
) {
  const [, capturableAmount] = await publicClient.readContract({
    address: AUTH_CAPTURE_ESCROW,
    abi: authCaptureEscrowAbi,
    functionName: "paymentState",
    args: [payment.paymentInfoHash],
  });
  if (amount > capturableAmount) throw new Error("Capture exceeds authorized amount");
  const simulation = await publicClient.simulateContract({
    account,
    address: AUTH_CAPTURE_ESCROW,
    abi: authCaptureEscrowAbi,
    functionName: "capture",
    args: [payment.paymentInfo, amount, 0n, zeroAddress],
  });
  const hash = await walletClient.writeContract(simulation.request);
  const receipt = await publicClient.waitForTransactionReceipt({ hash, confirmations: 2 });
  if (receipt.status !== "success") throw new Error("Payment capture reverted");
  return receipt;
}
```

Capture decreases `capturableAmount` and increases `refundableAmount` by the same gross amount. The receiver gets the gross amount minus fees.

<Check>
  Verify `PaymentCaptured(paymentInfoHash, amount, feeAmount, feeReceiver)` and the expected receiver transfers before marking the fulfillment increment settled.
</Check>

## Capture a Partial Amount

Pass a smaller `amount` to the same `capture` call for every increment. The sum of successful captures cannot exceed `PaymentAuthorized.amount`, and each capture independently validates its fee bounds. The remaining reservation is tracked onchain without a custom checkout contract.

For a 100 USDC authorization, a 64 USDC capture leaves 36 USDC capturable and makes 64 USDC refundable. You can capture another increment or [void the remainder](/build-on-base/accept-payments/void-an-authorization).

<Check>
  After every capture, reconcile `PaymentCaptured.amount` with the new `capturableAmount` and `refundableAmount` before another worker advances the order.
</Check>

<Warning>
  Fee bounds are evaluated per capture and use integer division. With low-decimal tokens, fragmenting one settlement into many small captures can reduce the aggregate minimum fee. Enforce a minimum capture size offchain when that matters.
</Warning>

## Capture Deadline

<Warning>
  At `authorizationExpiry`, capture is no longer available and the payer can reclaim the remaining balance. Use chain time rather than an application server clock when enforcing the deadline.
</Warning>

## See Also

<CardGroup cols={2}>
  <Card title="Void an Authorization" icon="ban" href="/build-on-base/accept-payments/void-an-authorization">
    Return the unneeded remainder to the payer.
  </Card>

  <Card title="Refund a Payment" icon="rotate-left" href="/build-on-base/accept-payments/refund-a-payment">
    Return previously captured value to the payer.
  </Card>
</CardGroup>
