PolarExpress.Services.SubscriptionsService (polar_express v0.1.5)

Copy Markdown View Source

Subscriptions

Subscriptions API operations.

Summary

Functions

create_subscription(client, params \\ %{}, opts \\ [])

@spec create_subscription(PolarExpress.Client.t(), map(), keyword()) ::
  {:ok, PolarExpress.Schemas.Subscription.t()}
  | {:error, PolarExpress.Error.t()}

Create Subscription

Create a subscription programmatically.

This endpoint only allows to create subscription on free products. For paid products, use the checkout flow.

No initial order will be created and no confirmation email will be sent.

Scopes: subscriptions:write

See PolarExpress.Params.SubscriptionsCreateSubscriptionParams for parameter details.

export_subscriptions(client, params \\ %{}, opts \\ [])

@spec export_subscriptions(PolarExpress.Client.t(), map(), keyword()) ::
  {:ok, term()} | {:error, PolarExpress.Error.t()}

Export Subscriptions

Export subscriptions as a CSV file.

Scopes: subscriptions:read subscriptions:write

See PolarExpress.Params.SubscriptionsExportSubscriptionsParams for parameter details.

get_subscription(client, id, params \\ %{}, opts \\ [])

@spec get_subscription(PolarExpress.Client.t(), String.t(), map(), keyword()) ::
  {:ok, PolarExpress.Schemas.Subscription.t()}
  | {:error, PolarExpress.Error.t()}

Get Subscription

Get a subscription by ID.

Scopes: subscriptions:read subscriptions:write

See PolarExpress.Params.SubscriptionsGetSubscriptionParams for parameter details.

list_subscriptions(client, params \\ %{}, opts \\ [])

@spec list_subscriptions(PolarExpress.Client.t(), map(), keyword()) ::
  {:ok, PolarExpress.ListObject.t()} | {:error, PolarExpress.Error.t()}

List Subscriptions

List subscriptions.

Scopes: subscriptions:read subscriptions:write

See PolarExpress.Params.SubscriptionsListSubscriptionsParams for parameter details.

revoke_subscription(client, id, params \\ %{}, opts \\ [])

@spec revoke_subscription(PolarExpress.Client.t(), String.t(), map(), keyword()) ::
  {:ok, PolarExpress.Schemas.Subscription.t()}
  | {:error, PolarExpress.Error.t()}

Revoke Subscription

Revoke a subscription, i.e cancel immediately.

Scopes: subscriptions:write

See PolarExpress.Params.SubscriptionsRevokeSubscriptionParams for parameter details.

update_subscription(client, id, params \\ %{}, opts \\ [])

@spec update_subscription(PolarExpress.Client.t(), String.t(), map(), keyword()) ::
  {:ok, PolarExpress.Schemas.Subscription.t()}
  | {:error, PolarExpress.Error.t()}

Update Subscription

Update a subscription.

Scopes: subscriptions:write

See PolarExpress.Params.SubscriptionsUpdateSubscriptionParams for parameter details.