Polarex.Customers (Polarex v0.1.0)

View Source

Provides API endpoints related to customers

Summary

Functions

customer_portal_customers_add_payment_method(body, opts \\ [])

@spec customer_portal_customers_add_payment_method(
  Polarex.CustomerPaymentMethodCreate.t(),
  keyword()
) ::
  {:ok, Polarex.PaymentMethodCard.t() | Polarex.PaymentMethodGeneric.t()}
  | {:error, Polarex.HTTPValidationError.t()}

Add Customer Payment Method

Add a payment method to the authenticated customer.

Scopes: customer_portal:read customer_portal:write

customer_portal_customers_delete_payment_method(id, opts \\ [])

@spec customer_portal_customers_delete_payment_method(
  String.t(),
  keyword()
) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Delete Customer Payment Method

Delete a payment method from the authenticated customer.

Scopes: customer_portal:read customer_portal:write

customer_portal_customers_get(opts \\ [])

@spec customer_portal_customers_get(keyword()) ::
  {:ok, Polarex.CustomerPortalCustomer.t()} | :error

Get Customer

Get authenticated customer.

Scopes: customer_portal:read customer_portal:write

customer_portal_customers_get_payment_methods(opts \\ [])

@spec customer_portal_customers_get_payment_methods(keyword()) ::
  {:ok, Polarex.ListResourceUnionPaymentMethodCardPaymentMethodGeneric.t()}
  | {:error, Polarex.HTTPValidationError.t()}

Get Customer Payment Methods

Get saved payment methods of the authenticated customer.

Scopes: customer_portal:read customer_portal:write

Options

  • page: Page number, defaults to 1.
  • limit: Size of a page, defaults to 10. Maximum is 100.

customer_portal_customers_update(body, opts \\ [])

@spec customer_portal_customers_update(
  Polarex.CustomerPortalCustomerUpdate.t(),
  keyword()
) ::
  {:ok, Polarex.CustomerPortalCustomer.t()}
  | {:error, Polarex.HTTPValidationError.t()}

Update Customer

Update authenticated customer.

Scopes: customer_portal:write

customers_create(body, opts \\ [])

@spec customers_create(
  Polarex.CustomerCreate.t(),
  keyword()
) :: {:ok, Polarex.Customer.t()} | {:error, Polarex.HTTPValidationError.t()}

Create Customer

Create a customer.

Scopes: customers:write

customers_delete(id, opts \\ [])

@spec customers_delete(
  String.t(),
  keyword()
) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Delete Customer

Delete a customer.

This action cannot be undone and will immediately:

  • Cancel any active subscriptions for the customer
  • Revoke all their benefits
  • Clear any external_id

Use it only in the context of deleting a user within your own service. Otherwise, use more granular API endpoints to cancel a specific subscription or revoke certain benefits.

Note: The customers information will nonetheless be retained for historic orders and subscriptions.

Scopes: customers:write

customers_delete_external(external_id, opts \\ [])

@spec customers_delete_external(
  String.t(),
  keyword()
) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Delete Customer by External ID

Delete a customer by external ID.

Immediately cancels any active subscriptions and revokes any active benefits.

Scopes: customers:write

customers_get(id, opts \\ [])

@spec customers_get(
  String.t(),
  keyword()
) ::
  {:ok, Polarex.Customer.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Get Customer

Get a customer by ID.

Scopes: customers:read customers:write

customers_get_external(external_id, opts \\ [])

@spec customers_get_external(
  String.t(),
  keyword()
) ::
  {:ok, Polarex.Customer.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Get Customer by External ID

Get a customer by external ID.

Scopes: customers:read customers:write

customers_get_state(id, opts \\ [])

@spec customers_get_state(
  String.t(),
  keyword()
) ::
  {:ok, Polarex.CustomerState.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Get Customer State

Get a customer state by ID.

The customer state includes information about the customer's active subscriptions and benefits.

It's the ideal endpoint to use when you need to get a full overview of a customer's status.

Scopes: customers:read customers:write

customers_get_state_external(external_id, opts \\ [])

@spec customers_get_state_external(
  String.t(),
  keyword()
) ::
  {:ok, Polarex.CustomerState.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Get Customer State by External ID

Get a customer state by external ID.

The customer state includes information about the customer's active subscriptions and benefits.

It's the ideal endpoint to use when you need to get a full overview of a customer's status.

Scopes: customers:read customers:write

customers_list(opts \\ [])

@spec customers_list(keyword()) ::
  {:ok, Polarex.ListResourceCustomer.t()}
  | {:error, Polarex.HTTPValidationError.t()}

List Customers

List customers.

Scopes: customers:read customers:write

Options

  • organization_id: Filter by organization ID.
  • email: Filter by exact email.
  • query: Filter by name or email.
  • page: Page number, defaults to 1.
  • limit: Size of a page, defaults to 10. Maximum is 100.
  • sorting: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.
  • metadata: Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.

customers_update(id, body, opts \\ [])

Update Customer

Update a customer.

Scopes: customers:write

customers_update_external(external_id, body, opts \\ [])

Update Customer by External ID

Update a customer by external ID.

Scopes: customers:write