Documentation for the ParityDeals Python SDK
asyncio
.
customers
module allows you to manage customer records within ParityDeals. You can access these operations via the customers
attribute on an initialized ParityDeals
client instance.
All methods are available in both synchronous and asynchronous versions, depending on how the ParityDeals
client was instantiated.
Response
customerId
(str): A unique identifier for the customer that you define. This ID will be used to reference the customer in subsequent API calls.email
(str): The email address of the customer. Must be a valid email format.name
(str): The name of the customer.metadata
(Dict[str, str]): A dictionary of custom key-value pairs to store additional information about the customer.CustomerResponse
(Pydantic model), representing the newly created customer record. Key attributes include:
id
(str): The server-generated unique UUID for the customer record.customerId
(str): The client-provided customer identifier.name
(str): The customer’s name.email
(str): The customer’s email.details
([Dict[str, Any]]): Any server-added details about the customer (typically read-only).metadata
([Dict[str, str]]): The metadata associated with the customer.createdOn
(string) : ISO 8601 timestamp of when the customer was created.modifiedOn
(string) : ISO 8601 timestamp of when the customer was last modified.Response
customerId
(str): A unique identifier for the customer that you define. This ID will be used to reference the customer in subsequent API calls.email
(str): The email address of the customer. Must be a valid email format.name
(str): The name of the customer.metadata
(Dict[str, str]): A dictionary of custom key-value pairs to store additional information about the customer.CustomerResponse
(Pydantic model), representing the newly created customer record. Key attributes include:
id
(str): The server-generated unique UUID for the customer record.customerId
(str): The client-provided customer identifier.name
(str): The customer’s name.email
(str): The customer’s email.details
([Dict[str, Any]]): Any server-added details about the customer (typically read-only).metadata
([Dict[str, Any]]): The metadata associated with the customer.createdOn
(string) : ISO 8601 timestamp of when the customer was created.modifiedOn
(string) : ISO 8601 timestamp of when the customer was last modified.create_session(...)
This operation creates a new checkout session for a customer, allowing them to proceed with a purchase or subscription.
Synchronous:
Response
planIdentifier
(str): The identifier of the specific plan the customer is checking out with. planIdentifier is mandatory.
successUrl
(str): The URL to which the user will be redirected after a successful checkout.
chargePeriod
(str): Required. The billing cycle for the subscription. Must be one of:
"ONE_TIME"
"MONTHLY"
"YEARLY"
"WEEKLY"
"DAILY"
"THREE_MONTHS"
"SIX_MONTHS"
offeringId
(str): The ID (uuid) of the offering the customer is checking out with.
pricingTableId
(str): Required. The id (uuid) of the pricingTable being used for this checkout. (Considered only if offeringId
is not provided)
ruleId
(str): Required. The id (uuid) of the pricing rule being applied. (Considered only if offeringId
is not provided)
customerId
(str): Required. The ID of the customer initiating the checkout. (If not provided, a new customer will be created)
features
(List[Dict[str, Union[str, int]]]): Required. A list of dictionaries, where each dictionary represents a feature and its desired quantity. Each dictionary must have two keys:
"identifier"
(str): The unique identifier for the feature."quantity"
(int): The desired quantity for this feature.
[{"identifier": "seats", "quantity": 10}, {"identifier": "api-calls-tier1", "quantity": 5000}]
ipAddress
(str): The IP Address of the customer, used for location based pricing.
checkoutSessionId
(str): The unique ID for the created checkout session.
checkoutUrl
(str): The URL that the customer should be redirected to in order to complete the payment and activate the subscription/purchase.
Response
customerId
(str): The unique identifier for the customer.
featureId
(str): The unique identifier for the feature whose access is being checked.
bool
: True if the customer has access to the specified feature (considering feature type, limits, etc.), False otherwise or if the feature is not found in their entitlements.Response
customerId
(str): The unique identifier for the customer.
featureId
(str): The unique identifier for the feature whose access is being checked.
customerId
(str): The customer’s ID.
entitlements
(List[EntitlementDetail]): A list containing the details for the requested feature. Each EntitlementDetail has fields like:
featureId
: str
hasAccess
: bool
featureType
: str
resetAt
: str
hardLimit
: Optional[bool]
usageLimit
: Optional[int]
currentUsage
: Optional[int]
remaining
: Optional[int]
Response
customerId
(str): The unique identifier for the customer.customerId
(str): The customer’s ID.
entitlements
(List[EntitlementDetail]): A list containing the details for the requested feature. Each EntitlementDetail has fields like:
featureId
: str
hasAccess
: bool
featureType
: str
resetAt
: str
hardLimit
: Optional[bool]
usageLimit
: Optional[int]
currentUsage
: Optional[int]
remaining
: Optional[int]
Response
value
(int): The usage value being reported.
customerId
(str): The unique identifier for the customer associated with this usage.
featureId
(str): The unique identifier for the feature for which usage is being reported.
behaviour
parameter dictates how the usage is updated:
SET
: This will replace the current usage value for the feature with the new value
provided.
DELTA
: This will increment the existing usage value for the feature by the amount specified in the value
parameter
value
(int): The usage value that was recorded.
customerId
(str): The customer ID associated with the usage.
featureId
(str): The feature Identifier for which usage was recorded.
behaviour
(str): The behaviour type (“SET” or “DELTA”) that was processed.
orgId
(str): The organization ID associated with this record, as determined by the server.
eventName
(str): An internal event name generated by the server for this usage report (e.g., “aggregated.usage”).
idempotencyKey
(str): A unique idempotency key generated by the server for this specific usage report instance.
timestamp
(str): The server-generated UTC timestamp (str format) indicating when the usage report was processed.
subscriptions
attribute on an initialized ParityDeals client instance.
Response
subscriptionId
(str): Required. The unique identifier of the subscription to be updated.planIdentifier
(str): Required. The identifier of the new plan.chargePeriod
(str): Required. The new charging period for the subscription. Must be one of:
"ONE_TIME"
"MONTHLY"
"YEARLY"
"WEEKLY"
"DAILY"
"THREE_MONTHS"
"SIX_MONTHS"
offeringId
(str): Optional. The ID of the new offering, if applicable.pricingTableId
(str): Optional. The ID of the new pricingTable, if applicable.ruleId
(str): Optional. The ID of the new pricing rule, if applicable.ipAddress
(str): The IP Address of the customer, used for location based pricing.features
([List[Dict[str, Any]]]): Optional. A list of dictionaries, where each dictionary represents a feature and its desired quantity to update for the subscription. Each dictionary must have two keys:
"identifier"
(str): The unique identifier for the feature."quantity"
(int): The desired quantity for this feature.
[{'identifier': 'seats', 'quantity': 10}, {'identifier': 'projects', 'quantity': 5}]
UpdateSubscriptionResponse
, which includes:
subscriptionId
(str): UUID of the updated subscription.Response
subscriptionId
(str): The unique identifier of the subscription to be cancelled.
cancellationType
(str): The type of cancellation to perform. Must be one of:
"IMMEDIATE"
: The subscription is cancelled immediately."CURRENT_PERIOD_ENDS"
: The subscription will remain active until the end of the current billing period and then cancel."SPECIFIC_DATE"
: The subscription will be cancelled on the specified cancellationDate
.cancellationDate
(str): The specific date for cancellation if cancellationType
is "SPECIFIC_DATE"
. Must be in YYYY-MM-DD
format. This parameter is required if cancellationType
is "SPECIFIC_DATE"
.
CancelSubscriptionResponse
, which includes:
message
(str): A confirmation message indicating the result of the cancellation request.environment="sandbox"
when creating the client.