openapi: 3.0.3

info:
  title: Glopal Checkout API
  contact:
    email: support@glopal.com
  version: 1.4.0

servers:
  - url: 'https://api.glopal.com'

tags:
  - name: Checkout API
  - name: Health Check
  - name: Callbacks
    description: |
      This API specification defines endpoints (providers) to be implemented
      by merchants looking for advanced integration with the Glopal Checkout.

      After the cart transfer to the Glopal Checkout, Glopal can send POST
      requests to the configured endpoints to deliver dynamic experience
      and better connect with your eCommerce platform, including:
        - Inventory check or inventory reservation before order payment
        - Clearing buyer's cart after successul purchase

paths:

  /v1/cart/transfer/external:
    post:
      summary: Create checkout
      description: Accepts cart content, returning checkout 'id' and 'cart_url' where buyer should be redirected to complete the checkout
      security:
        - ClientAuth: []
      tags:
        - Checkout API
      requestBody:
        description: Cart transfer content
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CartTransferRequest'
            examples:
              minimal:
                summary: Minimal example
                value:
                  store_id: 'mystore'
                  cart:
                    currency: 'USD'
                  visitor:
                    destination: 'FR'
                  items:
                    - id: '5VBHU31KX1S0'
                      name: 'Women Chevron Printed Trumpet Hem Dress'
                      quantity: 1
                      regular_price: 25.0
        required: true
      responses:
        200:
          $ref: '#/components/responses/200'
        400:
          $ref: '#/components/responses/400'
        401:
          $ref: '#/components/responses/401'
      callbacks:
        InventoryCheck:
          '{$request.body#/checkout.callbacks.inventory_check.url}':
            $ref: '#/paths/~1inventory-check'
        CheckoutPurchase:
          '{$request.body#/checkout.callbacks.checkout_purchase.url}':
            $ref: '#/paths/~1checkout-purchase'

  /alert/ping:
    get:
      tags:
        - Health Check
      responses:
        200:
          description: pong response
          content:
            text/plain:
              schema:
                type: string
                enum:
                  - 'pong'

  /inventory-check:
    post:
      summary: Validate requested inventory
      description: |
        Callback for doing ATP (Available to Promise) check or inventory reservation
        right before buyer's payment attempt.
      tags:
        - Callbacks
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CallbackInventoryCheckV1Request'
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallbackInventoryCheckV1Response'

  /checkout-purchase:
    post:
      summary: Completing the checkout with a purchase
      description: ""
      tags:
        - Callbacks
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CallbackCheckoutPurchaseV1Request'
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallbackCheckoutPurchaseV1Response'

components:

  securitySchemes:
    ClientAuth:
      type: http
      scheme: bearer
      bearerFormat: token

  responses:

      200:
        description: Success response
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CartTransferResponse'
            example:
              status: 'ok'
              id: '908dac6c-c9cd-4f0e-8a16-9916a5176845'
              cart_url: 'https://mystore.glopal.com/fr-FR/api/cart/redirect/0068af0ae088778c94fc992576d8f'
      400:
        description: Errror response
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CartTransferError'
            example:
              status: 'error'
              code: 'store_not_active'
              context: null
      401:
        description: Unauthorized error response
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CartTransferError'
            example:
              status: 'error'
              code: 'unauthorized'

  schemas:

    CartTransferError:
      type: object
      required:
      - status
      - code
      properties:
        status:
          type: string
          enum:
            - 'error'
        code:
          type: string
        context:
          type: string
          nullable: true
        error_url:
          type: string
          format: url
          description: Url to redirect a buyer to checkout error page. Not present by default, can be enabled by your Glopal Account Manager. Note that this is not a resource, but a temporary redirection url that can expire. Caller is not supposed to store, parse or modify the url. Destination host and path may change without a notice.
          example: 'https://mystore.glopal.com/fr-FR/api/cart/redirect/8123213SJFDSSD18543FSD'

    CartTransferResponse:
      type: object
      required:
        - status
        - id
        - cart_url
      properties:
        status:
          type: string
          enum:
            - 'ok'
        id:
          type: string
          example: '908dac6c-c9cd-4f0e-8a16-9916a5176845'
        cart_url:
          type: string
          format: url
          description: Url to redirect a buyer for completing the checkout. Note that this is not a resource, but a temporary redirection url that can expire. Caller is not supposed to store, parse or modify the url. Destination host and path may change without a notice.
          example: 'https://mystore.glopal.com/fr-FR/api/cart/redirect/0068af0ae088778c94fc992576d8f'

    CartTransferRequest:
      type: object
      required:
        - store_id
        - visitor
        - cart
        - items
      properties:
        store_id:
          type: string
          example: 'mystore'
        site_id:
          type: string
          example: 'CAEN'
        short_name:
          type: string
          deprecated: true
          example: 'mystore'
          description: Use store_id instead
        visitor:
          $ref: '#/components/schemas/Visitor'
        cart:
          $ref: '#/components/schemas/Cart'
        items:
          $ref: '#/components/schemas/Items'
        discounts:
          $ref: '#/components/schemas/Discounts'
        shipping:
          $ref: '#/components/schemas/Shipping'
        referrer:
          example: 'https://mystore.com'
          description: Link used for return back from the checkout.
          allOf:
            - $ref: '#/components/schemas/Url'
        tracking:
          $ref: '#/components/schemas/Tracking'
        checkout:
          $ref: '#/components/schemas/Checkout'

    Visitor:
      type: object
      required:
        - destination
      properties:
        destination:
          description: Requested checkout destination
          example: 'FR'
          allOf:
            - $ref: '#/components/schemas/CountryCode'
        language:
          description: Requested checkout language ('fr', 'fr-FR', 'zh-Hans-CN',...). Checkout would attempt to find the best match out of known language. If not supported, checkout might fallback to use 'en-US'. For backward compatibility, checkout will use 'zh-Hans-CN' if 'zh-Hant-CN' is requested.
          example: 'fr-FR'
          allOf:
            - $ref: '#/components/schemas/LanguageTag'
        currency:
          description: Requested checkout currency. If missing, default currency for the destination would be used.
          example: 'EUR'
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'

        customer:
          allOf:
            - description: Customer identity for non-guest checkout. If not provided, Glopal Checkout will collect customer name and email when completing the checkout.
            - $ref: '#/components/schemas/Customer'
        billing_address:
          $ref: '#/components/schemas/Address'
        shipping_address:
          allOf:
            - $ref: '#/components/schemas/Address'
            - properties:
                tax_id:
                  type: string
                  description: |
                    Customer country-specific tax identification number. By default Glopal Checkout does not collect this number.
                    To enable collection of this number for a specific market(s), please contact your Glopal Account Manager.
                    Available markets:
                     - Brazil: CPF/CNPJ (Cadastro de Pessoas Físicas/Cadastro Nacional da Pessoa Jurídica)
                     - China: Resident ID (People's Republic of China Resident Identity Card)
                     - Italy: CF (Codice Fiscale)
                     - Mexico: RFC (Registro Federal de Contribuyentes)
                     - South Korea: PCCC (Personal Customs Clearance Code)
                  example:
                    - '000.000.000-00' # CPF
                    - 'RTL-630713-7M9' # RFC
                address_code:
                  type: string
                  description: |
                    Country-specific (short) address code.
                    Required for Saudi Arabia: https://splonline.com.sa/en/national-address-1/. 
                    Optional for other countries.
                  example:
                    - 'RRRD2929' # Saudi Arabia
    Cart:
      type: object
      required:
        - currency
      properties:
        language:
          description: Cart items language. Used for passing to other services. If missing, assumes origin language of the store as configured.
          example: 'en'
          allOf:
            - $ref: '#/components/schemas/LanguageTag'
        currency:
          description: Cart items currency
          example: 'USD'
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        prices:
          description: Describes how to interpret cart prices. If missing, 'calculated' mode will be used.
          default:
            model: 'calculated'
          example:
            model: 'calculated'
          oneOf:
            - type: object
              description: Calculated price model
              required:
                - model
              properties:
                model:
                  description: Cart prices will be localized to the visitor country & currency following configured price localization rules for the store.
                  type: string
                  enum: ['calculated']
                include_origin_tax:
                  description: If cart prices include taxes of the exporting (origin) country. If missing, store configuration will be used.
                  type: boolean
                  nullable: true
                  default: null
                shipping_tax_included:
                  description: |
                    If shipping prices are passed in the API request, prices can include origin, destination or no tax.
                    If missing, default is decided based on `cart.prices.include_origin_tax` as "origin" if item prices
                    include origin tax, else "none".

                    - none: Shipping price is interpreted as net. Destination taxes are calculated on top, and presented either included or as part of all taxes.
                    - origin: Shipping price is assumed to include origin country taxes at the standard VAT rate. This is rate removed to get the net price.
                    - destination: Shipping price is assumed to include destination country taxes. If showing prices with destination tax, this is the price buyer will see in the checkout. Net price is re-calculated in the reverse calculation.
                  type: string
                  enum:
                    - none
                    - origin
                    - destination

            - type: object
              description: Fixed price mode
              required:
                - model
              properties:
                model:
                  description: Cart prices will be presented to the visitor as fixed, without any localization. Visitor currency must be equal to the cart currency.
                  type: string
                  enum: ['fixed']
                include_destination_tax:
                  description: Cart prices "absorb" calculated taxes of the import (destination) country on the specified charge.
                  type: boolean
                  default: false
                include_destination_duties:
                  description: Cart prices "absorb" calculated import duties (and other charges) on the specified charge. Requires include_destination_tax=true.
                  type: boolean
                  default: false
        external_id:
          description: External cart ID
          type: string
        attributes:
          type: object

    Items:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/Item'

    # TODO: Expose cart percentage and shipping percentage discounts
    Discounts:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/DiscountFixedAmount'
          - $ref: '#/components/schemas/DiscountFixedAmountCoupon'

    DiscountFixedAmount:
      type: object
      required:
        - name
        - amount
      properties:
        name:
          type: string
          enum:
            - 'fixed_amount'
        amount:
          $ref: '#/components/schemas/Price'
        code:
          type: string
        allocation:
          $ref: '#/components/schemas/DiscountAllocation'
        attributes:
          type: object

    DiscountFixedAmountCoupon:
      type: object
      required:
        - name
        - amount
        - code
        - display_name
      properties:
        name:
          type: string
          enum:
            - fixed_amount_coupon
        amount:
          $ref: '#/components/schemas/Price'
        code:
          type: string
        display_name:
          type: string
        allocation:
          $ref: '#/components/schemas/DiscountAllocation'
        attributes:
          type: object

    Tracking:
      type: object
      properties:
        tags:
          type: object
          title: Query string tracking parameters (eg. utms and else)
          description: Parameters to pass to the checkout landing page for Google Analytics to track campaigns.
          properties:
            utm_source:
              type: string
            utm_medium:
              type: string
            utm_campaign:
              type: string
            utm_term:
              type: string
            utm_content:
              type: string
          additionalProperties:
            type: string
          example:
            utm_source: 'https://fr-mystore.glopalstore.com'
            utm_medium: 'wi_proxy'
            utm_campaign: 'co_o_r'
            custom: 'my-affiliate-id'
        cookies:
          type: object
          title: Cookies to pass to the checkout landing page for Google Ads Conversion Linker to track campaigns.
          properties:
            _gcl_aw:
              type: string
            _gcl_dc:
              type: string
            _gcl_gb:
              type: string
            _gcl_au:
              type: string
          example:
            _gcl_au: '1.1.346136889.1644568558'
        client_ids:
          type: object
          title: Tracking client ids to be passed to GTM dataLayer
          description: Used to resume the same session for Google Analytics on the checkout landing page.
          properties:
            ga:
              type: string
            gl_session_id:
              type: string
          additionalProperties:
            type: string
          example:
            ga: '1709456884.1556804913'

    CheckoutSuccess:
      oneOf:
      - type: object
        properties:
          success_url:
            description: |
               Link used as the custom checkout confirmation page.

               Accepts optional placeholders:
                 - ${COUNTRY} - order shipping address country (ISO 3166-1 alpha-2 eg. DE)
                 - ${LANGUAGE} - visitor language tag (BCP 47, eg. de-DE)
                 - ${CURRENCY} - visitor currency code (ISO 4217, eg. EUR)
                 - ${CHECKOUT_ID} - Glopal Checkout ID - can be used to fetch order information
                                                         from Glopal Order API to display
                                                         on the custom confirmation page
                 - ${ORDER_ID} - Glopal Order ID
            example: 'https://mysite.com/${COUNTRY}/checkout/thankyou?lang=${LANGUAGE}'
            allOf:
              - $ref: '#/components/schemas/Url'
          success_url_autoredirect:
            description: |
                When set to true, buyer will be redirected to to success_url on the localized site,
                if localized site exists for the destination country.
                Otherwise buyer will be redirected directly to success url.
            type: boolean
            default: true
          success_url_enable_hmac:
            description: |
                When set to true, HMAC signature is appended to success url
                as a `sig` query parameter. To verify signature follow instruction:
                https://docs.glopal.com/preview/checkout/localized-checkout/integration/confirmation-page#signature-verification
            type: boolean
            default: false
          terms_of_service_url:
            description: |
               Accepts optional placeholders:
                 - ${COUNTRY} - visitor destination country (ISO 3166-1 alpha-2 eg. DE)
                 - ${LANGUAGE} - visitor language tag (BCP 47, eg. de-DE)
                 - ${CURRENCY} - visitor currency code (ISO 4217, eg. EUR)
            allOf:
              - $ref: '#/components/schemas/Url'
          terms_of_service_url_autoredirect:
            description: ""
            type: boolean
            default: true
          privacy_policy_url:
            description: |
               Accepts optional placeholders:
                 - ${COUNTRY} - visitor destination country (ISO 3166-1 alpha-2 eg. DE)
                 - ${LANGUAGE} - visitor language tag (BCP 47, eg. de-DE)
                 - ${CURRENCY} - visitor currency code (ISO 4217, eg. EUR)
            allOf:
              - $ref: '#/components/schemas/Url'
          privacy_policy_url_autoredirect:
            description: ""
            type: boolean
            default: true
          returns_policy_url:
            description: |
               Accepts optional placeholders:
                 - ${COUNTRY} - visitor destination country (ISO 3166-1 alpha-2 eg. DE)
                 - ${LANGUAGE} - visitor language tag (BCP 47, eg. de-DE)
                 - ${CURRENCY} - visitor currency code (ISO 4217, eg. EUR)
            allOf:
              - $ref: '#/components/schemas/Url'
          returns_policy_url_autoredirect:
            description: ""
            type: boolean
            default: true
          contact_details_url:
            description: |
               Accepts optional placeholders:
                 - ${COUNTRY} - visitor destination country (ISO 3166-1 alpha-2 eg. DE)
                 - ${LANGUAGE} - visitor language tag (BCP 47, eg. de-DE)
                 - ${CURRENCY} - visitor currency code (ISO 4217, eg. EUR)
            allOf:
              - $ref: '#/components/schemas/Url'
          contact_details_url_autoredirect:
            description: ""
            type: boolean
            default: true

      - type: object
        properties:
          success_message:
            description: Additional text message to display on the checkout confirmation page. Ignored if custom page is used via `success_url`.
            type: string



    Checkout:
      allOf:
      - $ref: '#/components/schemas/CheckoutSuccess'
      - type: object
        properties:
          countries:
            description: |
              Controls countries available in the shipping address
              dropdown. By default all destinations configured in
              store settings are available. When set, the list can
              be restricted to a subset of all enabled destinations for
              this particular checkout. Additional restrictions may apply
              based on the price model and other request parameters.
            type: array
            items:
              $ref: '#/components/schemas/CountryCode'
          currencies:
            description: |
              Controls currencies available. By default all currencies
              are available. When set, the list can be restricted to a
              subset for this particular checkout. Additional restrictions
              may apply based on the price model and other request parameters
            type: array
            items:
              $ref: '#/components/schemas/CurrencyCode'
          expires_at:
            type: string
            format: datetime
            description: Date and time (UTC) until checkout session should be valid. Default is 3 hours.
          callbacks:
            type: object
            properties:
              inventory_check:
                $ref: '#/components/schemas/Callback'
              checkout_purchase:
                $ref: '#/components/schemas/Callback'
          message:
            $ref: '#/components/schemas/CustomMessage'

        # TODO: Deprecate $.referrer for $.checkout.return_url
        # return_url:
        #   description: Link used for return back from the checkout.
        #   allOf:
        #    - $ref: '#/components/schemas/Url'

    CustomMessage:
      type: object
      description: |
        A custom message to be displayed below the list of items.
        The message can optionally include a heading and a link.
      properties:
        heading:
          type: string
        body:
          type: string
        link:
          type: object
          properties:
            url:
              allOf:
                - $ref: '#/components/schemas/Url'
            label:
              type: string

    Shipping:
      type: object
      properties:
        quote:
          $ref: '#/components/schemas/ShippingQuote'
        display:
          type: string
          enum:
            - 'editable'
            - 'hidden'
            - 'readonly'
          default: 'editable'
        selected_shipping_service:
          type: string
        shipments:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/ShipmentData'
              - properties:
                  box_code:
                    type: string
                  weight:
                    $ref: '#/components/schemas/Weight'
                  dimension:
                    $ref: '#/components/schemas/Dimension'

    ShippingQuote:
      type: array
      description: |
        List of shipping options presented to the buyer for the whole cart (all shipments)

        If multiple delivery info options are provided, info will presented from the first of
        "delivery_time", "delivery_dates", "delivery_text" in this order.
      items:
        type: object
        required:
          - service_name
          - price
        properties:
          display_name:
            type: string
            description: Visible name of the presented option (eg. "Express International") in the cart language.
          price:
            allOf:
              - description: Quoted price to collect from the buyer in cart currency. Depending on 'cart' options it is assumed to be net price or including some duty & taxes.
              - $ref: '#/components/schemas/Price'
          delivery_time:
            $ref: '#/components/schemas/EstimatedTime'
          delivery_dates:
            $ref: '#/components/schemas/EstimatedDates'
          delivery_text:
            type: string
          custom_message:
            type: string
          service_code:
            type: string
            description: Shipping service code name, as shared with your Glopal Account Manager. Corresponds to `carrier_service` in the Glopal CBT WS API.
          service_name:
            type: string
            description: |
              Shipping service level name, as shared with your Glopal Account Manager. Corresponds to `delivery_type_id` in the Glopal CBT WS API.

              If `display_name` is missing, Glopal Checkout will use predefined translations for this `service_name` when presenting option to the buyer.
            enum:
              - ECONOMY
              - STANDARD
              - PRIORITY
              - EXPRESS
          service_type:
            type: string
            default: DELIVERY
            enum:
              - PICKUP
              - DELIVERY
          pickup_locations:
            description: Locations describing pickup location. Valid for `service_type` PICKUP.
            type: array
            minItems: 1
            items:
              type: object
              required:
                - shipping_address
              properties:
                name:
                  type: string
                shipping_address:
                  allOf:
                    - description: Location where package should be sent for buyer to pickup.
                    - $ref: '#/components/schemas/Address'
                pickup_address:
                  allOf:
                    - description: Location where buyer should go to pickup the package.
                    - $ref: '#/components/schemas/Address'
          attributes:
            type: object

    ShipmentData:
      type: object
      properties:
        reference:
          type: string
          description: Optional unique reference used to assign items into shipments
        from_country:
          $ref: '#/components/schemas/CountryCode'
        hub_code:
          type: string
          description: Unique hub identifier. To be used when a merchant has more than one export hub
        attributes:
          type: object
    ShipmentsData:
      type: array
      description: List of the shipments (physical packages). If not set otherwise, single shipment from default location is assumed. If multiple shipments are defined, items must be assigned by shipment reference. Any non-assigned item is assumed to be in the first shipment.
      items:
        $ref: "#/components/schemas/ShipmentData"


    ItemData:
      type: object
      required:
        - id
        - quantity
      properties:
        # TODO: Rename to 'product_id'
        id:
          description: Product ID. While ID does not have to be stable or unique for the checkout to be completed, depending on the integration, other services may require to have stable & unique product identifier.
          example: '5VBHU31KX1S0'
          allOf:
            - $ref: '#/components/schemas/Id'
        variant_id:
          description: Selected product variant ID. Optional secondary ID describing selected product variant. While recommended, field is not required even if having cart with multiple products sharing the same product ID, but in such case set of options must be unique among products sharing the same product ID.
          example: '747535896'
          allOf:
            - $ref: '#/components/schemas/NullableId'
        item_id:
          type: string
          description: Unique id of the item in the cart
          example: '5293f54a-6688-4119-9cf0-19203b8352c2'
        sku:
          example: '828-12/M'
          description: "SKU of this cart item, product or variant"
          allOf:
            - $ref: '#/components/schemas/NullableId'
        options:
          type: array
          description: Item options visible in the checkout. Used together with product and variant ID to make unique product 'hash' for cart line operations in the checkout (remove item, update quantity,...). Options may have an additional price for presenting to the buyer.
          items:
            type: object
            title: ItemOption
            required:
              - name
              - value
            properties:
              option_id:
                $ref: '#/components/schemas/NullableId'
              value_id:
                $ref: '#/components/schemas/NullableId'
              visibility:
                type: string
                default: visible
                enum:
                  - visible
                  - hidden
              name:
                $ref: '#/components/schemas/Any'
              value:
                $ref: '#/components/schemas/Any'
              price:
                deprecated: true
                nullable: true
                example: null
                allOf:
                  - $ref: '#/components/schemas/Price'
              attributes:
                type: object
            example:
              - name: XS
                value: 505
              - name: Actual Color
                value: Black White
              - name: Gift
                value: true
              - name: Custom Message
                value: null
              - name: 1024
                value: Rose Gold
        quantity:
          type: integer
          minimum: 1
          example: 1
        max_quantity:
          description: Maximum number of items available for purchase in the inventory. If missing, added quantity will be assumed as maximum available quantity.
          type: integer
          nullable: true
          minimum: 1
          example: 1
          deprecated: true
        min_quantity:
          description: Minimum number of items required for purchase.
          type: integer
          nullable: true
          minimum: 1
          example: 1
          deprecated: true
        shipment:
          type: object
          description: Object with shipping reference as the key and quantity as the value. Defines quantity included in each of shipping.shipments[].reference. All unallocated quantity is assumed to be in the first shipment.
          additionalProperties:
            type: number
          example:
            package-a: 1
            package-b: 1
        attributes:
          $ref: '#/components/schemas/ItemAttributes'

    Item:
      type: object
      allOf:
        - $ref: '#/components/schemas/ItemData'
        - required:
            - name
            - regular_price
          properties:
            name:
              type: string
              description: "Name of this cart item, product or variant"
              example: 'Women Chevron Printed Trumpet Hem Dress'
            regular_price:
              description: Regular sale price of item in the cart. Depending on 'cart' options it is assumed to be net price or including some duty & taxes. Price should include all option prices. Price should include all option prices.
              example: '25.0'
              allOf:
                - $ref: '#/components/schemas/Price'
            special_price:
              description: Optional sale price to be charged in the checkout. Regular price will be shown crossed-out. Must be lower than 'regular_price'. Depending on 'cart' options it is assumed to be net price or including some duty & taxes. Price should include all option prices.
              nullable: true
              example: '23.0'
              allOf:
                - $ref: '#/components/schemas/Price'
            origin_tax_rate_included:
              type: number
              description: Origin tax rate included in the price, only if cart.prices.include_origin_tax=true. If missing, default rate configured for the store is assumed.
            is_virtual:
              description: Is this digital / electronic product with no weight that requires no shipping, or a regular tangible item
              type: boolean
              default: false
            url:
              nullable: true
              description: Url of the page featuring product, used as a link for buyer to open again from the checkout
              example: 'https://fr-mystore.glopalstore.com/products/5VBHU31KX1S0.html'
              allOf:
                - $ref: '#/components/schemas/Url'
            image_url:
              nullable: true
              description: Small product image to feature in the checkout. Currently checkout is hot-linking images without resize processing, showing them having 58x58 CSS-pixels
              example: 'https://fr-mystore.glopalstore.com/cdn/images/5VBHU31KX1S0.jpg'
              allOf:
                - $ref: '#/components/schemas/Url'

    ItemAttributes:
      description: Optional extensions for other services.
      example: {}
      type: object
      properties:
        description:
          type: string
          nullable: true
          description: The product description in free text format
        origin_url:
          nullable: true
          description: Url of the product page on the origin store. Not visible to buyers, optionally used for order forwarding to locate the product on the origin site if item.url points to the localized site.
          example: 'https://store.com/products/5VBHU31KX1S0.html'
          allOf:
            - $ref: '#/components/schemas/Url'
        weight:
          $ref: '#/components/schemas/Weight'
        dimension:
          $ref: '#/components/schemas/Dimension'
        hs_code:
          type: string
          nullable: true
          description: Harmonized system code of the product. It’s mandatory if enabled to receive DDP and product_class is not provided or OTFC not activated
        product_class:
          type: string
          nullable: true
          description: Descriptive product class. Glopal knows about roughly 50000 product classes and aliases. If the product class is not known, Glopal will use other product attributes (description, category, weight, brand, EAN/UPC barcode...) to guess the most adequate product class. The list of valid product classes evolves over time. Contact Glopal Xport IT support if you want a copy of the latest list. If product_class is not provided, and enabled to receive DDP, hs_code must be set.
        country_of_origin:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/CountryCode'
        documentation_code:
          type: string
          description: Code of mandatory document for the product
        materials:
          type: array
          items:
            type: string
          description: description of materials used for the goods
        gender:
          type: string
          description: Enumeration variable that states the product’s age gender combination. Possible values are M - Male, F - female, C - child, MC - male child, FC - female child, U - unisex
          nullable: true
          enum:
            - 'M'
            - 'F'
            - 'C'
            - 'MC'
            - 'FC'
            - 'U'
        brand:
          type: string
          nullable: true
          description: The product's brand if applicable
        gtin:
          type: string
          nullable: true
          description: Global Trade Item Number or equivalent (EAN, UPC, ISBN,...)
          example: '00614458341709'
        categories:
          type: object
          properties:
            internal:
              type: object
              properties:
                tags:
                  type: array
                  description: One or more product's category tags in your own categorization system
                  items:
                    $ref: '#/components/schemas/Any'
                  example:
                    - 'Dresses'
                    - 'Clothing'
                    - 'Shoes & Accessories'

    EstimatedTime:
      type: object
      required:
        - from_days
        - to_days
      properties:
        from_days:
          type: number
          format: int32
          minimum: 1
        to_days:
          type: number
          format: int32
          minimum: 1

    EstimatedDates:
      type: object
      required:
        - to_date
      properties:
        from_date:
          type: string
          format: date
        to_date:
          type: string
          format: date

    Any:
      title: Any
      oneOf:
        - type: string
          example: 'value'
        - type: number
          example: 42
        - type: boolean
          example: true
        - type: string
          nullable: true
          example: null

    Id:
      title: Id
      oneOf:
        - type: string
          example: 'AAA1234'
        - type: number
          example: 1234

    NullableId:
      title: NullableId
      oneOf:
        - type: string
          example: 'AAA1234'
        - type: string
          nullable: true
          example: null
        - type: number
          example: 1234

    Price:
      title: Price
      type: number
      minimum: 0

    Url:
      title: Url
      type: string
      pattern: "^https?://"

    Dimension:
      oneOf:
        - type: string
          nullable: true
          example: "10x20x55 cm"
        - type: object
          description: At least one dimension is required
          required:
            - width
            - height
            - length
          properties:
            width:
              type: number
              nullable: true
            height:
              type: number
              nullable: true
            length:
              type: number
              nullable: true
            unit:
              type: string
              nullable: true
          example:
            width: 10
            height: 20
            length: 55
            unit: "cm"

    Weight:
      oneOf:
        - type: string
          nullable: true
          example: "300 gr"
        - type: object
          required:
            - value
          properties:
            value:
              type: number
            unit:
              type: string
              nullable: true
          example:
            value: 300
            unit: "gr"

    LanguageTag:
      title: LanguageTag (Simplified IETF BCP-47 language[-script][-country])
      type: string
      pattern: "^(?<Language>[a-z]{2,3})(-(?<Script>[A-Z][a-z]{3}))?(-(?<Country>[A-Z]{2}))?$"
      example:
        - "fr"
        - "fr-FR"
        - "zh-Hans"
        - "zh-Hans-CN"

    CountryCode:
      title: CountryCode (ISO 3166-1 Alpha2)
      type: string
      enum:
        - "AE"
        - "BH"
        - "DZ"
        - "EG"
        - "JO"
        - "KW"
        - "MA"
        - "OM"
        - "QA"
        - "SA"
        - "TN"
        - "AZ"
        - "BG"
        - "BA"
        - "AD"
        - "CZ"
        - "DK"
        - "AT"
        - "CH"
        - "DE"
        - "LI"
        - "CY"
        - "GR"
        - "AU"
        - "BB"
        - "BM"
        - "BS"
        - "CA"
        - "GB"
        - "GG"
        - "GI"
        - "HK"
        - "IE"
        - "IM"
        - "JE"
        - "JM"
        - "KE"
        - "KY"
        - "MT"
        - "MY"
        - "NG"
        - "NZ"
        - "PG"
        - "SG"
        - "TT"
        - "TZ"
        - "US"
        - "ZA"
        - "AR"
        - "BO"
        - "CL"
        - "CO"
        - "CR"
        - "DO"
        - "EC"
        - "ES"
        - "GT"
        - "MX"
        - "NI"
        - "PA"
        - "PE"
        - "UY"
        - "EE"
        - "FI"
        - "FO"
        - "BE"
        - "FR"
        - "LU"
        - "MC"
        - "IL"
        - "IN"
        - "HR"
        - "HU"
        - "ID"
        - "IS"
        - "IT"
        - "SM"
        - "JP"
        - "GE"
        - "KH"
        - "KR"
        - "LT"
        - "LV"
        - "MK"
        - "MN"
        - "NL"
        - "NO"
        - "PL"
        - "BR"
        - "MZ"
        - "PT"
        - "MD"
        - "RO"
        - "BY"
        - "KZ"
        - "RU"
        - "SK"
        - "SI"
        - "AL"
        - "ME"
        - "RS"
        - "AX"
        - "SE"
        - "TH"
        - "UA"
        - "VN"
        - "CN"
        - "TW"
        - "UG"
        - "TR"
        - "GH"
        - "ZM"
        - "PH"

    CurrencyCode:
      title: CurrencyCode (ISO 4217 Alpha)
      type: string
      enum:
        - "AED"
        - "AUD"
        - "BHD"
        #- "BGN"
        - "BRL"
        - "CAD"
        - "CHF"
        - "CNY"
        - "CZK"
        - "DKK"
        - "EGP"
        - "EUR"
        - "GBP"
        - "GHS"
        - "HKD"
        #        - 'HUF'
        #        - 'IDR'
        - "ILS"
        - "INR"
        #        - 'JPY'
        - "KES"
        #- "KHR"
        #        - 'KRW'
        - "KWD"
        #- "LKR"
        - "MAD"
        #- "MOP"
        - "MXN"
        - "MYR"
        - "NGN"
        - "NOK"
        - "NZD"
        - "OMR"
        - "PHP"
        - "PLN"
        #- "RON"
        - "QAR"
        - "RUB"
        - "SAR"
        - "SEK"
        - "SGD"
        - "THB"
        - "TRY"
        #- "TWD"
        - "TZS"
        #        - 'UGX'
        - "USD"
        #        - 'VND'
        - "ZMW"
    Address:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        company:
          type: string
        address1:
          type: string
        postcode:
          type: string
        city:
          type: string
        state:
          type: string
        country_code:
          $ref: '#/components/schemas/CountryCode'
        telephone:
          type: string
        display_name:
          type: string
          description: Name displayed on the payment page, when address display is set to hidden
        display:
          type: string
          enum:
            - 'editable'
            - 'hidden'
            - 'readonly'
          default: 'editable'
    Customer:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        email:
          type: string
        display:
          type: string
          enum:
            - 'editable'
            - 'hidden'
            - 'readonly'
          default: 'editable'
        attributes:
          type: object

    DiscountAllocation:
      type: object
      required:
        - item_id
      properties:
        item_id:
          type: string
          description: references item_id

    Callback:
      type: object
      required:
        - url
      properties:
        url:
          oneOf:
            - $ref: '#/components/schemas/Url'
            - type: boolean
              example: false
              description: Only false is supported
        version:
          type: string
          default: '1.0'
          enum:
            - '1.0'

    CallbackV1RequestData:
      type: object
      required:
        - store_id
        - checkout_id
        - callback
      properties:
        store_id:
          type: string
        checkout_id:
          type: string
        callback:
          type: string
        visitor:
          type: object
          required:
            - destination
          properties:
            destination:
              description: Requested checkout destination
              example: 'FR'
              allOf:
                - $ref: '#/components/schemas/CountryCode'
            customer:
              $ref: '#/components/schemas/Customer'
            billing_address:
              $ref: '#/components/schemas/Address'
            shipping_address:
              $ref: '#/components/schemas/Address'
        cart:
          type: object
          properties:
            external_id:
              type: string
            attributes:
              type: object
        items:
          type: array
          minItems: 1
          items:
            type: object
            allOf:
              - required:
                  - line_id
                properties:
                  line_id:
                    type: string
                    example: '50a2fabfdd276f573ff97ace8b11c5f4'
              - $ref: '#/components/schemas/ItemData'

        discounts:
          type: array
          required:
            - name
            - code
          items:
            type: object
            properties:
              name:
                type: string
              code:
                type: string
              attributes:
                type: object
        shipping:
          type: object
          properties:
            shipments:
              $ref: '#/components/schemas/ShipmentsData'
        tracking:
          $ref: '#/components/schemas/Tracking'

    CallbackInventoryCheckV1Request:
      type: object
      allOf:
        - $ref: '#/components/schemas/CallbackV1RequestData'
        - properties:
            callback:
              enum:
                - 'inventory_check'

    CallbackInventoryCheckV1Response:
      type: object
      properties:
        items:
          type: array
          description: List of confirmed items. If missing, all items are assumed available.
          items:
            type: object
            required:
              - line_id
            properties:
              line_id:
                type: string
              max_quantity:
                description: Available quantity. If missing, full quantity is assumed available.
                type: integer
                minimum: 0
                default: Infinity
        checkout:
          type: object
          properties:
            expires_at:
              type: string
              format: datetime
              description: Date and time (UTC) until checkout session should be valid.

    CallbackCheckoutPurchaseV1Request:
      type: object
      allOf:
        - $ref: '#/components/schemas/CallbackV1RequestData'
        - required:
            - order
            - checkout
          properties:
            callback:
              enum:
                - 'checkout_purchase'
            order:
              type: object
              required:
                - id
              properties:
                id:
                  type: string
            checkout:
              type: object
              required:
                - success_url
              properties:
                success_url:
                  allOf:
                    - $ref: '#/components/schemas/Url'

    CallbackCheckoutPurchaseV1Response:
      type: object
      properties:
        checkout:
          $ref: '#/components/schemas/CheckoutSuccess'
