{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://affirm.com/schemas/affirm/checkout.json", "title": "Affirm Checkout", "description": "Represents an Affirm checkout session containing all order details, customer information, and merchant configuration required to initiate the Affirm buy now pay later financing flow. Checkout objects are created via the Checkout API and result in a checkout token that is exchanged for a transaction authorization after customer confirmation.", "type": "object", "required": ["merchant", "items", "currency", "total"], "properties": { "checkout_id": { "type": "string", "description": "Unique identifier assigned to this checkout session by Affirm." }, "checkout_status": { "type": "string", "description": "Current status of the checkout session.", "enum": ["pending", "confirmed", "failed", "expired"] }, "checkout_flow_type": { "type": "string", "description": "The checkout flow type used for this session (e.g., classic, direct).", "examples": ["classic", "direct"] }, "merchant": { "$ref": "#/$defs/MerchantObject" }, "shipping": { "$ref": "#/$defs/ContactObject" }, "billing": { "$ref": "#/$defs/ContactObject" }, "store": { "$ref": "#/$defs/StoreObject" }, "items": { "type": "array", "description": "Array of item objects representing the products being purchased in this checkout.", "minItems": 1, "items": { "$ref": "#/$defs/ItemObject" } }, "discounts": { "type": "object", "description": "Map of discount codes to discount objects applied to this checkout.", "additionalProperties": { "$ref": "#/$defs/DiscountObject" } }, "metadata": { "type": "object", "description": "Arbitrary key-value metadata for merchant tracking. All values must be strings.", "additionalProperties": { "type": "string" } }, "order_id": { "type": "string", "description": "The merchant's internal order identifier stored for future reference and reconciliation." }, "currency": { "type": "string", "description": "Three-letter ISO 4217 currency code in uppercase.", "enum": ["USD", "CAD", "GBP"] }, "financing_program": { "type": "string", "description": "A financing program code applied to this checkout that determines the loan terms presented to the customer." }, "financial_program_name": { "type": "string", "description": "Internal financing program identifier applied to this checkout." }, "financial_program_external_name": { "type": "string", "description": "Customer-facing financing program name." }, "shipping_amount": { "type": "integer", "description": "The total shipping amount in cents.", "minimum": 0 }, "tax_amount": { "type": "integer", "description": "The total tax amount in cents.", "minimum": 0 }, "total": { "type": "integer", "description": "The total amount of the checkout in the smallest currency unit (cents for USD/CAD, pence for GBP).", "minimum": 0 }, "checkout_expiration": { "type": "string", "format": "date-time", "description": "ISO 8601 timestamp specifying when the checkout session expires." }, "expiration_time": { "type": "string", "format": "date-time", "description": "Time-to-live deadline by which the customer must confirm the checkout." }, "billing_frequency": { "type": "string", "description": "Loan billing frequency for the financing applied to this checkout." }, "api_version": { "type": "string", "description": "Version of the Affirm API used to create this checkout." } }, "$defs": { "MerchantObject": { "type": "object", "description": "Merchant-specific configuration for the checkout session including callback URLs and API credentials.", "required": ["user_confirmation_url", "user_cancel_url"], "properties": { "public_api_key": { "type": "string", "description": "The merchant's public API key. Required for server-side checkout and store endpoint calls." }, "user_confirmation_url": { "type": "string", "format": "uri", "description": "The URL the customer is redirected to after successfully completing the Affirm checkout flow. The checkout_token is delivered here." }, "user_cancel_url": { "type": "string", "format": "uri", "description": "The URL the customer is redirected to if they cancel or abandon the Affirm checkout flow." }, "user_confirmation_url_action": { "type": "string", "description": "Specifies how the checkout_token is delivered to the user_confirmation_url. POST sends it as a form body field; GET appends it as a query parameter.", "enum": ["POST", "GET"], "default": "POST" }, "name": { "type": "string", "description": "The merchant's display name shown to customers during the checkout flow." } } }, "ContactObject": { "type": "object", "description": "Contact information for shipping or billing including name, address, email, and phone number.", "properties": { "name": { "$ref": "#/$defs/NameObject" }, "address": { "$ref": "#/$defs/AddressObject" }, "email": { "type": "string", "format": "email", "description": "Email address for this contact." }, "phone_number": { "type": "string", "description": "Phone number for this contact in E.164 format.", "pattern": "^\\+?[1-9]\\d{1,14}$" } } }, "NameObject": { "type": "object", "description": "A person's name split into first and last name components.", "properties": { "first": { "type": "string", "description": "The person's first name.", "maxLength": 100 }, "last": { "type": "string", "description": "The person's last name.", "maxLength": 100 }, "full": { "type": "string", "description": "The person's full name as a single string.", "maxLength": 200 } } }, "AddressObject": { "type": "object", "description": "A postal address used for shipping or billing.", "properties": { "line1": { "type": "string", "description": "Primary street address line.", "maxLength": 200 }, "line2": { "type": "string", "description": "Secondary address line for apartment, suite, or unit number.", "maxLength": 200 }, "city": { "type": "string", "description": "City or locality name.", "maxLength": 100 }, "state": { "type": "string", "description": "State, province, or region code.", "maxLength": 50 }, "zipcode": { "type": "string", "description": "Postal or ZIP code.", "maxLength": 20 }, "country": { "type": "string", "description": "ISO 3166-1 alpha-2 country code.", "pattern": "^[A-Z]{2}$" } } }, "ItemObject": { "type": "object", "description": "Represents a single line item in the checkout including product details and pricing.", "required": ["display_name", "sku", "unit_price", "qty"], "properties": { "display_name": { "type": "string", "description": "Customer-facing product name displayed during the checkout flow.", "maxLength": 500 }, "sku": { "type": "string", "description": "Merchant's stock keeping unit identifier for this product.", "maxLength": 200 }, "unit_price": { "type": "integer", "description": "Unit price of the item in the smallest currency unit (e.g., cents).", "minimum": 0 }, "qty": { "type": "integer", "description": "Quantity of this item included in the order.", "minimum": 1 }, "item_image_url": { "type": "string", "format": "uri", "description": "URL of the product image displayed to the customer." }, "item_url": { "type": "string", "format": "uri", "description": "URL of the product page on the merchant's website." }, "categories": { "type": "array", "description": "Nested array of category strings representing the product's taxonomy.", "items": { "type": "array", "items": { "type": "string" } } } } }, "StoreObject": { "type": "object", "description": "Address details for in-store transactions where the purchase is made at a physical merchant location.", "properties": { "name": { "type": "string", "description": "The name of the store location." }, "address": { "$ref": "#/$defs/AddressObject" } } }, "DiscountObject": { "type": "object", "description": "Represents a discount applied to the checkout with an amount and display name.", "properties": { "discount_amount": { "type": "integer", "description": "The discount amount in cents.", "minimum": 0 }, "discount_display_name": { "type": "string", "description": "Customer-facing name or description of the discount.", "maxLength": 200 } } } } }