> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sezzle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a card session

> Creates a Sezzle virtual card session. A card session represents the issuance of a Sezzle virtual card to a Sezzle user and/or the agreement of a Sezzle user to use the virtual card as payment. Use the card session endpoints to create and update a card session.

<Warning>
  This endpoint should be used with our virtual card offering. It is not intended for the direct integration flow.
</Warning>


## OpenAPI

````yaml post /v2/session/card
openapi: 3.1.0
info:
  title: Sezzle API v2
  description: >-
    This Sezzle API is for merchants who want to accept Sezzle as a payment
    option
  termsOfService: https://legal.sezzle.com
  version: 2.0.0
  x-logo:
    url: https://media.sezzle.com/branding/2.0/png/Logo_WhiteWordmark_500x126.png
    backgroundColor: '#392558'
servers:
  - url: https://sandbox.gateway.sezzle.com
    description: development server, usa, ca
  - url: https://gateway.sezzle.com
    description: production server, usa, ca
security:
  - Bearer: []
externalDocs:
  description: Sezzle API guides and tutorials
  url: https://docs.sezzle.com/sezzle-integration
paths:
  /v2/session/card:
    post:
      tags:
        - Virtual
      summary: Create card session
      description: >-
        Creates a Sezzle virtual card session. A card session represents the
        issuance of a Sezzle virtual card to a Sezzle user and/or the agreement
        of a Sezzle user to use the virtual card as payment. Use the card
        session endpoints to create and update a card session.
      operationId: HandleNewCardSessionV2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CardSessionRequest'
            example:
              origin: https://example.com
              mode: iframe
              merchant_reference_id: merchant-cart-id-max-255
              amount_in_cents: 1000
              currency: USD
              card_response_format: token
              customer:
                email: john.doe@example.com
                first_name: John
                last_name: Doe
                phone: '6125551234'
                billing_address:
                  street: 123 W Lake St
                  street2: Unit 104
                  city: Minneapolis
                  state: MN
                  postal_code: '55408'
                  country_code: US
              items:
                - name: Blue tee
                  sku: sku123456
                  quantity: 1
                  price:
                    amount_in_cents: 1000
                    currency: USD
      responses:
        '201':
          description: Successful Operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    type: string
                    description: The unique identifier for this session
                  dashboard_url:
                    type: string
                    description: >-
                      The dashboard_url is a URL which the customer should be
                      redirected to. Upon accepting the agreements there will be
                      a postMessage returned for the payload of the card data.
              example:
                uuid: fadbc642-05a4-4e38-9e74-80e325623af9
                dashboard_url: https://dashboard.sezzle.com/example?id=0001
        '400':
          $ref: '#/components/responses/BadRequestV2'
          example:
            code: bad_request
            message: bad request
        '401':
          $ref: '#/components/responses/UnauthorizedV2'
          example:
            code: unauthorized
            message: authorization not accepted
        '404':
          $ref: '#/components/responses/NotFoundV2'
          example:
            code: record_not_found
            message: not found
        '422':
          $ref: '#/components/responses/UnprocessableV2'
          example:
            code: invalid
            message: UnprocessableV2 entity
components:
  schemas:
    CardSessionRequest:
      required:
        - origin
        - mode
        - merchant_reference_id
        - amount_in_cents
        - currency
      allOf:
        - $ref: '#/components/schemas/Price'
        - type: object
          properties:
            origin:
              type: string
              description: The window origin of the host
            mode:
              $ref: '#/components/schemas/CheckoutMode'
            merchant_reference_id:
              type: string
              description: >-
                The checkout or cart ID from the merchant, currently used for
                tracking only (must contain only alphanumeric characters, dashes
                (-), and underscores (_))
            card_response_format:
              type: string
              description: Value of token required to use tokenization
            items:
              type: array
              items:
                $ref: '#/components/schemas/LineItem'
            customer:
              $ref: '#/components/schemas/Customer'
              description: The customer for this session
    Price:
      allOf:
        - $ref: '#/components/schemas/PriceBase'
        - type: object
          required:
            - amount_in_cents
            - currency
    CheckoutMode:
      type: string
      description: >-
        The mode for the order checkout. Defaults to redirect if not provided.
        If iframe or popup is provided, then the cancel and complete URLs must
        include the origin of the parent window.
      enum:
        - iframe
        - popup
        - redirect
    LineItem:
      description: >-
        Merchants who are in the Sports & Hobbies or Hunting & Fishing
        categories must define a category_path for each item in the order.
        Please talk with your account manager for further details.
      allOf:
        - $ref: '#/components/schemas/LineItemBasic'
        - type: object
          properties:
            name:
              type: string
              description: The name of the item
            sku:
              type: string
              description: The sku identifier
            quantity:
              type: integer
              description: The quantity purchased
            price:
              $ref: '#/components/schemas/Price'
              description: The price of the product before tax and discounts
            brand:
              type: string
              description: >-
                The products brand name as customers would recognize. Examples:
                Nike, Kelty, Brooks, Carhartt, Columbia
            image_url:
              type: string
              description: The fully qualified URL that shows the image
            product_url:
              type: string
              description: >-
                The fully qualified URL that links directly to the product being
                purchased
            global_trade_item_number:
              type: string
              description: >-
                The products Global Trade Item Number (GTIN). Common types
                include UPC, ISBN, EAN. Exclude dashes and spaces.
            manufacturer_part_number:
              type: string
              description: >-
                The products Manufacturer Part Number (MPN) which together with
                brand can uniquely identify a product.
    Customer:
      allOf:
        - $ref: '#/components/schemas/CheckoutRequestCustomer'
        - type: object
          properties:
            billing_address:
              $ref: '#/components/schemas/AddressV2'
              description: The customer's billing address
    ErrorV2:
      type: object
      properties:
        code:
          type: string
          description: The general error type
        message:
          type: string
          description: A more specific error message, if available
        location:
          type: string
          description: Where the error occurred
        debug_uuid:
          type: string
          description: The unique identifier assigned to this error for troubleshooting
    PriceBase:
      type: object
      properties:
        amount_in_cents:
          type: integer
          description: The amount in cents
        currency:
          type: string
          description: The 3 character currency code as defined by ISO 4217
    LineItemBasic:
      type: object
      description: >-
        Merchants who are in the Sports & Hobbies or Hunting & Fishing
        categories must define a category_path for each item in the order.
        Please talk with your account manager for further details.
      properties:
        name:
          type: string
          description: The name of the item
        sku:
          type: string
          description: The sku identifier
        quantity:
          type: integer
          description: The quantity purchased
        price:
          $ref: '#/components/schemas/Price'
          description: The price of the product before tax and discounts
        category_path:
          type: string
          description: >-
            The category path where the product is located. Use `>` only as the
            category delimiter, not as part of a product or category name.
            Example: Camping Gear & Supplies > Tents & Shelters.
    CheckoutRequestCustomer:
      type: object
      properties:
        first_name:
          type: string
          description: The customer's first name
        last_name:
          type: string
          description: The customer's last name
        email:
          type: string
          description: The customer's email address
        phone:
          type: string
          description: The customer's phone number
    AddressV2:
      allOf:
        - $ref: '#/components/schemas/Address'
        - type: object
          properties:
            phone:
              type: string
              description: The phone number at the delivery location
    Address:
      type: object
      properties:
        name:
          type: string
          description: The name on the address
        street:
          type: string
          description: The street and number of the address
        street2:
          type: string
          description: The apt or unit
        city:
          type: string
          description: The city
        state:
          type: string
          description: The 2 character state code
        postal_code:
          type: string
          description: The postal delivery code
        country_code:
          type: string
          description: The 2 character country code
  responses:
    BadRequestV2:
      description: Invalid request
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/ErrorV2'
          example:
            - code: bad_request
              message: bad request
    UnauthorizedV2:
      description: >-
        Unauthorized. Returned for any failed bearer or basic auth, including
        expired bearer tokens.
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/ErrorV2'
          example:
            - code: unauthorized
              message: authorization not accepted
    NotFoundV2:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/ErrorV2'
          example:
            - code: record_not_found
              message: not found
    UnprocessableV2:
      description: Unable to process the request entity
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/ErrorV2'
          example:
            - code: invalid
              message: Unprocessable entity
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header
      description: >-
        The authentication token generated from providing API Keys to Sezzle
        Gateway

````