Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines Commerce Payments Protocol.
The initial draft of this article was prepared using the method described below. The original diagrams and code examples retain their Japanese labels and comments.
Traditional payment flows and Auth & Capture
If you have used a credit card, you may already have come across the terms Authorization and Capture. Together, they form a two-phase payment pattern established in traditional financial systems.
Here are the main terms used throughout this article.
| Term | Description |
|---|---|
| Authorization | A hold against available credit. The customer's ability to pay is checked and a specified amount is reserved without actually moving funds. |
| Capture | Finalization of the sale. The amount reserved during Authorization is transferred to the Merchant. |
| Escrow | An arrangement in which a trusted third party temporarily holds funds to secure a transaction. |
| Payer | The party providing the funds for a payment. |
| Receiver/Merchant | The party receiving the funds (the seller). |
| Operator | The entity managing and executing the payment flow, submitting transactions and covering gas costs. |
sequenceDiagram
participant Customer as Customer
participant Merchant as Merchant
participant Acquirer as Acquirer
participant Issuer as Issuer
Customer->>Merchant: 購入リクエスト
Merchant->>Acquirer: Authorization要求
Acquirer->>Issuer: 与信枠確認
Issuer-->>Acquirer: 承認(与信枠確保)
Acquirer-->>Merchant: Authorization完了
Note over Merchant: 商品発送・サービス提供
Merchant->>Acquirer: Capture要求
Acquirer->>Issuer: 売上確定
Issuer-->>Acquirer: 決済完了
Acquirer-->>Merchant: 入金
Auth & Capture in traditional credit card payments
The two phases are useful because real-world commerce involves scenarios that an immediate payment alone cannot adequately handle.
| Scenario | Description |
|---|---|
| Out of stock | An item is found to be unavailable after the order is placed and the order needs to be canceled. |
| Refund request | A customer is dissatisfied with a product and requests a refund. |
| Split shipments | Multiple products ship separately, and the customer is charged for each shipment. |
| Final tax calculation | The exact tax cannot be calculated until the delivery destination is confirmed. |
| Price adjustment | The amount needs to be revised because of a promotion or price change. |
During Authorization, the customer's ability to pay is checked and the amount is placed on hold. No funds move at this point, but the Merchant has an assurance of payment.
During Capture, some or all of the reserved amount is actually transferred to the Merchant, finalizing the payment.
This intermediate state, in which payment is secured but not yet completed, is a foundation for scalable commerce payments.
Challenges of onchain payments
Blockchain payments are well suited to peer-to-peer (P2P) transactions. A straightforward token transfer from Alice to Bob can be executed immediately by a smart contract.
However, conventional onchain payments pose the following challenges for more complex commerce flows, such as those used by online stores.
graph TB
subgraph Problem["従来の課題"]
P1[即時・最終的な送金のみ]
P2[資金のホールド機能なし]
P3[返金は別トランザクション]
P4[部分Capture不可]
end
subgraph Impact["ビジネス影響"]
I1[在庫切れ時の対応困難]
I2[Merchantのリスク増大]
I3[複雑なオーダー管理]
I4[顧客体験の低下]
end
P1 --> I1
P2 --> I2
P3 --> I3
P4 --> I4
style Problem fill:#ffcccc
style Impact fill:#ffffcc
Why conventional onchain payments were poorly suited to commerce
In other words, a simple onchain transfer lacked an intermediate state that secured a future payment without paying immediately.
Commerce Payments Protocol overview
Commerce Payments Protocol implements the Auth & Capture pattern used in traditional finance on the Base blockchain.
The protocol is built around three design principles.
Permissionless
Anyone can use the protocol as an Operator without approval from a designated administrator. A Merchant can act as its own Operator or use a third-party payment provider.
Immutable
The protocol code cannot be changed after deployment, so participants can rely on the rules remaining the same in the future.
Trust-Minimized
The Operator manages the payment flow, but the protocol's cryptographic constraints prevent it from diverting payment funds arbitrarily. Even in the worst case, its powers are limited.
graph LR
subgraph Traditional["従来型"]
T1[Payer] -->|即時送金| T2[Receiver]
end
subgraph CPP["CPP"]
C1[Payer] -->|Authorize| C2[Escrow]
C2 -->|Capture| C3[Receiver]
C2 -.->|Void/Reclaim| C1
end
style Traditional fill:#ffcccc
style CPP fill:#ccffcc
Conventional onchain payments compared with Commerce Payments Protocol
At the heart of the protocol is an escrow mechanism. During Authorize, funds move from the Payer to an escrow contract. During Capture, they move from escrow to the Receiver. These two steps reproduce the intermediate state of secured payment found in traditional financial systems onchain.
Architecture and main components
Commerce Payments Protocol consists of three main components.
graph TB
subgraph External["外部参加者"]
Operator[Operator]
Payer[Payer]
Receiver[Receiver/Merchant]
end
subgraph Protocol["CPP Core"]
ACE[AuthCaptureEscrow]
TC[Token Collectors]
TS[TokenStore]
end
Operator -->|決済フロー管理| ACE
Payer -->|署名| TC
TC -->|トークン収集| ACE
ACE -->|資金保管| TS
ACE -->|支払い| Receiver
style ACE fill:#4169E1,color:#fff
style TC fill:#32CD32,color:#fff
style TS fill:#FF8C00,color:#fff
Commerce Payments Protocol architecture
AuthCaptureEscrow
This is the main escrow contract. It manages the entire payment lifecycle.
Its responsibilities include:
- Validating payment parameters and timing constraints
- Managing payment state (authorized, captured, refunded)
- Distributing fees
- Protecting against reentrancy attacks
Every payment is defined by a PaymentInfo struct. The hash of this struct uniquely identifies the payment.
struct PaymentInfo {
address operator; // 決済フローを管理するエンティティ
address payer; // 支払者のウォレットアドレス
address receiver; // Merchantの受取アドレス
address token; // 支払いトークンのコントラクトアドレス
uint120 maxAmount; // Authorization可能な最大金額
uint48 preApprovalExpiry; // 署名の有効期限
uint48 authorizationExpiry; // Authorizationの有効期限(この後はCapture不可)
uint48 refundExpiry; // 返金の有効期限
uint16 minFeeBps; // 最小手数料(基準点)
uint16 maxFeeBps; // 最大手数料(基準点)
address feeReceiver; // 手数料受取人(0なら動的に指定可能)
uint256 salt; // 一意性を保証するためのエントロピー
}TokenStore
A TokenStore is a vault created for each Operator.
The key property of this component is liquidity isolation. If all escrow funds were held in one contract, a vulnerability could put the entire pool at risk. TokenStores are created independently for each Operator, isolating one Operator's funds from those of other Operators.
graph TB
ACE[AuthCaptureEscrow]
subgraph Stores["Operator別TokenStore"]
TS1[TokenStore A]
TS2[TokenStore B]
TS3[TokenStore C]
end
ACE --> TS1
ACE --> TS2
ACE --> TS3
style ACE fill:#4169E1,color:#fff
style TS1 fill:#FF8C00,color:#fff
style TS2 fill:#FF8C00,color:#fff
style TS3 fill:#FF8C00,color:#fff
TokenStores isolated by Operator
TokenStore has the following properties.
- Deterministic deployment using CREATE2, with the address uniquely derived from the Operator address
- Gas-efficient deployment using the minimal proxy pattern
- Callable only by AuthCaptureEscrow
Token Collector
A Token Collector is a modular component that abstracts token authorization methods.
Blockchains have several token authorization standards, each with its own characteristics. Token Collectors accommodate these differences, allowing the protocol to support multiple authorization methods without modifying its core.
The section "Abstracting authorization methods with Token Collectors" covers this in more detail.
Six payment operations
Commerce Payments Protocol offers six operations covering the entire payment lifecycle.
stateDiagram-v2
[*] --> Pending: 決済作成
Pending --> Authorized: authorize()
Pending --> Captured: charge()
Authorized --> Captured: capture()
Authorized --> Voided: void()
Authorized --> Reclaimed: reclaim()
Captured --> Refunded: refund()
Captured --> [*]: 決済完了
Voided --> [*]: キャンセル完了
Reclaimed --> [*]: 回収完了
Refunded --> [*]: 返金完了
Payment state transitions
Authorize
Authorize holds the Payer's funds in escrow to secure a future Capture.
function authorize(
PaymentInfo calldata paymentInfo,
uint256 amount,
address tokenCollector,
bytes calldata collectorData
) externalWhen this function executes, the specified amount moves from the Payer to the TokenStore. The Merchant now has assurance that the payment funds are available.
Main validation checks
- The amount does not exceed
maxAmount. - The current time is before
preApprovalExpiry. - The same payment has not already been authorized.
Capture
Capture transfers authorized funds from escrow to the Merchant and finalizes the payment.
function capture(
PaymentInfo calldata paymentInfo,
uint256 amount,
uint16 feeBps,
address feeReceiver
) externalCapture can be performed multiple times (partial capture). For example, an authorization of 1,000 USDC can be captured as 600 USDC first and 400 USDC later.
Partial capture example
初期状態: capturableAmount = 1000 USDC
1回目のCapture(600 USDC):
→ capturableAmount = 400 USDC
→ refundableAmount = 600 USDC
2回目のCapture(400 USDC):
→ capturableAmount = 0 USDC
→ refundableAmount = 1000 USDCCharge
Charge performs Authorization and Capture in a single transaction.
function charge(
PaymentInfo calldata paymentInfo,
uint256 amount,
address tokenCollector,
bytes calldata collectorData,
uint16 feeBps,
address feeReceiver
) externalFor use cases where immediate payment is appropriate, such as purchases of digital content, there is no need for two separate transactions. Charge reduces gas costs and simplifies the payment flow.
Void
The Operator cancels an authorization and returns escrowed funds to the Payer.
function void(PaymentInfo calldata paymentInfo) externalOnly the Operator can perform Void, and it can call the operation at any time. This operation is used when a payment needs to be canceled for reasons on the Merchant's side, such as unavailable stock or an order cancellation.
Reclaim
The Payer recovers their funds after the authorization expires.
function reclaim(PaymentInfo calldata paymentInfo) externalOnly the Payer can perform Reclaim, and only after authorizationExpiry. This is an important safety mechanism: if the Operator becomes inactive, or neither Capture nor Void takes place for some other reason, the Payer can recover the funds.
Refund
Refund returns captured funds to the Payer.
function refund(
PaymentInfo calldata paymentInfo,
uint256 amount,
address tokenCollector,
bytes calldata collectorData
) externalA refund requires a separate source of liquidity. Funds are obtained through a Refund Collector such as OperatorRefundCollector.
Refund window
Refunds can only be performed until refundExpiry. This gives payments an eventual point of finality and assures Merchants that their funds will be finalized after a defined period.
The Operator model and security
One of Commerce Payments Protocol's distinctive design choices is its Operator model.
The Operator's role
The Operator manages the payment flow. Its responsibilities include:
- Submitting onchain transactions and covering gas costs
- Triggering payment state transitions (authorize, capture, void, refund)
- Providing the technical interface between the blockchain and the Payer or Merchant
Anyone can become an Operator: a payment processor such as Shopify, an independent service provider, a Merchant, or even a smart contract implementing custom business logic.
Cryptographic constraints
The Operator has significant responsibilities, but its capabilities are tightly restricted by the protocol's cryptographic constraints.
graph TB
subgraph Can["Operatorができること"]
C1[決済フローのトリガー]
C2[手数料の設定(範囲内)]
C3[決済の無効化]
end
subgraph Cannot["Operatorができないこと"]
N1[資金の窃取]
N2[決済条件の変更]
N3[署名の再利用]
N4[他Operatorの決済操作]
end
style Can fill:#ccffcc
style Cannot fill:#ffcccc
Operator capabilities and restrictions
When the Payer approves a payment, they cryptographically sign all of the following information.
- The exact amount and Receiver
- The permitted fee range
- The various expiration times
- The designated Operator
This signature prevents the Operator from changing the agreed terms or reusing the signature for another payment.
Risks if the Operator is compromised
Even if an Operator acts maliciously or its private key is compromised, the possible damage is limited.
| Risk | Description |
|---|---|
| Censorship | The Operator can refuse to capture a payment or void it improperly. |
| Fee maximization | It can charge fees up to maxFeeBps. |
| Changing the fee recipient | If feeReceiver is unspecified, it can designate any address. |
The important distinction is that the Operator cannot arbitrarily steal the payment principal. The payment funds move to either the Payer or the Receiver, subject to the authorized fees described above.
Time-based protections
The protocol uses three expiration times to prevent payments from becoming stuck.
preApprovalExpiry
The signature expiration time. Once this time passes, the Payer's signature is no longer valid for a new authorization.
authorizationExpiry
The authorization expiration time. After this point, the Operator can no longer capture the funds; the Payer can instead recover them through Reclaim.
refundExpiry
The refund expiration time. Once it passes, refunds can no longer be performed and the payment becomes final.
gantt
title 決済の時間制約
dateFormat X
axisFormat %s
section 期間
署名有効期間 :active, 0, 100
Authorization有効期間 :active, 0, 200
返金可能期間 :active, 0, 300
section イベント
preApprovalExpiry :milestone, 100, 100
authorizationExpiry :milestone, 200, 200
refundExpiry :milestone, 300, 300
Relationship between the three expiration times
Abstracting authorization methods with Token Collectors
Several token authorization standards exist, each with advantages and drawbacks.
| Standard | Characteristics | Limitations |
|---|---|---|
| ERC-3009 | Single-signature UX; supported by tokens such as USDC | Limited token support |
| Permit2 | Supports arbitrary ERC-20 tokens | Requires initial setup |
| ERC-20 Approval | Available for all ERC-20 tokens | Requires a separate transaction |
| Spend Permissions | Optimized UX (Coinbase Smart Wallet) | Limited wallet support |
Commerce Payments Protocol addresses this fragmentation by introducing an abstraction layer called Token Collectors.
graph TB
ACE[AuthCaptureEscrow]
subgraph Collectors["Token Collectors"]
ERC3009[ERC3009]
Permit2[Permit2]
PreApproval[PreApproval]
SpendPerm[SpendPermission]
OpRefund[OperatorRefund]
end
ACE --> ERC3009
ACE --> Permit2
ACE --> PreApproval
ACE --> SpendPerm
ACE --> OpRefund
ERC3009 --> |USDC等| Payer1[Payer]
Permit2 --> |任意のERC-20| Payer2[Payer]
PreApproval --> |従来型承認| Payer3[Payer]
SpendPerm --> |Coinbase SW| Payer4[Payer]
OpRefund --> |返金用| Operator[Operator]
style ACE fill:#4169E1,color:#fff
Token Collector architecture
How Token Collectors work
AuthCaptureEscrow does not need to know how tokens are collected. Instead, it instructs a Token Collector to move a specified amount into a specified TokenStore, then checks whether the balance has increased correctly.
abstract contract TokenCollector {
enum CollectorType { Payment, Refund }
function collectTokens(
AuthCaptureEscrow.PaymentInfo calldata paymentInfo,
address tokenStore,
uint256 amount,
bytes calldata collectorData
) external;
function collectorType() external view virtual returns (CollectorType);
}This design has several benefits.
- When a new authorization standard emerges, a new Collector can be added without changing the core protocol.
- The Operator can choose the Collector best suited to the Payer's combination of wallet and token.
- Separating Payment Collectors from Refund Collectors prevents unused payment approvals from being repurposed for refunds.
Implemented Collectors
The protocol includes the following Collectors.
ERC3009PaymentCollector
For tokens supporting ERC-3009, such as USDC. It supports gasless signed transfers through receiveWithAuthorization and smart contract wallet signatures via ERC-6492.
Permit2PaymentCollector
Supports arbitrary ERC-20 tokens using Permit2 signature-based transfers. Users must first approve the Permit2 contract.
PreApprovalPaymentCollector
Supports the conventional ERC-20 approval flow. The Payer approves the Collector in advance, and the Collector subsequently transfers tokens using transferFrom.
SpendPermissionPaymentCollector
An optimized Collector for Coinbase Smart Wallet. It can also support recurring payments such as subscriptions.
OperatorRefundCollector
Performs refunds using the Operator's funds. The Operator approves the Collector, which then obtains the necessary liquidity from the Operator's balance when a refund is executed.
Fee system
Commerce Payments Protocol implements a flexible fee system. Fees are expressed in basis points (bps), where 10,000 bps = 100%.
Fee parameters
The PaymentInfo struct contains three fee-related fields.
| Field | Description |
|---|---|
minFeeBps |
Minimum fee rate |
maxFeeBps |
Maximum fee rate |
feeReceiver |
Fee recipient (can be specified dynamically if set to 0) |
Fee configuration patterns
Fixed rate
Set minFeeBps and maxFeeBps to the same value. For example, setting both to 250 (2.5%) means the Operator must charge a 2.5% fee.
Variable rate
Set minFeeBps to 100 (1%) and maxFeeBps to 500 (5%), and the Operator can select a fee between 1% and 5%. This is useful for marketplaces offering tiered fees based on transaction volume, for example.
Zero fees
Setting both fields to 0 prevents the Operator from charging a fee.
Configuring the fee recipient
Fixed recipient
If feeReceiver is set to a particular address, fees always go to that address.
Dynamic recipient
If feeReceiver is set to address(0), the Operator can specify any recipient at Capture time. This also helps address USDC denylist issues: if a designated recipient is blocked, another address can be selected.
Deployment information and security audits
Commerce Payments Protocol is deployed on Base Mainnet and Base Sepolia. The following information is from the original article, dated November 28, 2025.
| Contract | Address |
|---|---|
| AuthCaptureEscrow | 0xBdEA0D1bcC5966192B070Fdf62aB4EF5b4420cff |
| ERC3009PaymentCollector | 0x0E3dF9510de65469C4518D7843919c0b8C7A7757 |
| Permit2PaymentCollector | 0x992476B9Ee81d52a5BdA0622C333938D0Af0aB26 |
| PreApprovalPaymentCollector | 0x1b77ABd71FCD21fbe2398AE821Aa27D1E6B94bC6 |
| SpendPermissionPaymentCollector | 0x8d9F34934dc9619e5DC3Df27D0A40b4A744E7eAa |
| OperatorRefundCollector | 0x934907bffd0901b6A21e398B9C53A4A38F02fa5d |
Security audits
The protocol has undergone multiple audits by Spearbit and Coinbase Protocol Security.
| Audit | Date |
|---|---|
| Coinbase Protocol Security audit 1 | March 19, 2025 |
| Coinbase Protocol Security audit 2 | March 26, 2025 |
| Spearbit audit 1 | April 1, 2025 |
| Coinbase Protocol Security audit 3 | April 15, 2025 |
| Spearbit audit 2 | April 22, 2025 |
The audit reports are available in the GitHub repository's audits/ directory.
Conclusion
Commerce Payments Protocol brings the traditional Auth & Capture pattern onchain to support blockchain payments at commerce scale. Its permissionless, immutable design, cryptographically constrained Operator model, and modular Token Collectors provide flexible authorization methods and a payment infrastructure designed to be secure and easy to use for both Merchants and Payers.




