"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""

from __future__ import annotations
import dataclasses
from ..shared import address as shared_address
from ..shared import customer_read_create_token as shared_customer_read_create_token
from dataclasses_json import Undefined, dataclass_json
from klarna import utils
from typing import Optional


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class CustomerTokenCreationResponse:
    r"""Token was successfully created."""
    
    token_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('token_id') }})
    r"""Generated customer token. This token will be used to create a new order for the subscription using the Create a New order using token API."""  
    billing_address: Optional[shared_address.Address] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('billing_address'), 'exclude': lambda f: f is None }})  
    customer: Optional[shared_customer_read_create_token.CustomerReadCreateToken] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('customer'), 'exclude': lambda f: f is None }})  
    payment_method_reference: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('payment_method_reference'), 'exclude': lambda f: f is None }})
    r"""Used to connect customers with payment method when it is present."""  
    redirect_url: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('redirect_url'), 'exclude': lambda f: f is None }})
    r"""URL to redirect the customer to after placing the order. This is a Klarna URL where Klarna will place a cookie in the customer’s browser (if redirected) and redirect the customer back to the confirmation URL provided by the merchant. This is not a mandatory step but a recommended one to improve the returning customer’s experience."""  
    