Skip to content

CB Commerce Payments Protocol (Open Source)

@lifewillbeokay@lifewillbeokay8 charts

Glossary and Definitions

The protocol provides six main functions that handle the complete payment lifecycle: authorize, capture, charge, void, reclaim and refund.

Payment Initiation

Authorize - Reserve payer funds in escrow for future capture. Enables delayed settlement while guaranteeing merchant payment upon successful authorization.

Charge - Combine authorization and capture into a single transaction for immediate payment settlement.

Payment Settlement

Capture - Transfer previously authorized funds from escrow to merchants. Supports partial captures and flexible fee distribution.

Payment Cancellation

Void - Cancel payment authorizations and return escrowed funds to payerss. Only callable by the operator, but can be used to cancel a payment at any time.

Reclaim - Allow payers to recover funds from expired authorizations. Payer-initiated safety mechanism callable only after authorization expiry.

Payment Reversal

Refund - Return previously captured funds to payers using modular refund collectors. Supports partial refunds and flexible liquidity sourcing.

PaymentInfo struct

Every payment is defined by a PaymentInfo struct containing immutable terms. A payment is uniquely identified by the hash of this struct, further hashed with the chain id and hashing contract address.

struct PaymentInfo {
    address operator;           // Entity managing the payment flow
    address payer;              // Payer's wallet address
    address receiver;           // Merchant's receiving address
    address token;              // Payment token contract
    uint120 maxAmount;          // Maximum amount that can be authorized
    uint48 preApprovalExpiry;   // When payer's willingness to authorize the payment expires
    uint48 authorizationExpiry; // When an authorized payment can no longer be captured and can now be reclaimed
    uint48 refundExpiry;        // When refunds are no longer allowed
    uint16 minFeeBps;           // Minimum fee in basis points
    uint16 maxFeeBps;           // Maximum fee in basis points
    address feeReceiver;        // Fee recipient (0 = operator sets at capture)
    uint256 salt;               // Entropy for unique payment identification
}