Improve subscription UI with large tier buttons

- Replace dropdown tier selection with attractive visual buttons
- Add tier-button CSS with hover effects and selection states
- Remove 'or pay by card' divider from subscription form for cleaner UI
- Update JavaScript to handle tier button selection events
- Fix Stripe module import conflict by renaming stripe directory to stripe_config
- Add responsive grid layout for tier buttons on mobile devices
This commit is contained in:
2025-10-07 17:22:51 +01:00
parent bfdcee8602
commit 3ddbc40bb5
2655 changed files with 516264 additions and 2 deletions

View File

@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe.entitlements._active_entitlement import (
ActiveEntitlement as ActiveEntitlement,
)
from stripe.entitlements._active_entitlement_service import (
ActiveEntitlementService as ActiveEntitlementService,
)
from stripe.entitlements._active_entitlement_summary import (
ActiveEntitlementSummary as ActiveEntitlementSummary,
)
from stripe.entitlements._feature import Feature as Feature
from stripe.entitlements._feature_service import (
FeatureService as FeatureService,
)

View File

@@ -0,0 +1,132 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._expandable_field import ExpandableField
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._request_options import RequestOptions
from typing import ClassVar, List
from typing_extensions import Literal, NotRequired, Unpack, TYPE_CHECKING
if TYPE_CHECKING:
from stripe.entitlements._feature import Feature
class ActiveEntitlement(ListableAPIResource["ActiveEntitlement"]):
"""
An active entitlement describes access to a feature for a customer.
"""
OBJECT_NAME: ClassVar[Literal["entitlements.active_entitlement"]] = (
"entitlements.active_entitlement"
)
class ListParams(RequestOptions):
customer: str
"""
The ID of the customer.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
class RetrieveParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
feature: ExpandableField["Feature"]
"""
The [Feature](https://stripe.com/docs/api/entitlements/feature) that the customer is entitled to.
"""
id: str
"""
Unique identifier for the object.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
lookup_key: str
"""
A unique key you provide as your own system identifier. This may be up to 80 characters.
"""
object: Literal["entitlements.active_entitlement"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
@classmethod
def list(
cls, **params: Unpack["ActiveEntitlement.ListParams"]
) -> ListObject["ActiveEntitlement"]:
"""
Retrieve a list of active entitlements for a customer
"""
result = cls._static_request(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
async def list_async(
cls, **params: Unpack["ActiveEntitlement.ListParams"]
) -> ListObject["ActiveEntitlement"]:
"""
Retrieve a list of active entitlements for a customer
"""
result = await cls._static_request_async(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
def retrieve(
cls, id: str, **params: Unpack["ActiveEntitlement.RetrieveParams"]
) -> "ActiveEntitlement":
"""
Retrieve an active entitlement
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["ActiveEntitlement.RetrieveParams"]
) -> "ActiveEntitlement":
"""
Retrieve an active entitlement
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance

View File

@@ -0,0 +1,125 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from stripe.entitlements._active_entitlement import ActiveEntitlement
from typing import List, cast
from typing_extensions import NotRequired, TypedDict
class ActiveEntitlementService(StripeService):
class ListParams(TypedDict):
customer: str
"""
The ID of the customer.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
class RetrieveParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
def list(
self,
params: "ActiveEntitlementService.ListParams",
options: RequestOptions = {},
) -> ListObject[ActiveEntitlement]:
"""
Retrieve a list of active entitlements for a customer
"""
return cast(
ListObject[ActiveEntitlement],
self._request(
"get",
"/v1/entitlements/active_entitlements",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
params: "ActiveEntitlementService.ListParams",
options: RequestOptions = {},
) -> ListObject[ActiveEntitlement]:
"""
Retrieve a list of active entitlements for a customer
"""
return cast(
ListObject[ActiveEntitlement],
await self._request_async(
"get",
"/v1/entitlements/active_entitlements",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def retrieve(
self,
id: str,
params: "ActiveEntitlementService.RetrieveParams" = {},
options: RequestOptions = {},
) -> ActiveEntitlement:
"""
Retrieve an active entitlement
"""
return cast(
ActiveEntitlement,
self._request(
"get",
"/v1/entitlements/active_entitlements/{id}".format(
id=sanitize_id(id),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
id: str,
params: "ActiveEntitlementService.RetrieveParams" = {},
options: RequestOptions = {},
) -> ActiveEntitlement:
"""
Retrieve an active entitlement
"""
return cast(
ActiveEntitlement,
await self._request_async(
"get",
"/v1/entitlements/active_entitlements/{id}".format(
id=sanitize_id(id),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._stripe_object import StripeObject
from typing import ClassVar
from typing_extensions import Literal, TYPE_CHECKING
if TYPE_CHECKING:
from stripe.entitlements._active_entitlement import ActiveEntitlement
class ActiveEntitlementSummary(StripeObject):
"""
A summary of a customer's active entitlements.
"""
OBJECT_NAME: ClassVar[
Literal["entitlements.active_entitlement_summary"]
] = "entitlements.active_entitlement_summary"
customer: str
"""
The customer that is entitled to this feature.
"""
entitlements: ListObject["ActiveEntitlement"]
"""
The list of entitlements this customer has.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
object: Literal["entitlements.active_entitlement_summary"]
"""
String representing the object's type. Objects of the same type share the same value.
"""

View File

@@ -0,0 +1,248 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._createable_api_resource import CreateableAPIResource
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._request_options import RequestOptions
from stripe._updateable_api_resource import UpdateableAPIResource
from stripe._util import sanitize_id
from typing import ClassVar, Dict, List, cast
from typing_extensions import Literal, NotRequired, Unpack
class Feature(
CreateableAPIResource["Feature"],
ListableAPIResource["Feature"],
UpdateableAPIResource["Feature"],
):
"""
A feature represents a monetizable ability or functionality in your system.
Features can be assigned to products, and when those products are purchased, Stripe will create an entitlement to the feature for the purchasing customer.
"""
OBJECT_NAME: ClassVar[Literal["entitlements.feature"]] = (
"entitlements.feature"
)
class CreateParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
lookup_key: str
"""
A unique key you provide as your own system identifier. This may be up to 80 characters.
"""
metadata: NotRequired[Dict[str, str]]
"""
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
"""
name: str
"""
The feature's name, for your own purpose, not meant to be displayable to the customer.
"""
class ListParams(RequestOptions):
archived: NotRequired[bool]
"""
If set, filter results to only include features with the given archive status.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
lookup_key: NotRequired[str]
"""
If set, filter results to only include features with the given lookup_key.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
class ModifyParams(RequestOptions):
active: NotRequired[bool]
"""
Inactive features cannot be attached to new products and will not be returned from the features list endpoint.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
metadata: NotRequired["Literal['']|Dict[str, str]"]
"""
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
"""
name: NotRequired[str]
"""
The feature's name, for your own purpose, not meant to be displayable to the customer.
"""
class RetrieveParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
active: bool
"""
Inactive features cannot be attached to new products and will not be returned from the features list endpoint.
"""
id: str
"""
Unique identifier for the object.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
lookup_key: str
"""
A unique key you provide as your own system identifier. This may be up to 80 characters.
"""
metadata: Dict[str, str]
"""
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
"""
name: str
"""
The feature's name, for your own purpose, not meant to be displayable to the customer.
"""
object: Literal["entitlements.feature"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
@classmethod
def create(cls, **params: Unpack["Feature.CreateParams"]) -> "Feature":
"""
Creates a feature
"""
return cast(
"Feature",
cls._static_request(
"post",
cls.class_url(),
params=params,
),
)
@classmethod
async def create_async(
cls, **params: Unpack["Feature.CreateParams"]
) -> "Feature":
"""
Creates a feature
"""
return cast(
"Feature",
await cls._static_request_async(
"post",
cls.class_url(),
params=params,
),
)
@classmethod
def list(
cls, **params: Unpack["Feature.ListParams"]
) -> ListObject["Feature"]:
"""
Retrieve a list of features
"""
result = cls._static_request(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
async def list_async(
cls, **params: Unpack["Feature.ListParams"]
) -> ListObject["Feature"]:
"""
Retrieve a list of features
"""
result = await cls._static_request_async(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
def modify(
cls, id: str, **params: Unpack["Feature.ModifyParams"]
) -> "Feature":
"""
Update a feature's metadata or permanently deactivate it.
"""
url = "%s/%s" % (cls.class_url(), sanitize_id(id))
return cast(
"Feature",
cls._static_request(
"post",
url,
params=params,
),
)
@classmethod
async def modify_async(
cls, id: str, **params: Unpack["Feature.ModifyParams"]
) -> "Feature":
"""
Update a feature's metadata or permanently deactivate it.
"""
url = "%s/%s" % (cls.class_url(), sanitize_id(id))
return cast(
"Feature",
await cls._static_request_async(
"post",
url,
params=params,
),
)
@classmethod
def retrieve(
cls, id: str, **params: Unpack["Feature.RetrieveParams"]
) -> "Feature":
"""
Retrieves a feature
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["Feature.RetrieveParams"]
) -> "Feature":
"""
Retrieves a feature
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance

View File

@@ -0,0 +1,243 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from stripe.entitlements._feature import Feature
from typing import Dict, List, cast
from typing_extensions import Literal, NotRequired, TypedDict
class FeatureService(StripeService):
class CreateParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
lookup_key: str
"""
A unique key you provide as your own system identifier. This may be up to 80 characters.
"""
metadata: NotRequired[Dict[str, str]]
"""
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
"""
name: str
"""
The feature's name, for your own purpose, not meant to be displayable to the customer.
"""
class ListParams(TypedDict):
archived: NotRequired[bool]
"""
If set, filter results to only include features with the given archive status.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
lookup_key: NotRequired[str]
"""
If set, filter results to only include features with the given lookup_key.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
class RetrieveParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class UpdateParams(TypedDict):
active: NotRequired[bool]
"""
Inactive features cannot be attached to new products and will not be returned from the features list endpoint.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
metadata: NotRequired["Literal['']|Dict[str, str]"]
"""
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
"""
name: NotRequired[str]
"""
The feature's name, for your own purpose, not meant to be displayable to the customer.
"""
def list(
self,
params: "FeatureService.ListParams" = {},
options: RequestOptions = {},
) -> ListObject[Feature]:
"""
Retrieve a list of features
"""
return cast(
ListObject[Feature],
self._request(
"get",
"/v1/entitlements/features",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
params: "FeatureService.ListParams" = {},
options: RequestOptions = {},
) -> ListObject[Feature]:
"""
Retrieve a list of features
"""
return cast(
ListObject[Feature],
await self._request_async(
"get",
"/v1/entitlements/features",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def create(
self,
params: "FeatureService.CreateParams",
options: RequestOptions = {},
) -> Feature:
"""
Creates a feature
"""
return cast(
Feature,
self._request(
"post",
"/v1/entitlements/features",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "FeatureService.CreateParams",
options: RequestOptions = {},
) -> Feature:
"""
Creates a feature
"""
return cast(
Feature,
await self._request_async(
"post",
"/v1/entitlements/features",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def retrieve(
self,
id: str,
params: "FeatureService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Feature:
"""
Retrieves a feature
"""
return cast(
Feature,
self._request(
"get",
"/v1/entitlements/features/{id}".format(id=sanitize_id(id)),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
id: str,
params: "FeatureService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Feature:
"""
Retrieves a feature
"""
return cast(
Feature,
await self._request_async(
"get",
"/v1/entitlements/features/{id}".format(id=sanitize_id(id)),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def update(
self,
id: str,
params: "FeatureService.UpdateParams" = {},
options: RequestOptions = {},
) -> Feature:
"""
Update a feature's metadata or permanently deactivate it.
"""
return cast(
Feature,
self._request(
"post",
"/v1/entitlements/features/{id}".format(id=sanitize_id(id)),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def update_async(
self,
id: str,
params: "FeatureService.UpdateParams" = {},
options: RequestOptions = {},
) -> Feature:
"""
Update a feature's metadata or permanently deactivate it.
"""
return cast(
Feature,
await self._request_async(
"post",
"/v1/entitlements/features/{id}".format(id=sanitize_id(id)),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)