# This file was auto-generated by Fern from our API Definition.

import typing
from ..core.client_wrapper import SyncClientWrapper
from .raw_client import RawLocationsClient
from .custom_attribute_definitions.client import CustomAttributeDefinitionsClient
from .custom_attributes.client import CustomAttributesClient
from .transactions.client import TransactionsClient
from ..core.request_options import RequestOptions
from ..types.list_locations_response import ListLocationsResponse
from ..requests.location import LocationParams
from ..types.create_location_response import CreateLocationResponse
from ..types.get_location_response import GetLocationResponse
from ..types.update_location_response import UpdateLocationResponse
from ..requests.create_order_request import CreateOrderRequestParams
from ..requests.address import AddressParams
from ..requests.charge_request_additional_recipient import ChargeRequestAdditionalRecipientParams
from ..types.create_checkout_response import CreateCheckoutResponse
from ..core.client_wrapper import AsyncClientWrapper
from .raw_client import AsyncRawLocationsClient
from .custom_attribute_definitions.client import AsyncCustomAttributeDefinitionsClient
from .custom_attributes.client import AsyncCustomAttributesClient
from .transactions.client import AsyncTransactionsClient

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class LocationsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawLocationsClient(client_wrapper=client_wrapper)
        self.custom_attribute_definitions = CustomAttributeDefinitionsClient(client_wrapper=client_wrapper)

        self.custom_attributes = CustomAttributesClient(client_wrapper=client_wrapper)

        self.transactions = TransactionsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawLocationsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawLocationsClient
        """
        return self._raw_client

    def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListLocationsResponse:
        """
        Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
        including those with an inactive status. Locations are listed alphabetically by `name`.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ListLocationsResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.locations.list()
        """
        response = self._raw_client.list(request_options=request_options)
        return response.data

    def create(
        self,
        *,
        location: typing.Optional[LocationParams] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateLocationResponse:
        """
        Creates a [location](https://developer.squareup.com/docs/locations-api).
        Creating new locations allows for separate configuration of receipt layouts, item prices,
        and sales reports. Developers can use locations to separate sales activity through applications
        that integrate with Square from sales activity elsewhere in a seller's account.
        Locations created programmatically with the Locations API last forever and
        are visible to the seller for their own management. Therefore, ensure that
        each location has a sensible and unique name.

        Parameters
        ----------
        location : typing.Optional[LocationParams]
            The initial values of the location being created. The `name` field is required and must be unique within a seller account.
            All other fields are optional, but any information you care about for the location should be included.
            The remaining fields are automatically added based on the data from the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        CreateLocationResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.locations.create(
            location={
                "name": "Midtown",
                "address": {
                    "address_line1": "1234 Peachtree St. NE",
                    "locality": "Atlanta",
                    "administrative_district_level1": "GA",
                    "postal_code": "30309",
                },
                "description": "Midtown Atlanta store",
            },
        )
        """
        response = self._raw_client.create(location=location, request_options=request_options)
        return response.data

    def get(self, location_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetLocationResponse:
        """
        Retrieves details of a single location. Specify "main"
        as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).

        Parameters
        ----------
        location_id : str
            The ID of the location to retrieve. Specify the string
            "main" to return the main location.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetLocationResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.locations.get(
            location_id="location_id",
        )
        """
        response = self._raw_client.get(location_id, request_options=request_options)
        return response.data

    def update(
        self,
        location_id: str,
        *,
        location: typing.Optional[LocationParams] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdateLocationResponse:
        """
        Updates a [location](https://developer.squareup.com/docs/locations-api).

        Parameters
        ----------
        location_id : str
            The ID of the location to update.

        location : typing.Optional[LocationParams]
            The `Location` object with only the fields to update.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        UpdateLocationResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.locations.update(
            location_id="location_id",
            location={
                "business_hours": {
                    "periods": [
                        {
                            "day_of_week": "FRI",
                            "start_local_time": "07:00",
                            "end_local_time": "18:00",
                        },
                        {
                            "day_of_week": "SAT",
                            "start_local_time": "07:00",
                            "end_local_time": "18:00",
                        },
                        {
                            "day_of_week": "SUN",
                            "start_local_time": "09:00",
                            "end_local_time": "15:00",
                        },
                    ]
                },
                "description": "Midtown Atlanta store - Open weekends",
            },
        )
        """
        response = self._raw_client.update(location_id, location=location, request_options=request_options)
        return response.data

    def checkouts(
        self,
        location_id: str,
        *,
        idempotency_key: str,
        order: CreateOrderRequestParams,
        ask_for_shipping_address: typing.Optional[bool] = OMIT,
        merchant_support_email: typing.Optional[str] = OMIT,
        pre_populate_buyer_email: typing.Optional[str] = OMIT,
        pre_populate_shipping_address: typing.Optional[AddressParams] = OMIT,
        redirect_url: typing.Optional[str] = OMIT,
        additional_recipients: typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]] = OMIT,
        note: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateCheckoutResponse:
        """
        Links a `checkoutId` to a `checkout_page_url` that customers are
        directed to in order to provide their payment information using a
        payment processing workflow hosted on connect.squareup.com.


        NOTE: The Checkout API has been updated with new features.
        For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights).

        Parameters
        ----------
        location_id : str
            The ID of the business location to associate the checkout with.

        idempotency_key : str
            A unique string that identifies this checkout among others you have created. It can be
            any valid string but must be unique for every order sent to Square Checkout for a given location ID.

            The idempotency key is used to avoid processing the same order more than once. If you are
            unsure whether a particular checkout was created successfully, you can attempt it again with
            the same idempotency key and all the same other parameters without worrying about creating duplicates.

            You should use a random number/string generator native to the language
            you are working in to generate strings for your idempotency keys.

            For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).

        order : CreateOrderRequestParams
            The order including line items to be checked out.

        ask_for_shipping_address : typing.Optional[bool]
            If `true`, Square Checkout collects shipping information on your behalf and stores
            that information with the transaction information in the Square Seller Dashboard.

            Default: `false`.

        merchant_support_email : typing.Optional[str]
            The email address to display on the Square Checkout confirmation page
            and confirmation email that the buyer can use to contact the seller.

            If this value is not set, the confirmation page and email display the
            primary email address associated with the seller's Square account.

            Default: none; only exists if explicitly set.

        pre_populate_buyer_email : typing.Optional[str]
            If provided, the buyer's email is prepopulated on the checkout page
            as an editable text field.

            Default: none; only exists if explicitly set.

        pre_populate_shipping_address : typing.Optional[AddressParams]
            If provided, the buyer's shipping information is prepopulated on the
            checkout page as editable text fields.

            Default: none; only exists if explicitly set.

        redirect_url : typing.Optional[str]
            The URL to redirect to after the checkout is completed with `checkoutId`,
            `transactionId`, and `referenceId` appended as URL parameters. For example,
            if the provided redirect URL is `http://www.example.com/order-complete`, a
            successful transaction redirects the customer to:

            `http://www.example.com/order-complete?checkoutId=xxxxxx&amp;referenceId=xxxxxx&amp;transactionId=xxxxxx`

            If you do not provide a redirect URL, Square Checkout displays an order
            confirmation page on your behalf; however, it is strongly recommended that
            you provide a redirect URL so you can verify the transaction results and
            finalize the order through your existing/normal confirmation workflow.

            Default: none; only exists if explicitly set.

        additional_recipients : typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]]
            The basic primitive of a multi-party transaction. The value is optional.
            The transaction facilitated by you can be split from here.

            If you provide this value, the `amount_money` value in your `additional_recipients` field
            cannot be more than 90% of the `total_money` calculated by Square for your order.
            The `location_id` must be a valid seller location where the checkout is occurring.

            This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.

            This field is currently not supported in the Square Sandbox.

        note : typing.Optional[str]
            An optional note to associate with the `checkout` object.

            This value cannot exceed 60 characters.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        CreateCheckoutResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.locations.checkouts(
            location_id="location_id",
            idempotency_key="86ae1696-b1e3-4328-af6d-f1e04d947ad6",
            order={
                "order": {
                    "location_id": "location_id",
                    "reference_id": "reference_id",
                    "customer_id": "customer_id",
                    "line_items": [
                        {
                            "name": "Printed T Shirt",
                            "quantity": "2",
                            "applied_taxes": [
                                {"tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"}
                            ],
                            "applied_discounts": [
                                {"discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"}
                            ],
                            "base_price_money": {"amount": 1500, "currency": "USD"},
                        },
                        {
                            "name": "Slim Jeans",
                            "quantity": "1",
                            "base_price_money": {"amount": 2500, "currency": "USD"},
                        },
                        {
                            "name": "Woven Sweater",
                            "quantity": "3",
                            "base_price_money": {"amount": 3500, "currency": "USD"},
                        },
                    ],
                    "taxes": [
                        {
                            "uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3",
                            "type": "INCLUSIVE",
                            "percentage": "7.75",
                            "scope": "LINE_ITEM",
                        }
                    ],
                    "discounts": [
                        {
                            "uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4",
                            "type": "FIXED_AMOUNT",
                            "amount_money": {"amount": 100, "currency": "USD"},
                            "scope": "LINE_ITEM",
                        }
                    ],
                },
                "idempotency_key": "12ae1696-z1e3-4328-af6d-f1e04d947gd4",
            },
            ask_for_shipping_address=True,
            merchant_support_email="merchant+support@website.com",
            pre_populate_buyer_email="example@email.com",
            pre_populate_shipping_address={
                "address_line1": "1455 Market St.",
                "address_line2": "Suite 600",
                "locality": "San Francisco",
                "administrative_district_level1": "CA",
                "postal_code": "94103",
                "country": "US",
                "first_name": "Jane",
                "last_name": "Doe",
            },
            redirect_url="https://merchant.website.com/order-confirm",
            additional_recipients=[
                {
                    "location_id": "057P5VYJ4A5X1",
                    "description": "Application fees",
                    "amount_money": {"amount": 60, "currency": "USD"},
                }
            ],
        )
        """
        response = self._raw_client.checkouts(
            location_id,
            idempotency_key=idempotency_key,
            order=order,
            ask_for_shipping_address=ask_for_shipping_address,
            merchant_support_email=merchant_support_email,
            pre_populate_buyer_email=pre_populate_buyer_email,
            pre_populate_shipping_address=pre_populate_shipping_address,
            redirect_url=redirect_url,
            additional_recipients=additional_recipients,
            note=note,
            request_options=request_options,
        )
        return response.data


class AsyncLocationsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawLocationsClient(client_wrapper=client_wrapper)
        self.custom_attribute_definitions = AsyncCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)

        self.custom_attributes = AsyncCustomAttributesClient(client_wrapper=client_wrapper)

        self.transactions = AsyncTransactionsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawLocationsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawLocationsClient
        """
        return self._raw_client

    async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListLocationsResponse:
        """
        Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
        including those with an inactive status. Locations are listed alphabetically by `name`.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ListLocationsResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.locations.list()


        asyncio.run(main())
        """
        response = await self._raw_client.list(request_options=request_options)
        return response.data

    async def create(
        self,
        *,
        location: typing.Optional[LocationParams] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateLocationResponse:
        """
        Creates a [location](https://developer.squareup.com/docs/locations-api).
        Creating new locations allows for separate configuration of receipt layouts, item prices,
        and sales reports. Developers can use locations to separate sales activity through applications
        that integrate with Square from sales activity elsewhere in a seller's account.
        Locations created programmatically with the Locations API last forever and
        are visible to the seller for their own management. Therefore, ensure that
        each location has a sensible and unique name.

        Parameters
        ----------
        location : typing.Optional[LocationParams]
            The initial values of the location being created. The `name` field is required and must be unique within a seller account.
            All other fields are optional, but any information you care about for the location should be included.
            The remaining fields are automatically added based on the data from the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        CreateLocationResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.locations.create(
                location={
                    "name": "Midtown",
                    "address": {
                        "address_line1": "1234 Peachtree St. NE",
                        "locality": "Atlanta",
                        "administrative_district_level1": "GA",
                        "postal_code": "30309",
                    },
                    "description": "Midtown Atlanta store",
                },
            )


        asyncio.run(main())
        """
        response = await self._raw_client.create(location=location, request_options=request_options)
        return response.data

    async def get(
        self, location_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetLocationResponse:
        """
        Retrieves details of a single location. Specify "main"
        as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).

        Parameters
        ----------
        location_id : str
            The ID of the location to retrieve. Specify the string
            "main" to return the main location.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetLocationResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.locations.get(
                location_id="location_id",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.get(location_id, request_options=request_options)
        return response.data

    async def update(
        self,
        location_id: str,
        *,
        location: typing.Optional[LocationParams] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdateLocationResponse:
        """
        Updates a [location](https://developer.squareup.com/docs/locations-api).

        Parameters
        ----------
        location_id : str
            The ID of the location to update.

        location : typing.Optional[LocationParams]
            The `Location` object with only the fields to update.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        UpdateLocationResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.locations.update(
                location_id="location_id",
                location={
                    "business_hours": {
                        "periods": [
                            {
                                "day_of_week": "FRI",
                                "start_local_time": "07:00",
                                "end_local_time": "18:00",
                            },
                            {
                                "day_of_week": "SAT",
                                "start_local_time": "07:00",
                                "end_local_time": "18:00",
                            },
                            {
                                "day_of_week": "SUN",
                                "start_local_time": "09:00",
                                "end_local_time": "15:00",
                            },
                        ]
                    },
                    "description": "Midtown Atlanta store - Open weekends",
                },
            )


        asyncio.run(main())
        """
        response = await self._raw_client.update(location_id, location=location, request_options=request_options)
        return response.data

    async def checkouts(
        self,
        location_id: str,
        *,
        idempotency_key: str,
        order: CreateOrderRequestParams,
        ask_for_shipping_address: typing.Optional[bool] = OMIT,
        merchant_support_email: typing.Optional[str] = OMIT,
        pre_populate_buyer_email: typing.Optional[str] = OMIT,
        pre_populate_shipping_address: typing.Optional[AddressParams] = OMIT,
        redirect_url: typing.Optional[str] = OMIT,
        additional_recipients: typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]] = OMIT,
        note: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateCheckoutResponse:
        """
        Links a `checkoutId` to a `checkout_page_url` that customers are
        directed to in order to provide their payment information using a
        payment processing workflow hosted on connect.squareup.com.


        NOTE: The Checkout API has been updated with new features.
        For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights).

        Parameters
        ----------
        location_id : str
            The ID of the business location to associate the checkout with.

        idempotency_key : str
            A unique string that identifies this checkout among others you have created. It can be
            any valid string but must be unique for every order sent to Square Checkout for a given location ID.

            The idempotency key is used to avoid processing the same order more than once. If you are
            unsure whether a particular checkout was created successfully, you can attempt it again with
            the same idempotency key and all the same other parameters without worrying about creating duplicates.

            You should use a random number/string generator native to the language
            you are working in to generate strings for your idempotency keys.

            For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).

        order : CreateOrderRequestParams
            The order including line items to be checked out.

        ask_for_shipping_address : typing.Optional[bool]
            If `true`, Square Checkout collects shipping information on your behalf and stores
            that information with the transaction information in the Square Seller Dashboard.

            Default: `false`.

        merchant_support_email : typing.Optional[str]
            The email address to display on the Square Checkout confirmation page
            and confirmation email that the buyer can use to contact the seller.

            If this value is not set, the confirmation page and email display the
            primary email address associated with the seller's Square account.

            Default: none; only exists if explicitly set.

        pre_populate_buyer_email : typing.Optional[str]
            If provided, the buyer's email is prepopulated on the checkout page
            as an editable text field.

            Default: none; only exists if explicitly set.

        pre_populate_shipping_address : typing.Optional[AddressParams]
            If provided, the buyer's shipping information is prepopulated on the
            checkout page as editable text fields.

            Default: none; only exists if explicitly set.

        redirect_url : typing.Optional[str]
            The URL to redirect to after the checkout is completed with `checkoutId`,
            `transactionId`, and `referenceId` appended as URL parameters. For example,
            if the provided redirect URL is `http://www.example.com/order-complete`, a
            successful transaction redirects the customer to:

            `http://www.example.com/order-complete?checkoutId=xxxxxx&amp;referenceId=xxxxxx&amp;transactionId=xxxxxx`

            If you do not provide a redirect URL, Square Checkout displays an order
            confirmation page on your behalf; however, it is strongly recommended that
            you provide a redirect URL so you can verify the transaction results and
            finalize the order through your existing/normal confirmation workflow.

            Default: none; only exists if explicitly set.

        additional_recipients : typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]]
            The basic primitive of a multi-party transaction. The value is optional.
            The transaction facilitated by you can be split from here.

            If you provide this value, the `amount_money` value in your `additional_recipients` field
            cannot be more than 90% of the `total_money` calculated by Square for your order.
            The `location_id` must be a valid seller location where the checkout is occurring.

            This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.

            This field is currently not supported in the Square Sandbox.

        note : typing.Optional[str]
            An optional note to associate with the `checkout` object.

            This value cannot exceed 60 characters.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        CreateCheckoutResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.locations.checkouts(
                location_id="location_id",
                idempotency_key="86ae1696-b1e3-4328-af6d-f1e04d947ad6",
                order={
                    "order": {
                        "location_id": "location_id",
                        "reference_id": "reference_id",
                        "customer_id": "customer_id",
                        "line_items": [
                            {
                                "name": "Printed T Shirt",
                                "quantity": "2",
                                "applied_taxes": [
                                    {"tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"}
                                ],
                                "applied_discounts": [
                                    {
                                        "discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"
                                    }
                                ],
                                "base_price_money": {"amount": 1500, "currency": "USD"},
                            },
                            {
                                "name": "Slim Jeans",
                                "quantity": "1",
                                "base_price_money": {"amount": 2500, "currency": "USD"},
                            },
                            {
                                "name": "Woven Sweater",
                                "quantity": "3",
                                "base_price_money": {"amount": 3500, "currency": "USD"},
                            },
                        ],
                        "taxes": [
                            {
                                "uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3",
                                "type": "INCLUSIVE",
                                "percentage": "7.75",
                                "scope": "LINE_ITEM",
                            }
                        ],
                        "discounts": [
                            {
                                "uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4",
                                "type": "FIXED_AMOUNT",
                                "amount_money": {"amount": 100, "currency": "USD"},
                                "scope": "LINE_ITEM",
                            }
                        ],
                    },
                    "idempotency_key": "12ae1696-z1e3-4328-af6d-f1e04d947gd4",
                },
                ask_for_shipping_address=True,
                merchant_support_email="merchant+support@website.com",
                pre_populate_buyer_email="example@email.com",
                pre_populate_shipping_address={
                    "address_line1": "1455 Market St.",
                    "address_line2": "Suite 600",
                    "locality": "San Francisco",
                    "administrative_district_level1": "CA",
                    "postal_code": "94103",
                    "country": "US",
                    "first_name": "Jane",
                    "last_name": "Doe",
                },
                redirect_url="https://merchant.website.com/order-confirm",
                additional_recipients=[
                    {
                        "location_id": "057P5VYJ4A5X1",
                        "description": "Application fees",
                        "amount_money": {"amount": 60, "currency": "USD"},
                    }
                ],
            )


        asyncio.run(main())
        """
        response = await self._raw_client.checkouts(
            location_id,
            idempotency_key=idempotency_key,
            order=order,
            ask_for_shipping_address=ask_for_shipping_address,
            merchant_support_email=merchant_support_email,
            pre_populate_buyer_email=pre_populate_buyer_email,
            pre_populate_shipping_address=pre_populate_shipping_address,
            redirect_url=redirect_url,
            additional_recipients=additional_recipients,
            note=note,
            request_options=request_options,
        )
        return response.data
