Skip to content

Commit

Permalink
server/checkout: add customer_external_id to Checkout schema
Browse files Browse the repository at this point in the history
  • Loading branch information
frankie567 committed Mar 6, 2025
1 parent 500b55e commit 24e4efc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions server/polar/checkout/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
),
]

_external_customer_id_description = (
"ID of the customer in your system. "
"If a matching customer exists on Polar, the resulting order "
"will be linked to this customer. "
"Otherwise, a new customer will be created with this external ID set."
)
_allow_discount_codes_description = (
"Whether to allow the customer to apply discount codes. "
"If you apply a discount through `discount_id`, it'll still be applied, "
Expand Down Expand Up @@ -142,13 +148,7 @@ class CheckoutCreateBase(CustomFieldDataInputMixin, MetadataInputMixin, Schema):
),
)
customer_external_id: str | None = Field(
default=None,
description=(
"ID of the customer in your system. "
"If a matching customer exists on Polar, the resulting order "
"will be linked to this customer. "
"Otherwise, a new customer will be created with this external ID set."
),
default=None, description=_external_customer_id_description
)
customer_name: Annotated[CustomerName | None, EmptyStrToNoneValidator] = None
customer_email: CustomerEmail | None = None
Expand Down Expand Up @@ -462,6 +462,9 @@ def get_discount_discriminator_value(v: Any) -> str:
class Checkout(MetadataOutputMixin, CheckoutBase):
"""Checkout session data retrieved using an access token."""

customer_external_id: str | None = Field(
description=_external_customer_id_description
)
products: list[CheckoutProduct] = Field(
description="List of products available to select."
)
Expand Down

0 comments on commit 24e4efc

Please sign in to comment.