Polarex.Customers (Polarex v0.3.0)
View SourceProvides API endpoints related to customers
Summary
Functions
Add Customer Payment Method
Check Email Change Token
Confirm Customer Payment Method
Delete Customer Payment Method
Get Customer
List Customer Payment Methods
Request Email Change
Update Customer
Verify Email Change
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
Functions
@spec customer_portal_customers_add_payment_method( body :: Polarex.CustomerPaymentMethodCreate.t(), opts :: keyword() ) :: {:ok, Polarex.CustomerPaymentMethodCreateRequiresActionResponse.t() | Polarex.CustomerPaymentMethodCreateSucceededResponse.t()} | {:error, Polarex.HTTPValidationError.t()}
Add Customer Payment Method
Add a payment method to the authenticated customer.
Request Body
Content Types: application/json
@spec customer_portal_customers_check_email_update(opts :: keyword()) :: :ok | {:error, Polarex.HTTPValidationError.t()}
Check Email Change Token
Check if an email change verification token is still valid.
Options
token
@spec customer_portal_customers_confirm_payment_method( body :: Polarex.CustomerPaymentMethodConfirm.t(), opts :: keyword() ) :: {:ok, Polarex.CustomerPaymentMethodCreateRequiresActionResponse.t() | Polarex.CustomerPaymentMethodCreateSucceededResponse.t()} | {:error, Polarex.CustomerNotReady.t() | Polarex.HTTPValidationError.t()}
Confirm Customer Payment Method
Confirm a payment method for the authenticated customer.
Request Body
Content Types: application/json
@spec customer_portal_customers_delete_payment_method( id :: String.t(), opts :: keyword() ) :: :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.PaymentMethodInUseByActiveSubscription.t() | Polarex.ResourceNotFound.t()}
Delete Customer Payment Method
Delete a payment method from the authenticated customer.
@spec customer_portal_customers_get(opts :: keyword()) :: {:ok, Polarex.CustomerPortalCustomer.t()} | :error
Get Customer
Get authenticated customer.
Scopes: customer_portal:read customer_portal:write
@spec customer_portal_customers_list_payment_methods(opts :: keyword()) :: {:ok, Polarex.ListResourceCustomerPaymentMethod.t()} | {:error, Polarex.HTTPValidationError.t()}
List Customer Payment Methods
Get saved payment methods of the authenticated customer.
Options
page: Page number, defaults to 1.limit: Size of a page, defaults to 10. Maximum is 100.
@spec customer_portal_customers_request_email_update( body :: Polarex.CustomerEmailUpdateRequest.t(), opts :: keyword() ) :: {:ok, map()} | {:error, Polarex.HTTPValidationError.t()}
Request Email Change
Request an email change for the authenticated customer.
Request Body
Content Types: application/json
@spec customer_portal_customers_update( body :: Polarex.CustomerPortalCustomerUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.CustomerPortalCustomer.t()} | {:error, Polarex.HTTPValidationError.t()}
Update Customer
Update authenticated customer.
Request Body
Content Types: application/json
@spec customer_portal_customers_verify_email_update( body :: Polarex.CustomerEmailUpdateVerifyRequest.t(), opts :: keyword() ) :: {:ok, Polarex.CustomerEmailUpdateVerifyResponse.t()} | :error
Verify Email Change
Verify an email change using the token from the verification email.
Request Body
Content Types: application/json
@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