Skip to main content
The Client SDK is experimental. APIs will change as the refund and dispute system design evolves.
The @x402r/client package provides payer-side methods for interacting with X402r payments: requesting refunds, freezing payments, and querying escrow state.

Setup

import { X402rClient } from '@x402r/client';
import { getNetworkConfig } from '@x402r/core';

const networkConfig = getNetworkConfig('eip155:84532')!;

const client = new X402rClient({
  publicClient,
  walletClient,
  operatorAddress: '0x...', // Your PaymentOperator address
  refundRequestAddress: networkConfig.refundRequest,
  escrowAddress: networkConfig.authCaptureEscrow,
});

Available Methods

The Client SDK currently supports:
  • requestRefund() — Submit a refund request for a payment in escrow
  • getRefundStatus() — Check the status of a refund request
  • freezePayment() — Freeze a payment to prevent release during a dispute
  • isFrozen() — Check if a payment is frozen
  • isDuringEscrowPeriod() — Check if a payment is still in its escrow window
  • getAuthorizationTime() — Get when a payment was authorized
  • getPaymentState() — Derive the lifecycle state of a payment
  • paymentExists() — Check if a payment has been authorized
  • isInEscrow() — Check if a payment has capturable funds
  • getPaymentDetails() — Retrieve full PaymentInfo from event logs
  • getPayerPayments() — List all payments for the connected wallet
  • submitEvidence() — Attach evidence (IPFS CID) to a refund request
  • getEvidence() — Retrieve a single evidence entry by index
  • getAllEvidence() — Retrieve all evidence for a refund request

Try It Now

The easiest way to try client features is with the client-cli example, which provides a command-line interface for all client operations:

client-cli

CLI tool for payers to pay, preview-fee, request refunds, freeze payments, and check status.

Next Steps

Examples

See all working examples including the full payment flow.

Deploy Operator

Deploy a PaymentOperator to test client operations against.