Polarex.Mcp (Polarex v0.1.0)
View SourceProvides API endpoints related to mcp
Summary
Functions
Get Customer Meter
List Customer Meters
Create Customer
Delete Customer
Delete Customer by External ID
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
Get Metrics
Get Metrics Limits
Get Order
Get Order Invoice
List Orders
Get Payment
List Payments
Create Product
Get Product
List Products
Update Product
Update Product Benefits
Export Subscriptions
Get Subscription
List Subscriptions
Revoke Subscription
Update Subscription
Functions
@spec customer_meters_get( String.t(), 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(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( Polarex.CustomerCreate.t(), keyword() ) :: {:ok, Polarex.Customer.t()} | {:error, Polarex.HTTPValidationError.t()}
Create Customer
Create a customer.
Scopes: customers:write
@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
@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
@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
@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
@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
@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
@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 thedeepObject
style, e.g.?metadata[key]=value
.
@spec customers_update(String.t(), Polarex.CustomerUpdate.t(), keyword()) :: {:ok, Polarex.Customer.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Customer
Update a customer.
Scopes: customers:write
@spec customers_update_external( String.t(), Polarex.CustomerUpdateExternalID.t(), keyword() ) :: {:ok, Polarex.Customer.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Customer by External ID
Update a customer by external ID.
Scopes: customers:write
@spec metrics_get(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.interval
: Interval between two timestamps.organization_id
: Filter by organization ID.product_id
: Filter by product ID.billing_type
: Filter by billing type.recurring
will filter data corresponding to subscriptions creations or renewals.one_time
will filter data corresponding to one-time purchases.customer_id
: Filter by customer ID.
@spec metrics_limits(keyword()) :: {:ok, Polarex.MetricsLimits.t()} | :error
Get Metrics Limits
Get the interval limits for the metrics endpoint.
Scopes: metrics:read
@spec orders_get( String.t(), 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( String.t(), 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(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.recurring
will filter data corresponding to subscriptions creations or renewals.one_time
will filter data corresponding to one-time purchases.discount_id
: Filter by discount ID.customer_id
: Filter by customer ID.checkout_id
: Filter by checkout 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 thedeepObject
style, e.g.?metadata[key]=value
.
@spec payments_get( String.t(), 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(keyword()) :: {:ok, Polarex.ListResource.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( Polarex.ProductCreate.t(), keyword() ) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t()}
Create Product
Create a product.
Scopes: products:write
@spec products_get( String.t(), 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(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.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_update(String.t(), Polarex.ProductUpdate.t(), keyword()) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.NotPermitted.t() | Polarex.ResourceNotFound.t()}
Update Product
Update a product.
Scopes: products:write
@spec products_update_benefits( String.t(), Polarex.ProductBenefitsUpdate.t(), 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
@spec subscriptions_export(keyword()) :: {:ok, map()} | {: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( String.t(), keyword() ) :: {:ok, Polarex.Subscription.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Subscription
Get a subscription by ID.
Scopes: subscriptions:write
@spec subscriptions_list(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.discount_id
: Filter by discount ID.active
: Filter by active or inactive subscription.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 thedeepObject
style, e.g.?metadata[key]=value
.
@spec subscriptions_revoke( String.t(), keyword() ) :: {:ok, Polarex.Subscription.t()} | {:error, Polarex.AlreadyCanceledSubscription.t() | Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Revoke Subscription
Revoke a subscription, i.e cancel immediately.
Scopes: subscriptions:write
@spec subscriptions_update( String.t(), Polarex.SubscriptionCancel.t() | Polarex.SubscriptionRevoke.t() | Polarex.SubscriptionUpdateProduct.t(), keyword() ) :: {:ok, Polarex.Subscription.t()} | {:error, Polarex.AlreadyCanceledSubscription.t() | Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Subscription
Update a subscription.
Scopes: subscriptions:write