Skip to content

payments: new package skeleton + PaymentBackend interface #1028

@willgriffin

Description

@willgriffin

Parent

#1027

What to build

New @happyvertical/payments SDK package. Defines the PaymentBackend provider abstraction and ships the package scaffolding (no adapters yet — those are sibling issues).

Mirrors the shape of @happyvertical/ai — one interface, many adapter implementations. Pure provider integration; no SMRT, no DB, no opinions about persistence.

Shape

Package: packages/payments published as @happyvertical/payments.

The PaymentBackend interface must provide:

  • Identity and capability declaration: stable id, settlement currency, chain identifier, x402Capable: boolean, typical confirmation latency, supportsRefunds: boolean, settlement-shape flag (address-based vs URL-based — fiat backends return checkout URLs, not crypto addresses)
  • createPaymentOption(input) — given a quote id, USD amount, expiry, return a PaymentOption (unique pay-to address or checkout URL, native amount, optional memo)
  • watchPayment(input) — emit/poll for payment status against a previously-created option
  • getStatus(quoteId, payTo) — idempotent "what is the state of this quote's option"
  • verifyX402Proof?(input) — for x402-capable backends only; given an X-Payment header and a quote, verify on-chain
  • sendPayout(input) — send native-currency payout to a destination address (or initiate via the backend's payout API for fiat)

Conformance tests: a shared test suite that any adapter can run against to prove it satisfies the interface.

Acceptance criteria

  • packages/payments directory with proper package.json, tsconfig, build config
  • PaymentBackend interface and associated types exported
  • Conformance test suite scaffolded (can be empty assertions for now; adapter issues will fill them in)
  • Released to npm as @happyvertical/payments
  • No external runtime dependencies beyond what the abstraction itself needs

Blocked by

None — can start immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions