models.py•45.4 kB
# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T04:12:16+00:00
from __future__ import annotations
from datetime import datetime
from enum import Enum
from typing import List, Optional
from pydantic import BaseModel, Field, conint, constr
class Address(BaseModel):
attention: Optional[constr(min_length=0, max_length=99)] = Field(
None,
description='‘Attn.’ (if applicable). Only applicable for B2B customers.',
examples=['Attn'],
)
city: Optional[constr(min_length=0, max_length=99)] = Field(
None, description='Customer’s city.', examples=['London']
)
country: Optional[constr(pattern=r'^[A-Za-z]{2,2}$')] = Field(
None,
description='Customer’s country. This value overrides the purchase country if they are different. Should follow the standard of ISO 3166 alpha-2. E.g. GB, US, DE, SE.',
examples=['GB'],
)
email: Optional[constr(min_length=0, max_length=99)] = Field(
None, description='Customer’s email address.', examples=['test.sam@test.com']
)
family_name: Optional[constr(min_length=0, max_length=99)] = Field(
None,
description="Customers family name in UTF-8 encoding.\nCannot be only numbers, must be more than 1 character.\nAllowed special characters: -'’.\nMore information can be found [in this link](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market)",
examples=['Andersson'],
)
given_name: Optional[constr(min_length=0, max_length=99)] = Field(
None,
description="Customers given name in UTF-8 encoding.\nCannot be only numbers, must be more than 1 character.\nAllowed special characters: -'’.\nMore information can be found [in this link](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market)",
examples=['Adam'],
)
organization_name: Optional[constr(min_length=0, max_length=99)] = Field(
None,
description='Organization name (if applicable). Only applicable for B2B customers.',
)
phone: Optional[constr(min_length=5, max_length=99)] = Field(
None,
description='Phone number. Preferably a mobile phone number.',
examples=['+44795465131'],
)
postal_code: Optional[constr(min_length=0, max_length=10)] = Field(
None,
description='Customer’s postal code. Validation according to Universal Postal Union addressing systems.\nE.g. 12345, W1G OPW.',
examples=['W1G 0PW'],
)
region: Optional[constr(min_length=0, max_length=99)] = Field(
None,
description='Customer’s region or state - Mandatory for US and AU market. Validations according to ISO 3166-2 format, e.g. OH, NJ, etc.',
examples=['OH'],
)
street_address: Optional[constr(min_length=0, max_length=99)] = Field(
None,
description='Customer’s street address. Regional formatting is required, as follows:\nUK/US/FR: 33 Cavendish Square\nRest of EU: De Ruijterkade 7',
examples=['33 Cavendish Square'],
)
street_address2: Optional[constr(min_length=0, max_length=99)] = Field(
None,
description='Customer’s street address. Second Line. ',
examples=['Floor 22 / Flat 2'],
)
title: Optional[constr(min_length=0, max_length=20)] = Field(
None,
description='Customer’s Title. Allowed values per country:\nUK - "Mr", "Ms"\nDE - "Herr", "Frau"\nAT: "Herr, "Frau"\nCH: de-CH: "Herr, "Frau" it-CH: "Sig.", "Sig.ra" fr-CH: "M", "Mme" \nBE: "Dhr.", "Mevr."\nNL: "Dhr.", "Mevr."',
examples=['Mr.'],
)
class AssetUrls(BaseModel):
descriptive: Optional[str] = Field(
None,
description='URL of the descriptive asset. Using this dynamic asset will make sure that any copy update of Klarna will automatically be propagated.',
examples=[
'https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg'
],
)
standard: Optional[str] = Field(
None,
description='URL of the standard asset. Using this dynamic asset will make sure that any copy update of Klarna will automatically be propagated.',
examples=[
'https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg'
],
)
class Attachment(BaseModel):
body: str = Field(
...,
description='The content of the extra merchant data should be presented as a string inside this property. The body should be an object containing any of the keys and sub-objects described below serialized to JSON. More information on that object can be found [here](https://developers.klarna.com/api/#attachment-schema).',
examples=[
'{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}'
],
)
content_type: str = Field(
...,
description='The content type of the body. It is usually represented as "application/vnd.klarna.internal.emd-v2+json"',
examples=['application/vnd.klarna.internal.emd-v2+json'],
)
class Type(Enum):
invoice = 'invoice'
fixed_amount = 'fixed_amount'
base_account = 'base_account'
direct_debit = 'direct_debit'
direct_bank_transfer = 'direct_bank_transfer'
b2b_invoice = 'b2b_invoice'
card = 'card'
slice_it_by_card = 'slice_it_by_card'
pay_later_by_card = 'pay_later_by_card'
pay_by_card = 'pay_by_card'
fixed_sum_credit = 'fixed_sum_credit'
class AuthorizedPaymentMethod(BaseModel):
number_of_days: Optional[int] = None
number_of_installments: Optional[int] = None
type: Type
class Status(Enum):
complete = 'complete'
incomplete = 'incomplete'
class OrganizationEntityType(Enum):
LIMITED_COMPANY = 'LIMITED_COMPANY'
PUBLIC_LIMITED_COMPANY = 'PUBLIC_LIMITED_COMPANY'
ENTREPRENEURIAL_COMPANY = 'ENTREPRENEURIAL_COMPANY'
LIMITED_PARTNERSHIP_LIMITED_COMPANY = 'LIMITED_PARTNERSHIP_LIMITED_COMPANY'
LIMITED_PARTNERSHIP = 'LIMITED_PARTNERSHIP'
GENERAL_PARTNERSHIP = 'GENERAL_PARTNERSHIP'
REGISTERED_SOLE_TRADER = 'REGISTERED_SOLE_TRADER'
SOLE_TRADER = 'SOLE_TRADER'
CIVIL_LAW_PARTNERSHIP = 'CIVIL_LAW_PARTNERSHIP'
PUBLIC_INSTITUTION = 'PUBLIC_INSTITUTION'
OTHER = 'OTHER'
class Customer(BaseModel):
date_of_birth: Optional[str] = Field(
None,
description='Customer’s date of birth. The format is ‘yyyy-mm-dd’',
examples=['1978-12-31'],
)
gender: Optional[str] = Field(
None, description='Customer’s gender - ‘male’ or ‘female’', examples=['male']
)
last_four_ssn: Optional[constr(pattern=r'^([0-9]{4}|[0-9]{9})$')] = Field(
None,
description="Last four digits of the customer's social security number. This value is available for US customers.",
)
national_identification_number: Optional[str] = Field(
None,
description="The customer's national identification number. This value is available for EU customers utilizing national identification numbers.",
)
organization_entity_type: Optional[OrganizationEntityType] = Field(
None, description='Organization entity type. Only applicable for B2B customers.'
)
organization_registration_id: Optional[str] = Field(
None,
description='Organization registration id. Only applicable for B2B customers.',
)
title: Optional[str] = Field(
None,
description='Customer’s Title. Allowed values per country:\nUK - "Mr", "Ms"\nDE - "Herr", "Frau"\nAT: "Herr, "Frau"\nCH: de-CH: "Herr, "Frau" it-CH: "Sig.", "Sig.ra" fr-CH: "M", "Mme" \nBE: "Dhr.", "Mevr."\nNL: "Dhr.", "Mevr."',
examples=['Mr.'],
)
type: Optional[constr(pattern=r'^(person|organization)$')] = Field(
None,
description='Type of customer in the session. If nothing is added, a B2C session will be the default. If it is a b2b-session, you should enter organization to trigger a B2B session.',
examples=['organization'],
)
vat_id: Optional[str] = Field(
None, description='VAT ID. Only applicable for B2B customers.'
)
class CustomerRead(BaseModel):
date_of_birth: Optional[str] = Field(
None,
description='Customer’s date of birth. The format is ‘yyyy-mm-dd’',
examples=['1978-12-31'],
)
gender: Optional[str] = Field(
None, description='Customer’s gender - ‘male’ or ‘female’', examples=['male']
)
organization_entity_type: Optional[OrganizationEntityType] = Field(
None, description='Organization entity type. Only applicable for B2B customers.'
)
organization_registration_id: Optional[str] = Field(
None,
description='Organization registration id. Only applicable for B2B customers.',
)
title: Optional[str] = Field(
None,
description='Customer’s Title. Allowed values per country:\nUK - "Mr", "Ms"\nDE - "Herr", "Frau"\nAT: "Herr, "Frau"\nCH: de-CH: "Herr, "Frau" it-CH: "Sig.", "Sig.ra" fr-CH: "M", "Mme" \nBE: "Dhr.", "Mevr."\nNL: "Dhr.", "Mevr."',
examples=['Mr.'],
)
type: Optional[str] = Field(
None,
description='Type of customer in the session. If nothing is added, a B2C session will be the default. If it is a b2b-session, you should enter organization to trigger a B2B session.',
examples=['organization'],
)
vat_id: Optional[str] = Field(
None, description='VAT ID. Only applicable for B2B customers.'
)
class CustomerReadCreateToken(BaseModel):
date_of_birth: Optional[str] = Field(
None,
description='Customer’s date of birth. The format is ‘yyyy-mm-dd’',
examples=['1978-12-31'],
)
gender: Optional[str] = Field(
None, description='Customer’s gender - ‘male’ or ‘female’', examples=['male']
)
class IntendedUse(Enum):
SUBSCRIPTION = 'SUBSCRIPTION'
class CustomerTokenCreationRequest(BaseModel):
billing_address: Optional[Address] = None
customer: Optional[Customer] = None
description: constr(max_length=255) = Field(
..., description='Description of the purpose of the token.'
)
intended_use: IntendedUse = Field(..., description='Intended use for the token.')
locale: constr(pattern=r'^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$') = Field(
..., description="RFC 1766 customer's locale.", examples=['en-GB']
)
purchase_country: constr(pattern=r'^[A-Za-z]{2,2}$') = Field(
..., description='ISO 3166 alpha-2 purchase country.', examples=['GB']
)
purchase_currency: constr(pattern=r'^[A-Za-z]{3,3}$') = Field(
..., description='ISO 4217 purchase currency.', examples=['GBP']
)
class CustomerTokenCreationResponse(BaseModel):
billing_address: Optional[Address] = None
customer: Optional[CustomerReadCreateToken] = None
payment_method_reference: Optional[str] = Field(
None,
description='Used to connect customers with payment method when it is present.',
examples=['0b1d9815-165e-42e2-8867-35bc03789e00'],
)
redirect_url: Optional[str] = Field(
None,
description='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.',
examples=[
'https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect'
],
)
token_id: str = Field(
...,
description='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.',
examples=['0b1d9815-165e-42e2-8867-35bc03789e00'],
)
class MerchantUrls(BaseModel):
authorization: Optional[constr(min_length=0, max_length=2000)] = Field(
None,
description='URL for receiving the authorization token when payment is completed. Used for Authorization Callback.',
examples=['https://www.example-url.com/authorization'],
)
confirmation: Optional[constr(min_length=0, max_length=2000)] = Field(
None,
description='URL of the merchant confirmation page. The consumer will be redirected back to the confirmation page if the consumer is sent to the redirect URL after placing the order. Insert {session.id} and/or {order.id} as placeholder to connect either of those IDs to the URL(max 2000 characters).',
examples=['https://www.example-url.com/confirmation'],
)
notification: Optional[constr(min_length=0, max_length=2000)] = Field(
None,
description='URL for notifications on pending orders. Insert {session.id} and/or {order.id} as placeholder to connect either of those IDs to the URL (max 2000 characters).',
examples=['https://www.example-url.com/notification'],
)
push: Optional[constr(min_length=0, max_length=2000)] = Field(
None,
description='URL that will be requested when an order is completed. Should be different than checkout and confirmation URLs. Insert {session.id} and/or {order.id} as placeholder to connect either of those IDs to the URL (max 2000 characters).',
examples=['https://www.example-url.com/push'],
)
class Options(BaseModel):
color_border: Optional[constr(pattern=r'^#[A-Fa-f0-9]{6}$')] = Field(
None,
description='Color for the border of elements within the iFrame. Value should be a CSS hex color, e.g. "#FF9900"',
examples=['#FF9900'],
)
color_border_selected: Optional[constr(pattern=r'^#[A-Fa-f0-9]{6}$')] = Field(
None,
description='Color for the border of elements within the iFrame when selected by the customer. Value should be a CSS hex color, e.g. "#FF9900"',
examples=['#FF9900'],
)
color_details: Optional[constr(pattern=r'^#[A-Fa-f0-9]{6}$')] = Field(
None,
description='Color for the bullet points within the iFrame. Value should be a CSS hex color, e.g. "#FF9900"',
examples=['#FF9900'],
)
color_text: Optional[constr(pattern=r'^#[A-Fa-f0-9]{6}$')] = Field(
None,
description='Color for the texts within the iFrame. Value should be a CSS hex color, e.g. "#FF9900"',
examples=['#FF9900'],
)
radius_border: Optional[str] = Field(
None,
description='Radius for the border of elements within the iFrame.',
examples=['5px'],
)
class Order(BaseModel):
authorized_payment_method: Optional[AuthorizedPaymentMethod] = None
fraud_status: Optional[str] = Field(
None,
description='Fraud status for the order. Either ACCEPTED or PENDING. If ACCEPTED, the order could be captured. If PENDING, please wait till you receive the notification from Klarna in the notification URL that the order has been approved. You can find additional information here.',
)
order_id: str = Field(
...,
description='Unique order ID of the transaction. This ID will be used for all order management processes.',
)
redirect_url: Optional[str] = Field(
None,
description='URL to redirect the customer to after placing the order. This is a Klarna URL to which the merchant should redirect the customer to. 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. It is a spontaneous step and does not harm the customer’s experience.',
examples=[
'https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect'
],
)
class PaymentMethodCategory(BaseModel):
asset_urls: Optional[AssetUrls] = None
identifier: Optional[str] = Field(
None,
description='ID of the payment method category to be used while loading the widget later.\nThe possible values are:<ul><li>klarna</li><li>pay_later</li><li>pay_now</li><li>pay_over_time</li><li>direct_bank_transfer</li><li>direct_debit</li></ul>',
examples=['klarna'],
)
name: Optional[str] = Field(
None,
description='Name of the payment method category. These names are dynamic depending on what payment method is in the category. Using this dynamic asset will make sure that any copy update of Klarna will automatically be propagated, or any updates of included payment methods by you.',
examples=['Pay with Klarna'],
)
class ProductIdentifiers(BaseModel):
brand: Optional[constr(min_length=0, max_length=70)] = Field(
None,
description="The product's brand name as generally recognized by consumers. If no brand is available for a product, do not supply any value.",
examples=['shoe-brand'],
)
category_path: Optional[constr(min_length=0, max_length=750)] = Field(
None,
description="The product's category path as used in the merchant's webshop. Include the full and most detailed category and separate the segments with ' > '",
examples=['Shoes > Running'],
)
color: Optional[constr(min_length=0, max_length=64)] = Field(
None,
description='Color to be shown to the end customer (max 64 characters).',
examples=['white'],
)
global_trade_item_number: Optional[constr(min_length=0, max_length=50)] = Field(
None,
description="The product's Global Trade Item Number (GTIN). Common types of GTIN are EAN, ISBN or UPC. Exclude dashes and spaces, where possible",
examples=['4912345678904'],
)
manufacturer_part_number: Optional[constr(min_length=0, max_length=70)] = Field(
None,
description="The product's Manufacturer Part Number (MPN), which - together with the brand - uniquely identifies a product. Only submit MPNs assigned by a manufacturer and use the most specific MPN possible",
examples=['AD6654412-334.22'],
)
size: Optional[constr(min_length=0, max_length=64)] = Field(
None,
description='Size to be shown to the end customer (max 64 characters).',
examples=['small'],
)
class AcquiringChannel(Enum):
ECOMMERCE = 'ECOMMERCE'
IN_STORE = 'IN_STORE'
TELESALES = 'TELESALES'
class Intent(Enum):
buy = 'buy'
tokenize = 'tokenize'
buy_and_tokenize = 'buy_and_tokenize'
class Interval(Enum):
DAY = 'DAY'
WEEK = 'WEEK'
MONTH = 'MONTH'
YEAR = 'YEAR'
class Subscription(BaseModel):
interval: Interval = Field(..., description='The cadence unit for this.')
interval_count: conint(ge=1) = Field(..., description='The number of intervals')
name: constr(min_length=1, max_length=255) = Field(
..., description='The name of the subscription product'
)
class ErrorV2(BaseModel):
authorized_payment_method: Optional[AuthorizedPaymentMethod] = None
correlation_id: Optional[str] = None
error_code: Optional[str] = None
error_messages: Optional[List[str]] = None
fraud_status: Optional[str] = None
reason: Optional[str] = None
class MerchantSession(BaseModel):
client_token: constr(min_length=0, max_length=4096) = Field(
...,
description='Client token to be passed to the JS client while initializing the JS SDK in the next step.',
examples=['eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw'],
)
payment_method_categories: Optional[List[PaymentMethodCategory]] = Field(
None,
description='Available payment method categories for this particular session',
)
session_id: constr(min_length=0, max_length=255) = Field(
...,
description='ID of the created session. Please use this ID to share with Klarna for identifying any issues during integration.',
examples=['0b1d9815-165e-42e2-8867-35bc03789e00'],
)
class OrderLine(BaseModel):
image_url: Optional[constr(min_length=0, max_length=1024)] = Field(
None,
description="URL to an image that can be later embedded in communications between Klarna and the customer. (max 1024 characters).\n A minimum of 250x250 px resolution is recommended for the image to look good in the Klarna app, and below 50x50 px won't even show. We recommend using a good sized image (650x650 px or more), however the file size must not exceed 12MB.",
examples=['https://www.exampleobjects.com/logo.png'],
)
merchant_data: Optional[constr(min_length=0, max_length=1024)] = Field(
None,
description="Used for storing merchant's internal order number or other reference. Pass through field. (max 1024 characters)",
examples=[
'{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}'
],
)
name: constr(min_length=1, max_length=255) = Field(
...,
description='Descriptive name of the order line item.',
examples=['Running shoe'],
)
product_identifiers: Optional[ProductIdentifiers] = None
product_url: Optional[constr(min_length=0, max_length=1024)] = Field(
None,
description='URL to the product in the merchant’s webshop that can be later used in communications between Klarna and the customer. (max 1024 characters)',
examples=['https://.../AD6654412.html'],
)
quantity: conint(ge=0) = Field(
...,
description='Quantity of the order line item. Must be a non-negative number.',
examples=[1],
)
quantity_unit: Optional[constr(min_length=1, max_length=8)] = Field(
None,
description='Unit used to describe the quantity, e.g. kg, pcs, etc. If defined the value has to be 1-8 characters.',
examples=['pcs'],
)
reference: Optional[constr(min_length=0, max_length=256)] = Field(
None,
description='Client facing article number, SKU or similar. Max length is 256 characters.',
examples=['AD6654412'],
)
subscription: Optional[Subscription] = None
tax_rate: Optional[conint(ge=0, le=10000)] = Field(
None,
description='Tax rate of the order line. Non-negative value. The percentage value is represented with two implicit decimals. I.e 1900 = 19%.',
examples=[1900],
)
total_amount: conint(le=100000000) = Field(
...,
description='Total amount of the order line. Must be defined as minor units. Includes tax and discount. Eg: 2500=25 euros\nValue = (quantity x unit_price) - total_discount_amount. \n(max value: 100000000)',
examples=[2500],
)
total_discount_amount: Optional[conint(ge=0)] = Field(
None,
description='Non-negative minor units. Includes tax. Eg: 500=5 euros',
examples=[500],
)
total_tax_amount: Optional[int] = Field(
None,
description='Total tax amount of the order line. Must be within ±1 of total_amount - total_amount 10000 / (10000 + tax_rate). Negative when type is discount.',
examples=[475],
)
type: Optional[str] = Field(
None,
description='Type of the order line item. The possible values are:\n\nphysical\ndiscount\nshipping_fee\nsales_tax\ndigital\ngift_card\nstore_credit\nsurcharge',
examples=['physical'],
)
unit_price: conint(le=100000000) = Field(
...,
description='Price for a single unit of the order line. Must be defined as minor units. Includes tax, excludes discount. (max value: 100000000)',
examples=[2500],
)
class Session(BaseModel):
acquiring_channel: Optional[AcquiringChannel] = Field(
None,
description='The acquiring channel in which the session takes place. Ecommerce is default unless specified. Any other values should be defined in the agreement.',
examples=['ECOMMERCE'],
)
attachment: Optional[Attachment] = None
authorization_token: Optional[str] = Field(None, description='Authorization token.')
billing_address: Optional[Address] = None
client_token: Optional[constr(min_length=0, max_length=4096)] = Field(
None,
description='Token to be passed to the JS client',
examples=['eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw'],
)
custom_payment_method_ids: Optional[List[str]] = Field(
None,
description='Promo codes - The array could be used to define which of the configured payment options within a payment category (pay_later, pay_over_time, etc.) should be shown for this purchase. Discuss with the delivery manager to know about the promo codes that will be configured for your account. The feature could also be used to provide promotional offers to specific customers (eg: 0% financing). Please be informed that the usage of this feature can have commercial implications. ',
)
customer: Optional[Customer] = None
design: Optional[str] = Field(
None,
description='Design package to use in the session. This can only by used if a custom design has been implemented for Klarna Payments and agreed upon in the agreement. It might have a financial impact. Delivery manager will provide the value for the parameter.',
)
expires_at: Optional[datetime] = Field(
None,
description='Session expiration date',
examples=['2038-01-19T03:14:07.000Z'],
)
intent: Optional[Intent] = Field(
None,
description='Intent for the session. The field is designed to let partners inform Klarna of the purpose of the customer’s session.',
examples=['buy'],
)
locale: Optional[constr(pattern=r'^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$')] = Field(
None,
description='Used to define the language and region of the customer. The locale follows the format of (RFC 1766)[https://datatracker.ietf.org/doc/rfc1766/], meaning its value consists of language-country.\nThe following values are applicable:\n\nAT: "de-AT", "de-DE", "en-DE"\nBE: "be-BE", "nl-BE", "fr-BE", "en-BE"\nCH: "it-CH", "de-CH", "fr-CH", "en-CH"\nDE: "de-DE", "de-AT", "en-DE"\nDK: "da-DK", "en-DK"\nES: "es-ES", "ca-ES", "en-ES"\nFI: "fi-FI", "sv-FI", "en-FI"\nGB: "en-GB"\nIT: "it-IT", "en-IT"\nNL: "nl-NL", "en-NL"\nNO: "nb-NO", "en-NO"\nPL: "pl-PL", "en-PL"\nSE: "sv-SE", "en-SE"\nUS: "en-US".',
examples=['en-GB'],
)
merchant_data: Optional[constr(min_length=0, max_length=6000)] = Field(
None,
description='Pass through field to send any information about the order to be used later for reference while retrieving the order details (max 6000 characters)',
examples=[
'{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}'
],
)
merchant_reference1: Optional[constr(min_length=0, max_length=255)] = Field(
None,
description="Used for storing merchant's internal order number or other reference.",
examples=['ON4711'],
)
merchant_reference2: Optional[constr(min_length=0, max_length=255)] = Field(
None,
description="Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters).",
examples=['hdt53h-zdgg6-hdaff2'],
)
merchant_urls: Optional[MerchantUrls] = None
options: Optional[Options] = None
order_amount: Optional[conint(ge=0)] = Field(
None,
description='Total amount of the order including tax and any available discounts. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.',
examples=[2500],
)
order_lines: Optional[List[OrderLine]] = Field(
None,
description='The array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order.',
max_length=1000,
min_length=1,
)
order_tax_amount: Optional[conint(ge=0)] = Field(
None,
description='Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.',
examples=[475],
)
payment_method_categories: Optional[List[PaymentMethodCategory]] = Field(
None, description='Available payment method categories'
)
purchase_country: Optional[constr(pattern=r'^[A-Za-z]{2,2}$')] = Field(
None,
description='The purchase country of the customer. The billing country always overrides purchase country if the values are different. Formatted according to ISO 3166 alpha-2 standard, e.g. GB, SE, DE, US, etc.',
examples=['GB'],
)
purchase_currency: Optional[constr(pattern=r'^[A-Za-z]{3,3}$')] = Field(
None,
description='The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc.',
examples=['GBP'],
)
shipping_address: Optional[Address] = None
status: Optional[Status] = Field(
None,
description="The current status of the session. Possible values: 'complete', 'incomplete' where 'complete' is set when the order has been placed.",
examples=['complete'],
)
class SessionCreate(BaseModel):
acquiring_channel: Optional[AcquiringChannel] = Field(
None,
description='The acquiring channel in which the session takes place. Ecommerce is default unless specified. Any other values should be defined in the agreement.',
examples=['ECOMMERCE'],
)
attachment: Optional[Attachment] = None
authorization_token: Optional[str] = Field(None, description='Authorization token.')
billing_address: Optional[Address] = None
client_token: Optional[constr(min_length=0, max_length=4096)] = Field(
None,
description='Token to be passed to the JS client',
examples=['eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw'],
)
custom_payment_method_ids: Optional[List[str]] = Field(
None,
description='Promo codes - The array could be used to define which of the configured payment options within a payment category (pay_later, pay_over_time, etc.) should be shown for this purchase. Discuss with the delivery manager to know about the promo codes that will be configured for your account. The feature could also be used to provide promotional offers to specific customers (eg: 0% financing). Please be informed that the usage of this feature can have commercial implications. ',
)
customer: Optional[Customer] = None
design: Optional[str] = Field(
None,
description='Design package to use in the session. This can only by used if a custom design has been implemented for Klarna Payments and agreed upon in the agreement. It might have a financial impact. Delivery manager will provide the value for the parameter.',
)
expires_at: Optional[datetime] = Field(
None,
description='Session expiration date',
examples=['2038-01-19T03:14:07.000Z'],
)
intent: Optional[Intent] = Field(
None,
description='Intent for the session. The field is designed to let partners inform Klarna of the purpose of the customer’s session.',
examples=['buy'],
)
locale: Optional[constr(pattern=r'^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$')] = Field(
None,
description='Used to define the language and region of the customer. The locale follows the format of (RFC 1766)[https://datatracker.ietf.org/doc/rfc1766/], meaning its value consists of language-country.\nThe following values are applicable:\n\nAT: "de-AT", "de-DE", "en-DE"\nBE: "be-BE", "nl-BE", "fr-BE", "en-BE"\nCH: "it-CH", "de-CH", "fr-CH", "en-CH"\nDE: "de-DE", "de-AT", "en-DE"\nDK: "da-DK", "en-DK"\nES: "es-ES", "ca-ES", "en-ES"\nFI: "fi-FI", "sv-FI", "en-FI"\nGB: "en-GB"\nIT: "it-IT", "en-IT"\nNL: "nl-NL", "en-NL"\nNO: "nb-NO", "en-NO"\nPL: "pl-PL", "en-PL"\nSE: "sv-SE", "en-SE"\nUS: "en-US". Default value is "en-US".',
examples=['en-US'],
)
merchant_data: Optional[constr(min_length=0, max_length=6000)] = Field(
None,
description='Pass through field to send any information about the order to be used later for reference while retrieving the order details (max 6000 characters)',
examples=[
'{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}'
],
)
merchant_reference1: Optional[constr(min_length=0, max_length=255)] = Field(
None,
description="Used for storing merchant's internal order number or other reference.",
examples=['ON4711'],
)
merchant_reference2: Optional[constr(min_length=0, max_length=255)] = Field(
None,
description="Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters).",
examples=['hdt53h-zdgg6-hdaff2'],
)
merchant_urls: Optional[MerchantUrls] = None
options: Optional[Options] = None
order_amount: conint(ge=0) = Field(
...,
description='Total amount of the order including tax and any available discounts. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.',
examples=[2500],
)
order_lines: List[OrderLine] = Field(
...,
description='The array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order.',
max_length=1000,
min_length=1,
)
order_tax_amount: Optional[conint(ge=0)] = Field(
None,
description='Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.',
examples=[475],
)
payment_method_categories: Optional[List[PaymentMethodCategory]] = Field(
None, description='Available payment method categories'
)
purchase_country: constr(pattern=r'^[A-Za-z]{2,2}$') = Field(
...,
description='The purchase country of the customer. The billing country always overrides purchase country if the values are different. Formatted according to ISO 3166 alpha-2 standard, e.g. GB, SE, DE, US, etc.',
examples=['GB'],
)
purchase_currency: constr(pattern=r'^[A-Za-z]{3,3}$') = Field(
...,
description='The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc.',
examples=['GBP'],
)
shipping_address: Optional[Address] = None
status: Optional[Status] = Field(
None,
description="The current status of the session. Possible values: 'complete', 'incomplete' where 'complete' is set when the order has been placed.",
examples=['complete'],
)
class SessionRead(BaseModel):
acquiring_channel: Optional[AcquiringChannel] = Field(
None,
description='The acquiring channel in which the session takes place. Ecommerce is default unless specified. Any other values should be defined in the agreement.',
examples=['ECOMMERCE'],
)
attachment: Optional[Attachment] = None
authorization_token: Optional[str] = Field(None, description='Authorization token.')
billing_address: Optional[Address] = None
client_token: Optional[constr(min_length=0, max_length=4096)] = Field(
None,
description='Token to be passed to the JS client',
examples=['eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw'],
)
custom_payment_method_ids: Optional[List[str]] = Field(
None,
description='Promo codes - The array could be used to define which of the configured payment options within a payment category (pay_later, pay_over_time, etc.) should be shown for this purchase. Discuss with the delivery manager to know about the promo codes that will be configured for your account. The feature could also be used to provide promotional offers to specific customers (eg: 0% financing). Please be informed that the usage of this feature can have commercial implications. ',
)
customer: Optional[CustomerRead] = None
design: Optional[str] = Field(
None,
description='Design package to use in the session. This can only by used if a custom design has been implemented for Klarna Payments and agreed upon in the agreement. It might have a financial impact. Delivery manager will provide the value for the parameter.',
)
expires_at: Optional[datetime] = Field(
None,
description='Session expiration date',
examples=['2038-01-19T03:14:07.000Z'],
)
intent: Optional[Intent] = Field(
None,
description='Intent for the session. The field is designed to let partners inform Klarna of the purpose of the customer’s session.',
examples=['buy'],
)
locale: Optional[constr(pattern=r'^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$')] = Field(
None,
description='Used to define the language and region of the customer. The locale follows the format of (RFC 1766)[https://datatracker.ietf.org/doc/rfc1766/], meaning its value consists of language-country.\nThe following values are applicable:\n\nAT: "de-AT", "de-DE", "en-DE"\nBE: "be-BE", "nl-BE", "fr-BE", "en-BE"\nCH: "it-CH", "de-CH", "fr-CH", "en-CH"\nDE: "de-DE", "de-AT", "en-DE"\nDK: "da-DK", "en-DK"\nES: "es-ES", "ca-ES", "en-ES"\nFI: "fi-FI", "sv-FI", "en-FI"\nGB: "en-GB"\nIT: "it-IT", "en-IT"\nNL: "nl-NL", "en-NL"\nNO: "nb-NO", "en-NO"\nPL: "pl-PL", "en-PL"\nSE: "sv-SE", "en-SE"\nUS: "en-US".',
examples=['en-GB'],
)
merchant_data: Optional[constr(min_length=0, max_length=6000)] = Field(
None,
description='Pass through field to send any information about the order to be used later for reference while retrieving the order details (max 6000 characters)',
examples=[
'{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}'
],
)
merchant_reference1: Optional[constr(min_length=0, max_length=255)] = Field(
None,
description="Used for storing merchant's internal order number or other reference.",
examples=['ON4711'],
)
merchant_reference2: Optional[constr(min_length=0, max_length=255)] = Field(
None,
description="Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters).",
examples=['hdt53h-zdgg6-hdaff2'],
)
merchant_urls: Optional[MerchantUrls] = None
options: Optional[Options] = None
order_amount: Optional[conint(ge=0)] = Field(
None,
description='Total amount of the order including tax and any available discounts. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.',
examples=[2500],
)
order_lines: Optional[List[OrderLine]] = Field(
None,
description='The array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order.',
max_length=1000,
min_length=1,
)
order_tax_amount: Optional[conint(ge=0)] = Field(
None,
description='Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.',
examples=[475],
)
payment_method_categories: Optional[List[PaymentMethodCategory]] = Field(
None, description='Available payment method categories'
)
purchase_country: Optional[constr(pattern=r'^[A-Za-z]{2,2}$')] = Field(
None,
description='The purchase country of the customer. The billing country always overrides purchase country if the values are different. Formatted according to ISO 3166 alpha-2 standard, e.g. GB, SE, DE, US, etc.',
examples=['GB'],
)
purchase_currency: Optional[constr(pattern=r'^[A-Za-z]{3,3}$')] = Field(
None,
description='The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc.',
examples=['GBP'],
)
shipping_address: Optional[Address] = None
status: Optional[Status] = Field(
None,
description="The current status of the session. Possible values: 'complete', 'incomplete' where 'complete' is set when the order has been placed.",
examples=['complete'],
)
class CreateOrderRequest(BaseModel):
authorization_token: Optional[str] = Field(None, description='Authorization token.')
auto_capture: Optional[bool] = Field(
False, description='Allow merchant to trigger auto capturing.'
)
billing_address: Optional[Address] = None
custom_payment_method_ids: Optional[List[str]] = Field(
None,
description='Promo codes - The array could be used to define which of the configured payment options within a payment category (pay_later, pay_over_time, etc.) should be shown for this purchase. Discuss with the delivery manager to know about the promo codes that will be configured for your account. The feature could also be used to provide promotional offers to specific customers (eg: 0% financing). Please be informed that the usage of this feature can have commercial implications. ',
)
customer: Optional[Customer] = None
locale: Optional[constr(pattern=r'^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$')] = Field(
None,
description='Used to define the language and region of the customer. The locale follows the format of (RFC 1766)[https://datatracker.ietf.org/doc/rfc1766/], meaning its value consists of language-country.\nThe following values are applicable:\n\nAT: "de-AT", "de-DE", "en-DE"\nBE: "be-BE", "nl-BE", "fr-BE", "en-BE"\nCH: "it-CH", "de-CH", "fr-CH", "en-CH"\nDE: "de-DE", "de-AT", "en-DE"\nDK: "da-DK", "en-DK"\nES: "es-ES", "ca-ES", "en-ES"\nFI: "fi-FI", "sv-FI", "en-FI"\nGB: "en-GB"\nIT: "it-IT", "en-IT"\nNL: "nl-NL", "en-NL"\nNO: "nb-NO", "en-NO"\nPL: "pl-PL", "en-PL"\nSE: "sv-SE", "en-SE"\nUS: "en-US".',
examples=['en-GB'],
)
merchant_data: Optional[constr(min_length=0, max_length=6000)] = Field(
None,
description='Pass through field to send any information about the order to be used later for reference while retrieving the order details (max 6000 characters)',
examples=[
'{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}'
],
)
merchant_reference1: Optional[constr(min_length=0, max_length=255)] = Field(
None,
description="Used for storing merchant's internal order number or other reference.",
examples=['ON4711'],
)
merchant_reference2: Optional[constr(min_length=0, max_length=255)] = Field(
None,
description="Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters).",
examples=['hdt53h-zdgg6-hdaff2'],
)
merchant_urls: Optional[MerchantUrls] = None
order_amount: conint(ge=0) = Field(
...,
description='Total amount of the order including tax and any available discounts. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.',
examples=[2500],
)
order_lines: List[OrderLine] = Field(
...,
description='The array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order.',
max_length=1000,
min_length=1,
)
order_tax_amount: Optional[conint(ge=0)] = Field(
None,
description='Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.',
examples=[475],
)
payment_method_categories: Optional[List[PaymentMethodCategory]] = Field(
None, description='Available payment method categories'
)
purchase_country: constr(pattern=r'^[A-Za-z]{2,2}$') = Field(
...,
description='The purchase country of the customer. The billing country always overrides purchase country if the values are different. Formatted according to ISO 3166 alpha-2 standard, e.g. GB, SE, DE, US, etc.',
examples=['GB'],
)
purchase_currency: constr(pattern=r'^[A-Za-z]{3,3}$') = Field(
...,
description='The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc.',
examples=['GBP'],
)
shipping_address: Optional[Address] = None
status: Optional[Status] = Field(
None,
description="The current status of the session. Possible values: 'complete', 'incomplete' where 'complete' is set when the order has been placed.",
examples=['complete'],
)