paymentsystem

package module
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

README

Payment System

Versioned payments, subscriptions, entitlements, and provider reconciliation for Procyon applications. The module is linked as a normal Go dependency; its code is not copied into the application.

Providers

  • Stripe: catalog-filtered prices, one-time and subscription Checkout, idempotency, customer reuse, billing portal, immediate or period-end cancellation, signed webhooks, asynchronous payments, refunds, and reconciliation.
  • Google Play: SubscriptionsV2 verification, account binding, encrypted purchase tokens, acknowledgement, authenticated Pub/Sub RTDN, voided purchases, and reconciliation.
  • Apple App Store: App Store Server Notification V2 and StoreKit 2 transaction JWS verification, OCSP checks, application/environment checks, renewal information, App Store Server API reconciliation, and ownership through appAccountToken.

Install

procyon-cli module add payment-system --provider stripe
procyon-cli module add payment-system --provider stripe,google,apple

Copy docs/products.example.json to the application configuration directory, replace all provider IDs, and set PAYMENT_PRODUCTS_FILE. The module refuses to start if a selected provider, product catalog, credential, or required security setting is missing.

Then run application migrations:

go run . -migrate=true

Migrations are ordered and recorded in payment_module_migrations. Disabling the plugin removes its runtime wiring but intentionally preserves payment data.

Security contract

  • Every checkout request requires an Idempotency-Key header.
  • Return URLs must match PAYMENT_ALLOWED_RETURN_ORIGINS.
  • Only products declared in the server-side catalog can be sold or verified.
  • A verified external subscription cannot be reassigned to another identity.
  • Google purchase tokens are encrypted at rest and indexed by SHA-256 digest.
  • Google Pub/Sub pushes require an OIDC bearer token with the configured audience.
  • Apple transactions require appAccountToken to equal the authenticated Procyon identity ID.
  • Webhooks use atomic processing leases and can recover after interrupted processing; a stale worker cannot finalize a lease taken by another worker.

See configuration, API, Stripe web integration, typed events, operations, and data handling. The provider flow documentation shown in Postman's module Overview is kept in docs/postman/overview.md.

Verification

go test -race ./...
go vet ./...

CI also runs migration tests against PostgreSQL and MySQL. Live sandbox tests use real provider credentials and are described in docs/OPERATIONS.md.

Documentation

Index

Constants

View Source
const Name = "payment-system"

Variables

This section is empty.

Functions

Types

type Config

type Config struct {
	Providers []string          `json:"providers"`
	Values    map[string]string `json:"values"`
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) Migrate

func (p *Plugin) Migrate(context.Context) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Policies

func (p *Plugin) Policies() []authz.Policy

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(routes coreplugins.Routes)

func (*Plugin) Shutdown

func (p *Plugin) Shutdown(context.Context) error

func (*Plugin) Start added in v0.5.0

func (p *Plugin) Start(ctx context.Context) error

Directories

Path Synopsis
Package contracts contains the stable event contracts published by the payment-system module.
Package contracts contains the stable event contracts published by the payment-system module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL