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

import typing_extensions
import typing_extensions
import typing
from .address import AddressParams
from .order import OrderParams
from .additional_recipient import AdditionalRecipientParams


class CheckoutParams(typing_extensions.TypedDict):
    """
    Square Checkout lets merchants accept online payments for supported
    payment types using a checkout workflow hosted on squareup.com.
    """

    id: typing_extensions.NotRequired[str]
    """
    ID generated by Square Checkout when a new checkout is requested.
    """

    checkout_page_url: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The URL that the buyer's browser should be redirected to after the
    checkout is completed.
    """

    ask_for_shipping_address: typing_extensions.NotRequired[typing.Optional[bool]]
    """
    If `true`, Square Checkout will collect shipping information on your
    behalf and store that information with the transaction information in your
    Square Dashboard.
    
    Default: `false`.
    """

    merchant_support_email: typing_extensions.NotRequired[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 merchant.
    
    If this value is not set, the confirmation page and email will display the
    primary email address associated with the merchant's Square account.
    
    Default: none; only exists if explicitly set.
    """

    pre_populate_buyer_email: typing_extensions.NotRequired[typing.Optional[str]]
    """
    If provided, the buyer's email is pre-populated on the checkout page
    as an editable text field.
    
    Default: none; only exists if explicitly set.
    """

    pre_populate_shipping_address: typing_extensions.NotRequired[AddressParams]
    """
    If provided, the buyer's shipping info is pre-populated on the
    checkout page as editable text fields.
    
    Default: none; only exists if explicitly set.
    """

    redirect_url: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The URL to redirect to after checkout is completed with `checkoutId`,
    Square's `orderId`, `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:
    
    <pre><code>http://www.example.com/order-complete?checkoutId=xxxxxx&amp;orderId=xxxxxx&amp;referenceId=xxxxxx&amp;transactionId=xxxxxx</code></pre>
    
    If you do not provide a redirect URL, Square Checkout will display an order
    confirmation page on your behalf; however Square strongly recommends that
    you provide a redirect URL so you can verify the transaction results and
    finalize the order through your existing/normal confirmation workflow.
    """

    order: typing_extensions.NotRequired[OrderParams]
    """
    Order to be checked out.
    """

    created_at: typing_extensions.NotRequired[str]
    """
    The time when the checkout was created, in RFC 3339 format.
    """

    additional_recipients: typing_extensions.NotRequired[typing.Optional[typing.Sequence[AdditionalRecipientParams]]]
    """
    Additional recipients (other than the merchant) receiving a portion of this checkout.
    For example, fees assessed on the purchase by a third party integration.
    """
