Documentation
¶
Index ¶
- type PaymentSystemController
- func (c *PaymentSystemController) CancelSubscription(ctx echo.Context) error
- func (c *PaymentSystemController) CreateCheckout(ctx echo.Context) error
- func (c *PaymentSystemController) CreatePortalSession(ctx echo.Context) error
- func (c *PaymentSystemController) CreateSubscription(ctx echo.Context) error
- func (c *PaymentSystemController) Entitlement(ctx echo.Context) error
- func (c *PaymentSystemController) FailedWebhooks(ctx echo.Context) error
- func (c *PaymentSystemController) Notify(ctx echo.Context) error
- func (c *PaymentSystemController) PaymentHistory(ctx echo.Context) error
- func (c *PaymentSystemController) PriceList(ctx echo.Context) error
- func (c *PaymentSystemController) ProviderStatus(ctx echo.Context) error
- func (c *PaymentSystemController) Reconcile(ctx echo.Context) error
- func (c *PaymentSystemController) RetryWebhook(ctx echo.Context) error
- func (c *PaymentSystemController) SubscriptionList(ctx echo.Context) error
- func (c *PaymentSystemController) VerifyStorePurchase(ctx echo.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaymentSystemController ¶
type PaymentSystemController struct {
// contains filtered or unexported fields
}
func NewPaymentSystemController ¶
func NewPaymentSystemController(service paymentSystemService, logger *zap.Logger) *PaymentSystemController
func (*PaymentSystemController) CancelSubscription ¶
func (c *PaymentSystemController) CancelSubscription(ctx echo.Context) error
CancelSubscription cancels an owned provider subscription immediately or at the end of its current billing period.
Stripe supports this operation. Set cancel_at_period_end to true to retain access until current_period_end. The endpoint returns 204 on success.
func (*PaymentSystemController) CreateCheckout ¶
func (c *PaymentSystemController) CreateCheckout(ctx echo.Context) error
CreateCheckout creates a one-time Stripe Checkout session for the signed-in identity and returns the hosted checkout URL.
Send a unique Idempotency-Key header with every logical purchase attempt. The price must be present in the payment catalog and the success and cancel URLs must match the configured return URL allowlist.
func (*PaymentSystemController) CreatePortalSession ¶
func (c *PaymentSystemController) CreatePortalSession(ctx echo.Context) error
CreatePortalSession creates a Stripe Billing Portal session for the signed-in identity and returns its short-lived URL.
The identity must already be associated with a Stripe customer. return_url must match the configured allowlist.
func (*PaymentSystemController) CreateSubscription ¶
func (c *PaymentSystemController) CreateSubscription(ctx echo.Context) error
CreateSubscription creates a recurring Stripe Checkout session for the signed-in identity and returns the hosted checkout URL.
Send a unique Idempotency-Key header. A conflicting active subscription can return payment_subscription_active. Store subscriptions are activated with VerifyStorePurchase instead of this endpoint.
func (*PaymentSystemController) Entitlement ¶ added in v0.3.0
func (c *PaymentSystemController) Entitlement(ctx echo.Context) error
Entitlement resolves whether the signed-in identity currently has access to a plan.
Pass plan_code to check a specific product entitlement or omit it to resolve any active entitlement. The response includes provider, status, and expiry information when access is active.
func (*PaymentSystemController) FailedWebhooks ¶ added in v0.3.0
func (c *PaymentSystemController) FailedWebhooks(ctx echo.Context) error
FailedWebhooks returns provider events that could not be processed and may require an operator retry.
This is an admin endpoint. Pagination uses limit and offset. last_error is diagnostic data and must not be exposed to public clients.
func (*PaymentSystemController) Notify ¶
func (c *PaymentSystemController) Notify(ctx echo.Context) error
Notify receives provider-signed payment events and updates local payment and subscription state.
This public endpoint is intended only for provider delivery. Stripe uses the Stripe-Signature header, Google uses an OIDC Authorization bearer token, and Apple sends a signedPayload body. The raw payload limit is 256 KiB.
func (*PaymentSystemController) PaymentHistory ¶ added in v0.3.0
func (c *PaymentSystemController) PaymentHistory(ctx echo.Context) error
PaymentHistory returns payment events owned by the signed-in identity.
Entries cover one-time purchases, recurring charges, refunds, disputes, and cancellations across all enabled providers. Pagination uses limit and offset.
func (*PaymentSystemController) PriceList ¶
func (c *PaymentSystemController) PriceList(ctx echo.Context) error
PriceList returns the configured, purchasable products for a provider.
This public endpoint only exposes products allowed by the application's payment catalog. Use stripe, google, or apple as the provider path value. Amounts use minor currency units, for example 4999 means PLN 49.99.
func (*PaymentSystemController) ProviderStatus ¶ added in v0.3.0
func (c *PaymentSystemController) ProviderStatus(ctx echo.Context) error
ProviderStatus returns operational readiness and aggregate request metrics for enabled payment providers.
This is an admin endpoint. It never returns provider credentials or secrets.
func (*PaymentSystemController) Reconcile ¶ added in v0.3.0
func (c *PaymentSystemController) Reconcile(ctx echo.Context) error
Reconcile compares stored subscriptions with every enabled provider and repairs stale subscription state.
This is an admin recovery operation. Normal synchronization should happen through webhooks and background reconciliation. The endpoint returns 204.
func (*PaymentSystemController) RetryWebhook ¶ added in v0.3.0
func (c *PaymentSystemController) RetryWebhook(ctx echo.Context) error
RetryWebhook reprocesses one failed webhook identified by provider and provider event ID.
This is an admin endpoint. Retries are idempotent and return 204 after the event has been accepted and processed successfully.
func (*PaymentSystemController) SubscriptionList ¶
func (c *PaymentSystemController) SubscriptionList(ctx echo.Context) error
SubscriptionList returns subscriptions owned by the signed-in identity.
Results may contain Stripe, Google Play, and Apple subscriptions. Pagination uses limit and offset; limit must be between 1 and 100 when provided.
func (*PaymentSystemController) VerifyStorePurchase ¶
func (c *PaymentSystemController) VerifyStorePurchase(ctx echo.Context) error
VerifyStorePurchase verifies and records a Google Play purchase token or an Apple StoreKit 2 signed transaction for the signed-in identity.
Use google or apple as the provider path value. Google requests require product_id and purchase_token; Apple requests require signed_payload. The endpoint returns 204 when verification succeeds.