MPP.Intents.Subscription (mpp v0.16.0)

Copy Markdown View Source

Shared recurring-subscription intent schema.

The schema is payment-method neutral: Tempo and Stripe subscription methods consume the same wire fields while applying their own method constraints.

API Functions

FunctionArityDescriptionParam Kinds
from_request1Parse a subscription intent from normative camelCase wire keys.-
to_request1Serialize a subscription intent with normative camelCase wire keys.-
new1Create a validated shared subscription intent.-

Summary

Functions

Parse a subscription intent from normative camelCase wire keys.

Create a validated shared subscription intent.

Serialize a subscription intent with normative camelCase wire keys.

Types

period_unit()

@type period_unit() :: :day | :week | :month

t()

@type t() :: %MPP.Intents.Subscription{
  amount: String.t(),
  currency: String.t(),
  description: String.t() | nil,
  external_id: String.t() | nil,
  method_details: map() | nil,
  period_count: String.t(),
  period_unit: period_unit(),
  recipient: String.t() | nil,
  subscription_expires: String.t() | nil
}

Functions

from_request(request)

@spec from_request(map()) :: {:ok, t()} | {:error, atom()}
@spec from_request(term()) :: {:error, :missing_required_fields}

Parse a subscription intent from normative camelCase wire keys.

# descripex:contract
%{}

new(opts)

@spec new(keyword()) :: {:ok, t()} | {:error, atom()}

Create a validated shared subscription intent.

# descripex:contract
%{}

to_request(subscription)

@spec to_request(t()) :: map()

Serialize a subscription intent with normative camelCase wire keys.

# descripex:contract
%{}