Skip to content

Integrate pingpay.io for payments #120

@petersalomonsen

Description

@petersalomonsen

Summary

Integrate PingPay for treasury subscription payments, enabling Trezu monetization.

Goals

  1. Pay in any token - Treasury members pay subscriptions using any token they have
  2. Receive in USDC - Trezu always receives stable USDC (configured in PingPay dashboard)
  3. Upfront payments - 3, 6, or 12 month subscription tiers
  4. Invoice generation - Provide invoice documents on request
  5. Track paid periods - Know if a treasury's subscription is active/expired

Why PingPay?

  • Powered by NEAR Intents (same infrastructure Trezu already uses)
  • No custody risk - payments flow directly through the protocol
  • Cross-chain support - users can pay from multiple chains
  • Planning to add subscriptions and cards in the future

Technical Approach

Backend API Endpoints

  • GET /api/subscriptions/plans - List available plans
  • GET /api/subscriptions/status?account_id=... - Check subscription status
  • POST /api/subscriptions/checkout - Create PingPay checkout session
  • GET /api/subscriptions/callback - Handle payment redirect

Payment Flow

  1. User selects plan → clicks Subscribe
  2. Backend creates checkout session via PingPay API
  3. User redirected to PingPay checkout (pays in any token)
  4. PingPay converts to USDC via NEAR Intents
  5. User redirected back with payment status
  6. Backend activates subscription

Database

  • subscription_plans - Configurable tiers with pricing
  • treasury_subscriptions - Links treasuries to active plans
  • subscription_payments - Payment records with PingPay tracking
  • subscription_invoices - Generated invoices

Resources

Tasks

  • Database migration for subscription tables
  • Backend API endpoints
  • PingPay client integration
  • Mock PingPay service for sandbox testing
  • Frontend subscription tab in settings
  • Invoice generation
  • Tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions