Provides API endpoints related to mcp
Summary
Functions
Get Customer Meter
List Customer Meters
Create Customer
Delete Customer
Delete Customer by External ID
Export Customers
Get Customer
Get Customer by External ID
Get Customer State
Get Customer State by External ID
List Customers
Update Customer
Update Customer by External ID
Create Member
Delete Member
Delete Member by External ID
Get Member
Get Member by External ID
List Members
Update Member
Update Member by External ID
Create Metric Dashboard
Delete Metric Dashboard
Export Metrics
Get Metrics
Get Metric Dashboard
Get Metrics Limits
List Metric Dashboards
Update Metric Dashboard
Export Orders
Generate Order Invoice
Get Order
Get Order Invoice
List Orders
Get Order Receipt
Update Order
Get Payment
List Payments
Create Product
Get Product
List Products
Update Product
Update Product Benefits
Create Subscription
Export Subscriptions
Get Subscription
List Subscriptions
Revoke Subscription
Update Subscription
Functions
@spec customer_meters_get(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.CustomerMeter.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Customer Meter
Get a customer meter by ID.
Scopes: customer_meters:read
@spec customer_meters_list(opts :: keyword()) :: {:ok, Polarex.ListResourceCustomerMeter.t()} | {:error, Polarex.HTTPValidationError.t()}
List Customer Meters
List customer meters.
Scopes: customer_meters:read
Options
organization_id: Filter by organization ID.customer_id: Filter by customer ID.external_customer_id: Filter by external customer ID.meter_id: Filter by meter ID.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.
@spec customers_create( body :: Polarex.CustomerIndividualCreate.t() | Polarex.CustomerTeamCreate.t(), opts :: keyword() ) :: {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()} | {:error, Polarex.HTTPValidationError.t()}
Create Customer
Create a customer.
Scopes: customers:write
Request Body
Content Types: application/json
@spec customers_delete(id :: String.t(), opts :: 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.
Set anonymize=true to also anonymize PII for GDPR compliance.
Scopes: customers:write
Options
anonymize: If true, also anonymize the customer's personal data for GDPR compliance. This replaces email with a hashed version, hashes name and billing name (name preserved for businesses with tax_id), clears billing address, and removes OAuth account data.
@spec customers_delete_external(external_id :: String.t(), opts :: 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.
Set anonymize=true to also anonymize PII for GDPR compliance.
Scopes: customers:write
Options
anonymize: If true, also anonymize the customer's personal data for GDPR compliance.
@spec customers_export(opts :: keyword()) :: {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
Export Customers
Export customers as a CSV file.
Scopes: customers:read customers:write
Options
organization_id: Filter by organization ID.
@spec customers_get(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Customer
Get a customer by ID.
Scopes: customers:read customers:write
@spec customers_get_external(external_id :: String.t(), opts :: keyword()) :: {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Customer by External ID
Get a customer by external ID.
Scopes: customers:read customers:write
@spec customers_get_state(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.CustomerStateIndividual.t() | Polarex.CustomerStateTeam.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
@spec customers_get_state_external(external_id :: String.t(), opts :: keyword()) :: {:ok, Polarex.CustomerStateIndividual.t() | Polarex.CustomerStateTeam.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
@spec customers_list(opts :: 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, email, or external ID.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 thedeepObjectstyle, e.g.?metadata[key]=value.
@spec customers_update( id :: String.t(), body :: Polarex.CustomerUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Customer
Update a customer.
Scopes: customers:write
Request Body
Content Types: application/json
@spec customers_update_external( external_id :: String.t(), body :: Polarex.CustomerUpdateExternalID.t(), opts :: keyword() ) :: {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Customer by External ID
Update a customer by external ID.
Scopes: customers:write
Request Body
Content Types: application/json
@spec members_create_member(body :: Polarex.MemberCreate.t(), opts :: keyword()) :: {:ok, Polarex.Member.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Create Member
Create a new member for a customer.
Only B2B customers with the member management feature enabled can add members. The authenticated user or organization must have access to the customer's organization.
Scopes: members:write
Request Body
Content Types: application/json
@spec members_delete_member(id :: String.t(), opts :: keyword()) :: :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Delete Member
Delete a member.
The authenticated user or organization must have access to the member's organization.
Scopes: members:write
@spec members_delete_member_by_external_id( external_id :: String.t(), opts :: keyword() ) :: :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Delete Member by External ID
Delete a member by external ID. One of customer_id or external_customer_id must be specified.
Scopes: members:write
Options
customer_id: The customer ID.external_customer_id: The customer external ID.
@spec members_get_member(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.Member.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Member
Get a member by ID.
The authenticated user or organization must have access to the member's organization.
Scopes: members:read members:write
@spec members_get_member_by_external_id(external_id :: String.t(), opts :: keyword()) :: {:ok, Polarex.Member.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Member by External ID
Get a member by external ID. One of customer_id or external_customer_id must be specified.
Scopes: members:read members:write
Options
customer_id: The customer ID.external_customer_id: The customer external ID.
@spec members_list_members(opts :: keyword()) :: {:ok, Polarex.ListResourceMember.t()} | {:error, Polarex.HTTPValidationError.t()}
List Members
List members with optional customer ID filter.
Scopes: members:read members:write
Options
customer_id: Filter by customer ID.external_customer_id: Filter by customer external ID.role: Filter by member role.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.
@spec members_update_member( id :: String.t(), body :: Polarex.MemberUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.Member.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Member
Update a member.
Only name and role can be updated. The authenticated user or organization must have access to the member's organization.
Scopes: members:write
Request Body
Content Types: application/json
@spec members_update_member_by_external_id( external_id :: String.t(), body :: Polarex.MemberUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.Member.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Member by External ID
Update a member by external ID. One of customer_id or external_customer_id must be specified.
Scopes: members:write
Options
customer_id: The customer ID.external_customer_id: The customer external ID.
Request Body
Content Types: application/json
@spec metrics_create_dashboard( body :: Polarex.MetricDashboardCreate.t(), opts :: keyword() ) :: {:ok, Polarex.MetricDashboardSchema.t()} | {:error, Polarex.HTTPValidationError.t()}
Create Metric Dashboard
Create a user-defined metric dashboard.
Scopes: metrics:write
Request Body
Content Types: application/json
@spec metrics_delete_dashboard(id :: String.t(), opts :: keyword()) :: :ok | {:error, Polarex.HTTPValidationError.t()}
Delete Metric Dashboard
Delete a user-defined metric dashboard.
Scopes: metrics:write
@spec metrics_export(opts :: keyword()) :: {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
Export Metrics
Export metrics as a CSV file.
Scopes: metrics:read
Options
start_date: Start date.end_date: End date.timezone: Timezone to use for the timestamps. Default is UTC.interval: Interval between two timestamps.organization_id: Filter by organization ID.product_id: Filter by product ID.billing_type: Filter by billing type.recurringwill filter data corresponding to subscriptions creations or renewals.one_timewill filter data corresponding to one-time purchases.customer_id: Filter by customer ID.metrics: List of metric slugs to include in the export. If not provided, all metrics are exported.
@spec metrics_get(opts :: keyword()) :: {:ok, Polarex.MetricsResponse.t()} | {:error, Polarex.HTTPValidationError.t()}
Get Metrics
Get metrics about your orders and subscriptions.
Currency values are output in cents.
Scopes: metrics:read
Options
start_date: Start date.end_date: End date.timezone: Timezone to use for the timestamps. Default is UTC.interval: Interval between two timestamps.organization_id: Filter by organization ID.product_id: Filter by product ID.billing_type: Filter by billing type.recurringwill filter data corresponding to subscriptions creations or renewals.one_timewill filter data corresponding to one-time purchases.customer_id: Filter by customer ID.metrics: List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned.
@spec metrics_get_dashboard(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.MetricDashboardSchema.t()} | {:error, Polarex.HTTPValidationError.t()}
Get Metric Dashboard
Get a user-defined metric dashboard by ID.
Scopes: metrics:read
@spec metrics_limits(opts :: keyword()) :: {:ok, Polarex.MetricsLimits.t()} | :error
Get Metrics Limits
Get the interval limits for the metrics endpoint.
Scopes: metrics:read
@spec metrics_list_dashboards(opts :: keyword()) :: {:ok, [Polarex.MetricDashboardSchema.t()]} | {:error, Polarex.HTTPValidationError.t()}
List Metric Dashboards
List user-defined metric dashboards.
Scopes: metrics:read
Options
organization_id: Filter by organization ID.
@spec metrics_update_dashboard( id :: String.t(), body :: Polarex.MetricDashboardUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.MetricDashboardSchema.t()} | {:error, Polarex.HTTPValidationError.t()}
Update Metric Dashboard
Update a user-defined metric dashboard.
Scopes: metrics:write
Request Body
Content Types: application/json
@spec orders_export(opts :: keyword()) :: {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
Export Orders
Export orders as a CSV file.
Scopes: orders:read
Options
organization_id: Filter by organization ID.product_id: Filter by product ID.
@spec orders_generate_invoice(id :: String.t(), opts :: keyword()) :: {:ok, map()} | {:error, Polarex.MissingInvoiceBillingDetails.t() | Polarex.NotPaidOrder.t()}
Generate Order Invoice
Trigger generation of an order's invoice.
Scopes: orders:read
@spec orders_get(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.Order.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Order
Get an order by ID.
Scopes: orders:read
@spec orders_invoice(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.OrderInvoice.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Order Invoice
Get an order's invoice data.
Scopes: orders:read
@spec orders_list(opts :: keyword()) :: {:ok, Polarex.ListResourceOrder.t()} | {:error, Polarex.HTTPValidationError.t()}
List Orders
List orders.
Scopes: orders:read
Options
organization_id: Filter by organization ID.product_id: Filter by product ID.product_billing_type: Filter by product billing type.recurringwill filter data corresponding to subscriptions creations or renewals.one_timewill filter data corresponding to one-time purchases.discount_id: Filter by discount ID.customer_id: Filter by customer ID.external_customer_id: Filter by customer external ID.checkout_id: Filter by checkout ID.subscription_id: Filter by subscription ID.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 thedeepObjectstyle, e.g.?metadata[key]=value.
@spec orders_receipt(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.OrderReceipt.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Order Receipt
Get a presigned URL to download an order's receipt PDF.
Scopes: orders:read
@spec orders_update( id :: String.t(), body :: Polarex.OrderUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.Order.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Order
Update an order.
Scopes: orders:write
Request Body
Content Types: application/json
@spec organization_access_tokens_create( body :: Polarex.OrganizationAccessTokenCreate.t(), opts :: keyword() ) :: {:ok, Polarex.OrganizationAccessTokenCreateResponse.t()} | {:error, Polarex.HTTPValidationError.t()}
Create
Scopes: organization_access_tokens:write
Request Body
Content Types: application/json
@spec organization_access_tokens_delete(id :: String.t(), opts :: keyword()) :: :ok | {:error, Polarex.HTTPValidationError.t()}
Delete
Scopes: organization_access_tokens:write
@spec organization_access_tokens_list(opts :: keyword()) :: {:ok, Polarex.ListResourceOrganizationAccessToken.t()} | {:error, Polarex.HTTPValidationError.t()}
List
List organization access tokens.
Scopes: organization_access_tokens:read organization_access_tokens:write
Options
organization_id: Filter by organization ID.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.
@spec organization_access_tokens_update( id :: String.t(), body :: Polarex.OrganizationAccessTokenUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.OrganizationAccessToken.t()} | {:error, Polarex.HTTPValidationError.t()}
Update
Scopes: organization_access_tokens:write
Request Body
Content Types: application/json
@spec payments_get(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.CardPayment.t() | Polarex.GenericPayment.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Payment
Get a payment by ID.
Scopes: payments:read
@spec payments_list(opts :: keyword()) :: {:ok, Polarex.ListResourcePayment.t()} | {:error, Polarex.HTTPValidationError.t()}
List Payments
List payments.
Scopes: payments:read
Options
organization_id: Filter by organization ID.checkout_id: Filter by checkout ID.order_id: Filter by order ID.status: Filter by payment status.method: Filter by payment method.customer_email: Filter by customer 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.
@spec products_create( body :: Polarex.ProductCreateOneTime.t() | Polarex.ProductCreateRecurring.t(), opts :: keyword() ) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t()}
Create Product
Create a product.
Scopes: products:write
Request Body
Content Types: application/json
@spec products_get(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Product
Get a product by ID.
Scopes: products:read products:write
@spec products_list(opts :: keyword()) :: {:ok, Polarex.ListResourceProduct.t()} | {:error, Polarex.HTTPValidationError.t()}
List Products
List products.
Scopes: products:read products:write
Options
id: Filter by product ID.organization_id: Filter by organization ID.query: Filter by product name.is_archived: Filter on archived products.is_recurring: Filter on recurring products. Iftrue, only subscriptions tiers are returned. Iffalse, only one-time purchase products are returned.benefit_id: Filter products granting specific benefit.visibility: Filter by visibility.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 thedeepObjectstyle, e.g.?metadata[key]=value.
@spec products_update( id :: String.t(), body :: Polarex.ProductUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.NotPermitted.t() | Polarex.ResourceNotFound.t()}
Update Product
Update a product.
Scopes: products:write
Request Body
Content Types: application/json
@spec products_update_benefits( id :: String.t(), body :: Polarex.ProductBenefitsUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.NotPermitted.t() | Polarex.ResourceNotFound.t()}
Update Product Benefits
Update benefits granted by a product.
Scopes: products:write
Request Body
Content Types: application/json
@spec subscriptions_create( body :: Polarex.SubscriptionCreateCustomer.t() | Polarex.SubscriptionCreateExternalCustomer.t(), opts :: keyword() ) :: {:ok, Polarex.Subscription.t()} | {:error, Polarex.HTTPValidationError.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
Request Body
Content Types: application/json
@spec subscriptions_export(opts :: keyword()) :: {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
Export Subscriptions
Export subscriptions as a CSV file.
Scopes: subscriptions:read subscriptions:write
Options
organization_id: Filter by organization ID.
@spec subscriptions_get(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.Subscription.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Subscription
Get a subscription by ID.
Scopes: subscriptions:read subscriptions:write
@spec subscriptions_list(opts :: keyword()) :: {:ok, Polarex.ListResourceSubscription.t()} | {:error, Polarex.HTTPValidationError.t()}
List Subscriptions
List subscriptions.
Scopes: subscriptions:read subscriptions:write
Options
organization_id: Filter by organization ID.product_id: Filter by product ID.customer_id: Filter by customer ID.external_customer_id: Filter by customer external ID.discount_id: Filter by discount ID.active: Filter by active or inactive subscription.cancel_at_period_end: Filter by subscriptions that are set to cancel at period end.customer_cancellation_reason: Filter by customer cancellation reason.canceled_at_after: Filter by cancellation date (after or equal to).canceled_at_before: Filter by cancellation date (before or equal to).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 thedeepObjectstyle, e.g.?metadata[key]=value.
@spec subscriptions_revoke(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.Subscription.t()} | {:error, Polarex.AlreadyCanceledSubscription.t() | Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t() | Polarex.SubscriptionLocked.t()}
Revoke Subscription
Revoke a subscription, i.e cancel immediately.
Scopes: subscriptions:write
@spec subscriptions_update( id :: String.t(), body :: Polarex.SubscriptionCancel.t() | Polarex.SubscriptionRevoke.t() | Polarex.SubscriptionUpdateBillingPeriod.t() | Polarex.SubscriptionUpdateClear.t() | Polarex.SubscriptionUpdateDiscount.t() | Polarex.SubscriptionUpdateProduct.t() | Polarex.SubscriptionUpdateSeats.t() | Polarex.SubscriptionUpdateTrial.t(), opts :: keyword() ) :: {:ok, Polarex.Subscription.t()} | {:error, Polarex.AlreadyCanceledSubscription.t() | Polarex.HTTPValidationError.t() | Polarex.PaymentFailed.t() | Polarex.ResourceNotFound.t() | Polarex.SubscriptionLocked.t()}
Update Subscription
Update a subscription.
Scopes: subscriptions:write
Request Body
Content Types: application/json