MPP.Methods.Stripe.Subscription (mpp v0.16.0)

Copy Markdown View Source

Stripe Billing activation, renewal accounting, and cancellation for the shared subscription intent.

Implements the constrained fixed-price profile from draft-stripe-subscription-00: one Customer, one recurring Price, one quantity-one Subscription, and synchronously paid invoices mapped onto locally persisted canonical periods.

Summary

Functions

Schedule cancellation at the end of the last durably paid billing period.

Return the public Stripe subscription challenge fields.

Validate and durably record a paid Stripe renewal invoice.

Validate Stripe subscription configuration at Plug initialization.

Activate a Stripe subscription and verify its synchronously paid first invoice.

Functions

cancel(subscription_id, config)

@spec cancel(String.t(), map()) ::
  {:ok, MPP.Subscription.Record.t()} | {:error, MPP.Errors.t()}

Schedule cancellation at the end of the last durably paid billing period.

challenge_method_details(subscription)

@spec challenge_method_details(MPP.Intents.Subscription.t()) :: map()

Return the public Stripe subscription challenge fields.

process_invoice(event_id, invoice_id, config)

@spec process_invoice(String.t(), String.t(), map()) ::
  {:ok, MPP.Receipt.t()} | {:error, MPP.Errors.t()}

Validate and durably record a paid Stripe renewal invoice.

validate_config!(config)

@spec validate_config!(map()) :: :ok

Validate Stripe subscription configuration at Plug initialization.

verify(payload, subscription)

@spec verify(map(), MPP.Intents.Subscription.t()) ::
  {:ok, MPP.Receipt.t()} | {:error, MPP.Errors.t()}

Activate a Stripe subscription and verify its synchronously paid first invoice.