Skip to content

Conversation

@spencerstock
Copy link
Collaborator

@spencerstock spencerstock commented Nov 24, 2025

What changed? Why?

Added payWithToken function to enable ERC20 token payments across multiple chains, extending beyond the existing USDC-only payment functionality.

Key changes:

  • New payWithToken API: Supports ERC20 token transfers with customizable paymaster configuration across multiple chains (Base, Optimism, Arbitrum, Polygon, Avalanche, BSC)
  • Token registry: Whitelisted support for USDC, USDT, DAI, and EURC with automatic symbol-to-address resolution
  • Enhanced getPaymentStatus: Automatically extracts token transfer details from transaction logs with proper chain context
  • Paymaster integration: Flexible paymaster URL configuration per chain for gasless transactions
  • Telemetry: Added event tracking for payWithToken lifecycle (started, completed, error)
  • Validation utilities: Base unit amount validation

How was this tested?

Test coverage for:

  • payWithToken function with valid/invalid inputs
  • Token registry address resolution
  • Payment status checking with token transfer detection

How can reviewers manually test these changes?

  1. Navigate to the pay playground testapp
  2. Scroll to the "payWithToken Function" section
  3. Configure token, amount, recipient, and paymaster URL
  4. Execute payment and verify transaction completes
  5. Check getPaymentStatus section auto-populates with transaction ID
  6. Verify payment status displays token amount, symbol, and recipient

Demo/screenshots

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Nov 24, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

- Add PaymentSDKConfig type for advanced SDK configuration
- Remove redundant walletUrl from PaymentOptions and SubscriptionOptions
- Update pay() and subscribe() to accept sdkConfig parameter
- Update createEphemeralSDK to merge sdkConfig with defaults
- Update executePaymentWithSDK signature to accept sdkConfig
- Add test coverage for sdkConfig parameter
- Fix existing tests to match new function signatures
@spencerstock spencerstock marked this pull request as ready for review November 25, 2025 06:47
@spencerstock spencerstock marked this pull request as draft November 25, 2025 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants