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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.dintero.com/feedback

```json
{
  "path": "/api-reference/draft/complete-a-draft-order",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Complete a draft order

> Use this resource to transition the draft order into an Order. A draft with
multiple sales locations will transition into one order per sales location.

scopes:
- admin:shopping
- write:shopping




## OpenAPI

````yaml /mintlify-docs/openapi/spec-orders.yaml put /accounts/{aid}/shopping/draft_orders/{id}/complete
openapi: 3.0.0
info:
  title: Shopping API
  contact:
    name: API Integration Support
    email: integration@dintero.com
  description: >
    API for cart and orders


    # Changelog


    All notable changes to the API.


    ## 2025-11-30


    > - **new**: Add support for order item with exchange rate information

    >   The new properties can be included when creating and updating draft
    items

    >   and when updating an order

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)

    >   - [POST /v1/accounts/{aid}/shopping/draft_orders/{id}/items
    ](#operation/aid_draft_orders_id_items_post)

    >   - [PUT
    /v1/accounts/{aid}/shopping/draft_orders/{id}/items/{line_id}](#operation/aid_draft_orders_id_items_line_id_put)

    >   - [PUT
    /v1/accounts/{aid}/shopping/orders/{id}](#operation/aid_orders_id_put)


    ## 2025-06-01


    > - **new**: Add support for order item discount_lines with
    `discount_subtype`

    >   The new property can be included when creating and updating draft items

    >   and when updating an order

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)

    >   - [POST /v1/accounts/{aid}/shopping/draft_orders/{id}/items
    ](#operation/aid_draft_orders_id_items_post)

    >   - [PUT
    /v1/accounts/{aid}/shopping/draft_orders/{id}/items/{line_id}](#operation/aid_draft_orders_id_items_line_id_put)

    >   - [PUT
    /v1/accounts/{aid}/shopping/orders/{id}](#operation/aid_orders_id_put)


    ## 2021-01-10


    > - **new** add support for order item status property `order.items.status`.

    >   The new property can be included when creating and updating drafts items
    and

    >   when updating an order.

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)

    >   - [POST /v1/accounts/{aid}/shopping/draft_orders/{id}/items
    ](#operation/aid_draft_orders_id_items_post)

    >   - [PUT
    /v1/accounts/{aid}/shopping/draft_orders/{id}/items/{line_id}](#operation/aid_draft_orders_id_items_line_id_put)

    >   - [PUT
    /v1/accounts/{aid}/shopping/orders/{id}](#operation/aid_orders_id_put)


    > - **new** support updating `order.external_ids`

    >   - [PUT
    /v1/accounts/{aid}/shopping/orders/{id}](#operation/aid_orders_id_put)


    ## 2021-01-08


    > - Extend order item with optional `external_id` property


    > - **new** support updating `order.itinerary`

    >   - [PUT
    /v1/accounts/{aid}/shopping/orders/{id}](#operation/aid_orders_id_put)


    ## 2021-01-06


    > - Extend the draft with `options.generate_order_id=ALPHANUMERIC_9_RESERVE`

    >   The draft `order.order_id` will be set when the new option is used.

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)


    > - Extend the draft options with `multiple_authorizations`

    >   Use `options.multiple_authorizations` to enable support for

    >   multiple authorizations on order items.

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)

    >   - [PUT
    /v1/accounts/{aid}/shopping/orders/{id}](#operation/aid_orders_id_put)

    > - Require `authorization_id` to be included in captures, refunds and

    >   cancellations if order was created with
    `options.multiple_authorizations`

    >   enabled.

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{order_id}/captures](#operation/aid_orders_id_capture_post)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{order_id}/refunds](#operation/aid_orders_id_refunds_post)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{order_id}/cancellations](#operation/aid_orders_id_cancellation_post)


    ## 2021-01-01


    > - **new** support filter orders by: `itinerary_travel_mode`,

    >   `itinerary_arrival_address`, `itinerary_departure_address` and

    >   `items_discount_lines_discount_type`.

    >   - [GET /v1/accounts/{aid}/shopping/orders](#operation/aid_orders_get)


    > - Extend the Order itinerary with new properties

    >   - Add support for `route_id` and `vehicle_id`.

    >   - Add support for `external_ids` in `arrival_address` and

    >     `departure_address`


    > - **new** support `include_events` when updating an order

    >   - [PUT
    /v1/accounts/{aid}/shopping/orders/{id}](#operation/aid_orders_id_put)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{id}/comments](#operation/aid_orders_id_comments_post)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{id}/cancel](#operation/aid_orders_id_cancel_post)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{id}/close](#operation/aid_orders_id_close_post)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{id}/open](#operation/aid_orders_id_open_post)

    >   - [DELETE
    /v1/accounts/{aid}/shopping/orders/{id}/comments/{comment_id}](#operation/aid_orders_id_comments_comment_id_delete)


    > - **new** endpoint for deleting comment

    >   - [DELETE
    /v1/accounts/{aid}/shopping/orders/{id}/comments/{comment_id}](#operation/aid_orders_id_comments_comment_id_delete)


    ## 2020-12-01


    > - Request for creating authorization, capture, refund or cancellation

    >   can fail with `409 Conflict` error.

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{order_id}/authorizations](#operation/aid_orders_id_authorization_post)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{order_id}/captures](#operation/aid_orders_id_capture_post)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{order_id}/refunds](#operation/aid_orders_id_refunds_post)

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{order_id}/cancellations](#operation/aid_orders_id_cancellation_post)


    ## 2020-11-01


    > - Extend the draft options to specify TTL for the order

    >   Use `options.order_time_to_live` to set expiry for when

    >   the order and its draft data will be removed.

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)

    >   - [PUT
    /v1/accounts/{aid}/shopping/orders/{id}](#operation/aid_orders_id_put)


    ## 2020-09-01


    > - Extend payment operations items to include `payout`

    >   for order items that have a payout rule

    >   The new property shows how the payment operation item amounts

    >   should be split by its payout rule destinations

    >   - [captures](#tag/order.captures)

    >   - [cancellations](#tag/order.cancellations)

    >   - [authorizations](#tag/order.authorizations)


    > - Extend endpoint for listing draft and orders to support currency filter

    >   - [GET
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_get)

    >   - [GET /v1/accounts/{aid}/shopping/orders](#operation/aid_orders_get)


    > - Extend the draft options to support replace of existing order.

    >   Use `options.replace="order"` option to replace an order when

    >   the draft is completed. This option is only valid for existing

    >   orders that have no payment operations registered (when draft is
    completed)

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)


    ## 2020-08-01


    > - Extend `include_events` query parameter to support multiple values. The
    parameter accept

    >   now:

    >

    >   - `false`

    >   - `true`

    >   - `api-event`

    >   - `service-event`.

    >

    >   `api-event` will be excluded from the store/customer endpoints:

    >

    >   - [GET
    /v1/accounts/{aid}/shopping/stores/{sid}/orders/](#operation/aid_stores_sid_orders_get)

    >   - [GET
    /v1/accounts/{aid}/shopping/stores/{sid}/orders/{oid}](#operation/aid_stores_sid_orders_id_get)

    >   - [GET
    /v1/accounts/{aid}/shopping/customers/{cid}/orders/](#operation/aid_customers_cid_orders_get)

    >   - [GET
    /v1/accounts/{aid}/shopping/customers/{cid}/orders/{oid}](#operation/aid_customers_cid_orders_id_get)


    > - Support adding comments to an order

    >   - [POST
    /v1/accounts/{aid}/shopping/orders/{id}/comments](#operation/aid_orders_id_comments_post)


    > - Extend the draft options to allow alphanumeric short order_id.

    >   Use `options.generate_order_id` to control the ID format for generated
    `order.order_id`.

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)


    > - Create order with custom order_id. The new property is only supported
    when

    >   creating draft with `split_draft=false`. The `order.order_id` will be
    set to

    >   `order.id` if no order_id is provided.

    >   - [POST
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_post)


    ## 2020-07-01


    > - Extend endpoint for listing draft and orders to support filtering

    >   - [GET
    /v1/accounts/{aid}/shopping/draft_orders](#operation/aid_draft_orders_get)

    >   - [GET /v1/accounts/{aid}/shopping/orders](#operation/aid_orders_get)


    > - Extend order with `external_ids`


    > - Extend order with `external_links`.


    > - Extend order itinerary and attachments

    >   - Add `name` and `id` to itinerary `arrival_address` and

    >     `departure_address. Make all address properties options

    >   - Add `line_ids` and `id` to itinerary and attachments

    >   - Add `operator` to itinerary

    >   - Extend `itinerary.travel_mode` with `CUSTOM`


    > - Extend order events with `event_type` to support event types `api-event`
    and `service-event`.


    > - Extend order event with `draft_id`, a readOnly property that are
    included

    >   in events where the order was created or updated by a draft.


    > - Extend order with `itinerary` and `attachment` for including travel
    details


    > - Extend order items with readOnly `version` property that will be set

    >   when the draft order item is added or updated.


    > - Extend order payment operation definition with

    >   `processed_by` and `payment_details`.


    ## 2020-06-01


    > **[draft](#tag/draft)**

    >

    > - Extend the draft options to allow more control for how payout is
    configured

    > - Extend the draft order items to support including `manual_payout` to
    support

    >   use of any payout rule when calculating the split for the order items.


    > **[draft](#tag/draft)**

    >

    > - Extend order item with `attachment`. Add support for including details

    >   about car, bus and train reservation as attachment in order items.


    ## 2020-05-01


    > **[draft](#tag/draft)**

    >

    > - Add `events` to draft. A event will be added to the draft events list

    >   when the draft is updated.

    > - Add `payout` option to enable calculating the payout for the order items

    >   store id.

    >   See [Billing
    API](https://docs.dintero.com/billing-api.html#operation/aid_billing_payout_rules_get)

    > - Add support for dynamic payout rules via `options.payout.rules`.

    > - Add `order_id` option to allow creating a draft that will be

    >   added to an existing order.

    > - Add `split_draft` option to allow one-to-many mapping between

    >   draft and order

    > - Add support for including store when creating a draft.

    > - Add support for adding draft items with `reversed_reason`

    >   property. Use the property in case when an item should be reversed

    >   and the payment refunded.

    > - Add support for item `related_item.type=reversed`, that should be

    >   used when reversing an existing item.

    > - Add support for negative item `gross_amount` to support reversing items.


    > **[order](#tag/order)**

    >

    > - Include authorizations and cancellations in order details

    > - Include `payment_details` to the order.


    > **[sessions](#tag/order.sessions)**

    > Add support for creating sessions for and order


    > **[refunds](#tag/order.refunds)**

    > Require items to be specified when creating a refund


    > **[captures](#tag/order.captures)**

    > Require items to be specified when creating a capture


    > **[cancellations](#tag/order.cancellations)**

    > Add support for creating cancellations for an order


    > **[authorizations](#tag/order.authorizations)**

    > Add support for creating authorizations for an order


    ## 2019-07-01


    > **[orders](#operation/aid_orders_get)**

    > Extend order definitions with Discounts


    > **[orders](#operation/aid_orders_get)** > **[store
    orders](#operation/aid_stores_sid_orders_get)**

    > add support for `include_events` on order requests. The order event

    > `state` and `events` list will be included in the response.

    >

    > - [GET shopping/orders/](#operation/aid_orders_get)

    > - [GET shopping/orders/{order_id}](#operation/aid_orders_id_get)

    > - [GET
    shopping/customers/{customer_id}/orders/](#operation/aid_customers_cid_orders_get)

    > - [GET
    shopping/customers/{customer_id}/orders/{order_id}](#operation/aid_customers_cid_orders_id_get)

    > - [GET
    shopping/stores/{store_id}/orders/](#operation/aid_stores_sid_orders_get)

    > - [GET
    shopping/stores/{store_id}/orders/{order_id}](#operation/aid_stores_sid_orders_id_get)


    ## 2019-06-01


    > **[draft orders](/#tag/Draft)**

    >

    > - extend draft definition with optional
    `options.serial_order_number_suffix`

    >   property.


    > **[orders](#tag/Order)**

    >

    > - extend order definition with `courier_id` and `pickup_at` that can be
    set

    >   and updated after the order is created

    > - extend order definition with `delivery_id` that can be set after the

    >   the order is created

    > - extend order definition with optional `pre_order` property

    > - extend order definition with optional `type` property.

    > - extend order shipping_address and billing_address property

    >   with optional `comment` property that can be used for additional

    >   information needed for the address.


    > **[events](#tag/Events)**

    >

    > - allow scopes

    >   - `read:shopping:/orders/ANY/events`

    >   - `write:shopping:/orders/ANY/events`


    ## 2019-05-01


    > **[draft orders](#operation/aid_draft_orders_get)**

    >

    > - filter by `status`: _open, completed, deleted_

    > - filter by `created_at.gte` and `created_at.lte`


    > **[customer orders](#operation/aid_customers_cid_orders_get)**

    >

    > - filter by `status`: _open, closed, cancelled_

    > - filter by `payment_status`:

    >   _pending, partially_paid, paid, partially_refunded, refunded_

    > - filter by `created_at.gte` and `created_at.lte`


    > **[store orders](#operation/aid_stores_sid_orders_get)**

    >

    > - filter by `status`: _open, closed, cancelled_

    > - filter by `payment_status`:

    >   _pending, partially_paid, paid, partially_refunded, refunded_

    > - filter by `created_at.gte` and `created_at.lte`


    > **[orders](#operation/aid_orders_get)**

    >

    > - filter by `status`: _open, closed, cancelled_

    > - filter by `payment_status`:

    >   _pending, partially_paid, paid, partially_refunded, refunded_

    > - filter by `created_at.gte` and `created_at.lte`

    > - accept any `customer.id` format


    > **[order payments](#tag/Order-payment)**

    >

    > - require `amount` and `processed_at` when

    >   [creating a refund](#operation/aid_orders_id_refunds_post)

    > - require `amount` and `processed_at` when

    >   [creating a capture](#operation/aid_orders_id_capture_post)


    ## 2019-04-01


    > **[store orders](#tag/Store-Orders)**

    >

    > - Add endpoint for [list orders](#operation/aid_stores_sid_orders_get) for
    a store

    > - Add endpoint for [get order](#operation/aid_stores_sid_orders_id_get)
    for a store


    > **[customer orders](#tag/Customer-Orders)**

    >

    > - Remove uuid format requirement on customer_id path parameter


    > **[complete draft order](#operation/aid_draft_orders_id_complete_put)**

    >

    > - remove support for `apply_discounts` query parameter, the parameter will

    >   only be supported from endpoints updating the draft order.


    ## 2019-03-02


    > **[complete draft order](#operation/aid_draft_orders_id_complete_put)**

    >

    > - change the response to include one or more orders created from the

    >   draft.


    > Rename the API, Shopping API, all endpoints will now be prefixed with

    >

    > - `/v1/accounts/{aid}/shopping/`


    > **[order](#operation/aid_orders_id_get)**

    >

    > - Add `salesperson_id` and `salesperson_name` properties

    > - Add `delivery_at` property for specifying when the order should be

    >   delivered (in the future)


    > **[order item](#operation/aid_orders_id_get)**

    >

    > - Require `percentage` in `tax_lines` for an order item

    > - Add `quantity` property to `item.additions`, and allow negative

    >   `gross_amount`

    > - Add `related_item` property that can be used to create a relationship

    >   between two items

    > - Add `description_alias`, shorter item description for receipt

    > - Add `salesperson_id` and `salesperson_name` property


    ## 2019-02-27


    > **[order item](#operation/aid_orders_id_get)**

    >

    > - Add `metadata` property that can be used to included additional

    >   key/values on order items.

    > - Add `additions` array property. The property can be used to describe

    >   customization the customer want to be included with the order item.

    > - Add `comment` property for recording customer comments on the item


    > **[order](#operation/aid_orders_id_get)**

    >

    > - Add `comment` property for recording customer comments on the order


    # Webhooks


    Use webhooks to get notification on shopping events. See

    [Create new
    subscription](https://docs.dintero.com/api.html#operation/aid_source_hooks_post)

    for details on how to create a webhooks subscription


    ## Events


    Following event types are supported


    | Event                      | Description                              |

    | -------------------------- | ---------------------------------------- |

    | `shopping_draft_add`       | new draft order created                  |

    | `shopping_draft_update`    | existing draft order updated             |

    | `shopping_draft_complete`  | draft completed, includes orders created |

    | `shopping_order_update`    | existing order updated                   |

    | `shopping_order_event_add` | new event added to order                 |
  version: LATEST
  license:
    name: UNLICENSED
    url: https://dintero.com
  x-logo:
    url: https://docs.dintero.com/img/dintero-dark-padded.svg
    altText: Dintero Logo
servers:
  - url: https://api.dintero.com/v1
  - url: https://test.dintero.com/v1
security:
  - JWT: []
tags:
  - name: order.sessions
    x-displayName: Session
    description: Manage order sessions
  - name: order.authorizations
    description: Manage order authorizations
    x-displayName: Authorizations
  - name: order.captures
    description: Manage order captures
    x-displayName: Captures
  - name: order.refunds
    description: Manage order refunds
    x-displayName: Refunds
  - name: order.cancellations
    description: Manage order cancellations
    x-displayName: Cancellations
  - name: draft
    description: Manage draft
    x-displayName: Draft
  - name: draft.items
    description: Manage draft items
    x-displayName: Draft items
  - name: order
    description: Manage order
    x-displayName: Order
  - name: order.comments
    description: Manage order comments
    x-displayName: Comments
  - name: order.events
    description: Manage order events
    x-displayName: Events
  - name: order.status
    description: Manage order status
    x-displayName: Status
  - name: order.list
    description: View orders
    x-displayName: Collections
  - name: customer.order
    description: View customer orders
    x-displayName: Customer
  - name: store.order
    description: View store orders
    x-displayName: Store
paths:
  /accounts/{aid}/shopping/draft_orders/{id}/complete:
    put:
      tags:
        - draft
      summary: Complete a draft order
      description: >
        Use this resource to transition the draft order into an Order. A draft
        with

        multiple sales locations will transition into one order per sales
        location.


        scopes:

        - admin:shopping

        - write:shopping
      operationId: aid_draft_orders_id_complete_put
      parameters:
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/ResourceId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
        description: draft order resource
        required: true
      responses:
        '200':
          $ref: '#/components/responses/DraftOrderComplete'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/AccessForbidden'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  parameters:
    accountId:
      name: aid
      description: |
        An id that uniquely identifies the account.
      in: path
      required: true
      schema:
        type: string
        format: ^[PT]{1}\d{8}$
        minLength: 9
        maxLength: 9
    ResourceId:
      name: id
      in: path
      description: The resource identifier string
      required: true
      schema:
        type: string
        format: uuid
  responses:
    DraftOrderComplete:
      description: Draft completed
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BasicDraft'
              - required:
                  - orders
                properties:
                  orders:
                    type: array
                    minItems: 1
                    items:
                      $ref: '#/components/schemas/Order'
    BadRequest:
      description: Bad / Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    AccessForbidden:
      description: Access forbidden, invalid JWT token was used
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    BasicDraft:
      type: object
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        created_at:
          readOnly: true
          description: |
            The date-time when the resource was created
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        created_by:
          readOnly: true
          description: |
            The ID of the user/client created the resource
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        updated_at:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
          description: |
            The date-time when the resource was last updated
        deleted_by:
          readOnly: true
          description: |
            The ID of the user/client created the resource
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        deleted_at:
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
          readOnly: true
        status:
          type: string
          readOnly: true
          description: >
            The status of the DraftOrder as it transitions into an Order.


            Status is set to `completed` when the DraftOrder is completed and an

            Order is created


            After a DraftOrder is set to `completed` the only further
            modification

            that can be made are adding notes or metadata fields
          default: open
          enum:
            - open
            - completed
            - deleted
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/Link'
    Order:
      type: object
      allOf:
        - $ref: '#/components/schemas/Entity'
        - $ref: '#/components/schemas/OrderCancelledState'
        - $ref: '#/components/schemas/OrderCloseState'
        - $ref: '#/components/schemas/OrderStatusState'
        - $ref: '#/components/schemas/OrderObject'
        - $ref: '#/components/schemas/OrderOperations'
        - $ref: '#/components/schemas/OrderDiscounts'
        - $ref: '#/components/schemas/OrderStore'
        - $ref: '#/components/schemas/OrderAttachments'
        - $ref: '#/components/schemas/OrderComments'
        - properties:
            order_id:
              type: string
              maxLength: 255
              minLength: 1
            pickup_at:
              type: string
              format: date-time
              description: |
                Requested pickup time for the courier
            courier_id:
              type: string
              description: |
                Id of the courier responsible for the delivery
            delivery_id:
              type: string
            _links:
              type: array
              description: The links related to resource
              readOnly: true
              items:
                $ref: '#/components/schemas/Link'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            code:
              type: string
              description: The code used to identify the error/warning
            errors:
              type: array
              description: The nested error(s) encountered during validation
              items:
                type: object
            message:
              type: string
              description: The human readable description of the error/warning
    ResourceId:
      type: string
      description: The resource ID. Defaults to UUID v4
      maxLength: 40
      example: bd04c959-d159-49b4-a096-2d84e014a8da
    ServerTimestamp:
      type: string
      description: Read-only timestamp, automatically assigned on back-end.
      format: date-time
      readOnly: true
    Link:
      type: object
      properties:
        href:
          description: The link URL
          type: string
        rel:
          description: The link type
          type: string
          enum:
            - draft
            - events
            - order
            - receipt
            - self
            - session
            - session-checkout
            - transaction
      required:
        - href
        - rel
    Entity:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: |
            An UUID that uniquely identifies the resource
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was created
          readOnly: true
        created_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was last updated
          readOnly: true
        deleted_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        deleted_at:
          type: string
          format: date-time
          readOnly: true
    OrderCancelledState:
      type: object
      properties:
        cancelled_reason:
          description: |
            The reason why the order was canceled.

            - **customer**: The customer cancelled the order
            - **declined**: The payment was declined
            - **other**: Any reson
          example: customer
        cancelled_by:
          description: |
            The ID of the user/client that cancelled the order
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        cancelled_at:
          description: |
            The date and time ( ISO 8601 format) when the order was canceled.
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    OrderCloseState:
      type: object
      properties:
        closed_by:
          description: |
            The ID of the user/client that cancelled the order
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        closed_at:
          description: |
            The date and time ( ISO 8601 format) when the order was canceled.
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    OrderStatusState:
      type: object
      properties:
        status:
          description: |
            Order status
          readOnly: true
          default: open
          type: string
          enum:
            - open
            - closed
            - cancelled
        payment_status:
          description: |
            The status of payments associated with the order

            - **pending**: The payments are pending
            - **paid**: The payments has been paid
            - **partially_refunded**: The payments has been partially refunded
            - **refunded**: The payments has been partially refunded
          type: string
          readOnly: true
          default: pending
          enum:
            - pending
            - partially_paid
            - paid
            - partially_refunded
            - refunded
    OrderObject:
      allOf:
        - $ref: '#/components/schemas/OrderUpdate'
        - required:
            - currency
          properties:
            version:
              type: integer
              readOnly: true
              description: |
                The version of the order. Incremented when the order
                is updated.
            type:
              type: string
              description: |
                Describe the type of an order.
              example: delivery
            order_number:
              type: string
              example: order123456
            currency:
              type: string
              format: iso-4217
              example: NOK
              maxLength: 3
              description: |
                The tree-character ISO-4217 currency
            order_id:
              type: string
              description: |
                The order id, defaults to the resource id, UUID.
                > Requires split_draft option to be disabled.
              maxLength: 255
              minLength: 1
            items:
              type: array
              minItems: 1
              items:
                $ref: '#/components/schemas/LineItem'
            time_to_live_expires_at:
              type: string
              format: data-time
              description: |
                The date-time when the resource expires.
            multiple_authorizations:
              type: boolean
              description: |
                Allow multiple authorizations per order item
    OrderOperations:
      type: object
      properties:
        payment_details:
          allOf:
            - $ref: '#/components/schemas/OrderPaymentDetails'
            - properties:
                amount_due:
                  type: integer
                  example: 27840
                  description: |
                    The amount due. The value will be negative if a refund
                    is required to close the order.
                    Monetary amount in smallest unit for the currency
                remaining_authorization_amount:
                  $ref: '#/components/schemas/Amount'
        sessions:
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/OrderSession'
          description: |
            A list of sessions for this order
        authorizations:
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/OrderAuthorization'
          description: |
            A list of authorizations for this order
        captures:
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/OrderCapture'
          description: |
            A list of captures for this order
        refunds:
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/OrderRefund'
          description: |
            A list of refunds for this order
        cancellations:
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/OrderCancellation'
          description: |
            A list of cancellations for this order
    OrderDiscounts:
      type: object
      properties:
        discounts:
          type: array
          readOnly: true
          items:
            type: object
            properties:
              id:
                type: string
              refs:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    amount:
                      type: number
                    statistics:
                      type: object
                      properties:
                        amount:
                          type: number
                        stamp:
                          type: number
                        usage:
                          type: number
                    stamp:
                      type: number
                    usages:
                      type: number
                    items:
                      type: array
                      items:
                        type: object
                        properties:
                          line_id:
                            type: number
                          amount:
                            type: number
    OrderStore:
      type: object
      properties:
        store:
          allOf:
            - $ref: '#/components/schemas/SalesLocation'
            - properties:
                comments:
                  type: array
                  description: |
                    List of all sales location comments
                  items:
                    type: string
                    maxLength: 255
                  maximum: 1000
    OrderAttachments:
      type: object
      properties:
        external_ids:
          type: array
          items:
            $ref: '#/components/schemas/OrderExternalId'
        external_links:
          type: array
          items:
            $ref: '#/components/schemas/OrderExternalLink'
        itinerary:
          type: array
          items:
            $ref: '#/components/schemas/OrderTravelItinerary'
        attachments:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              bus_reservation:
                $ref: '#/components/schemas/LineItemReservationAttachment'
              car_reservation:
                $ref: '#/components/schemas/LineItemReservationCarAttachment'
              ferry_reservation:
                $ref: '#/components/schemas/LineItemReservationAttachment'
              metro_reservation:
                $ref: '#/components/schemas/LineItemReservationAttachment'
              taxi_reservation:
                $ref: '#/components/schemas/LineItemReservationAttachment'
              train_reservation:
                $ref: '#/components/schemas/LineItemReservationAttachment'
              tram_reservation:
                $ref: '#/components/schemas/LineItemReservationAttachment'
    OrderComments:
      type: object
      properties:
        comments:
          type: array
          readOnly: true
          items:
            $ref: '#/components/schemas/OrderComment'
    OrderUpdate:
      type: object
      properties:
        customer:
          $ref: '#/components/schemas/Customer'
        gross_amount:
          allOf:
            - $ref: '#/components/schemas/GrossAmount'
          readOnly: true
          example: 59800
        net_amount:
          allOf:
            - $ref: '#/components/schemas/NetAmount'
          example: 47840
          readOnly: true
        total_discount:
          type: integer
          example: 23130
          minimum: 0
          readOnly: true
          description: |
            Monetary amount in smallest unit for the currency
        total_manual_discount_amount:
          type: integer
          example: 0
          minimum: 0
          readOnly: true
          description: Monetary amount in smallest unit for the currency
        shipping_address:
          $ref: '#/components/schemas/ContactObject'
        billing_address:
          $ref: '#/components/schemas/ContactObject'
        metadata:
          type: object
          description: |
            Additional data related to the order
        comment:
          type: string
          maxLength: 255
          description: |
            Comment on the order
        salesperson_id:
          type: string
          description: |
            Id of the sales person if other then the operator
        salesperson_name:
          type: string
          description: |
            Name of the sales person
        delivery_at:
          type: string
          format: date-time
          description: >
            Requested delivery time by the customer, default value is ASAP
            relative to

            when the order was created.
        pickup_at:
          type: string
          format: date-time
          description: |
            Requested pickup time for the courier
        courier_id:
          type: string
          description: |
            Id of the courier responsible for the delivery
        pre_order:
          type: boolean
          description: >
            Customer requested the delivery to be later, i.e not ASAP, see
            delivery_at

            for when the delivery should be completed.
        time_to_live:
          type: integer
          example: 94672800
          minimum: 86400
          description: |
            Time-To-Live (TTL) for the order created in seconds.
            The value is interpreted as a delta from the time that an
            order was last modified (update_at).

            All drafts related to an order will be deleted when the TTL
            expires and the order will be emptied for all data except

              - order_number
              - order_id
              - external_ids
              - created_at
              - updated_at
              - deleted_at
        itinerary:
          type: array
          items:
            $ref: '#/components/schemas/OrderTravelItinerary'
        external_ids:
          type: array
          items:
            $ref: '#/components/schemas/OrderExternalId'
        items:
          type: array
          description: |
            Update status on order items
          items:
            type: object
            properties:
              status:
                type: string
    LineItem:
      type: object
      required:
        - gross_amount
        - tax_lines
      properties:
        id:
          type: string
          description: |
            The ID or SKU of the product on the line
          example: '175938'
        status:
          type: string
          description: The item status
        metadata:
          type: object
          description: |
            Additional details about the item, key values will be included
            as `extra_info` in the receipt.
        groups:
          type: array
          description: |
            The groups the product on the line belongs to
          example:
            - id: B234
              name: Stol
            - id: B1
              name: Møbel
          items:
            type: object
            required:
              - id
            properties:
              id:
                type: string
                description: group id
              name:
                type: string
                description: group name
        line_id:
          type: integer
          description: |
            The number of the line (or id), must be unique between all items.
          example: 1
        quantity:
          type: number
          description: |
            The quantity of the product in the item line.
          example: 2
          default: 1
        gross_amount:
          allOf:
            - $ref: '#/components/schemas/GrossAmount'
        net_amount:
          allOf:
            - $ref: '#/components/schemas/NetAmount'
          readOnly: true
        tax_lines:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/TaxItem'
        description:
          type: string
          example: Stablestol for utendørsbruk
        description_alias:
          type: string
          description: |
            Short description / title of the product
          example: Staplestol
        is_changed:
          type: boolean
          default: false
          description: |
            Discount applied to gross amount
          readOnly: true
        eligible_for_discount:
          type: boolean
          example: true
        dimension:
          $ref: '#/components/schemas/Dimension'
        discount_lines:
          type: array
          items:
            $ref: '#/components/schemas/DiscountItem'
        additions:
          type: array
          description: |
            Additions, customization of the item. The gross_amount
            for an `addition` should be included in the item `gross_amount` and
            included in the `tax_lines` if applicable.
          items:
            type: object
            properties:
              id:
                example: C1203
                type: string
              description:
                type: string
                example: Extra Cheese
              quantity:
                type: number
                description: |
                  The quantity of the addition
                default: 1
              gross_amount:
                example: 1000
                allOf:
                  - $ref: '#/components/schemas/Amount'
              groups:
                type: array
                description: |
                  The groups the product on the line belongs to
                example:
                  - id: B234
                    name: Stol
                  - id: B1
                    name: Møbel
                items:
                  type: object
                  required:
                    - id
                  properties:
                    id:
                      type: string
                      description: group id
                    name:
                      type: string
                      description: group name
        store:
          allOf:
            - $ref: '#/components/schemas/SalesLocation'
            - properties:
                comment:
                  type: string
                  description: |
                    Comment to the sales location
                  maxLength: 255
        external_id:
          type: string
          example: SL02-94821948
          description: External ID related to the item.
        related_item:
          type: object
          description: >
            Relationship with another line item.


            An item with a `required` relationship with another line item

            will be removed from the order if the related item is removed


            An item with `optional` relationship will remain in the order if

            the related line is removed, the `related_item` will be cleared as
            the

            line it relates to does not exist anymore


            An item with `reversed` relationship is an item that is reversing

            another item. An item with the `reversed` relationship we be

            removed from the order if the related item is removed
          required:
            - line_id
            - type
          properties:
            line_id:
              type: integer
            type:
              type: string
              enum:
                - required
                - optional
                - reversed
        salesperson_id:
          type: string
          description: |
            Id of the sales person if other then the operator
        salesperson_name:
          type: string
          description: |
            Name of the sales person
        comment:
          type: string
          maxLength: 255
          description: |
            comment on the item
        version:
          type: number
          readOnly: true
        reversed_reason:
          type: string
          description: |
            Reverse the item from an order

            Applicable only if the draft is created to update an
            existing order
        dynamic_payout:
          description: |
            Specify the payout rule that should be used when calculating the
            payout split for this item.
          required:
            - rule_type
            - rule_id
          properties:
            rule_type:
              type: string
            rule_id:
              type: string
        payout:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/SplitPayout'
        original_currency:
          type: string
          format: iso-4217
          example: SEK
          maxLength: 3
          description: |
            Representing the currency in which the item was originally priced
        original_gross_amount:
          type: integer
          example: 39800
          description: |
            Monetary amount in smallest unit for the original currency
        conversion_rate_ppm:
          type: integer
          example: 1099000
          description: |
            Scaled integer (parts per million) representing the conversion rate
            used to translate `original_currency` gross amount into the orders
            `currency`.

            Example: If 1 SEK = 1.099 NOK, then `conversion_rate_ppm = 1099000`
        conversion_rate_timestamp:
          type: string
          format: date-time
          description: |
            The timestamp indicating when the exchange rate was determined.
        conversion_rate_source:
          type: string
          description: Identifier of the source of the exchange rate
          example: ecb
    OrderPaymentDetails:
      type: object
      readOnly: true
      properties:
        remaining_capture_amount:
          $ref: '#/components/schemas/Amount'
        remaining_refund_amount:
          $ref: '#/components/schemas/Amount'
        remaining_cancellation_amount:
          $ref: '#/components/schemas/Amount'
    Amount:
      type: integer
      example: 27840
      description: |
        Monetary amount in smallest unit for the currency
    OrderSession:
      type: object
      required:
        - items
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        created_at:
          readOnly: true
          description: |
            The date-time when the resource was created
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        created_by:
          readOnly: true
          description: |
            The ID of the user/client created the resource
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        amount:
          readOnly: true
          type: integer
          example: 27840
          description: |
            Monetary amount in smallest unit for the currency  success:
              description: |
                The result from the operation.
              type: boolean
        items:
          description: |
            Selected items from the order
          type: array
          items:
            allOf:
              - required:
                  - line_id
                properties:
                  amount:
                    readOnly: true
                    type: integer
                    example: 27840
                    description: |
                      Monetary amount in smallest unit for the currency
                  line_id:
                    type: string
                    description: |
                      Selected order items to include in the session
        processed_at:
          type: string
          format: date-time
          description: |
            The date and time when the capture was processed by payment
            gateway
        metadata:
          type: object
          description: |
            Additional details about the operation
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          items:
            $ref: '#/components/schemas/Link'
    OrderAuthorization:
      allOf:
        - $ref: '#/components/schemas/OrderOperationItems'
        - $ref: '#/components/schemas/OrderOperationRead'
    OrderCapture:
      allOf:
        - $ref: '#/components/schemas/OrderOperationItems'
        - $ref: '#/components/schemas/OrderOperationRead'
    OrderRefund:
      allOf:
        - $ref: '#/components/schemas/OrderOperationItems'
        - $ref: '#/components/schemas/OrderOperationRead'
    OrderCancellation:
      allOf:
        - $ref: '#/components/schemas/OrderOperationItems'
        - $ref: '#/components/schemas/OrderOperationRead'
    SalesLocation:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          example: SL02
        organization_number:
          type: string
          example: 123456789MVA
        name:
          type: string
          description: |
            name of the store, aka trade name of the store
          example: SC Oslo
        business_name:
          type: string
          description: |
            Official name of the person or entity that owns the store.
          example: SC Oslo AS
    OrderExternalId:
      description: >-
        External IDs related to the order. Search on all external ids are
        supported
      type: object
      required:
        - id
        - source
      properties:
        id:
          type: string
        source:
          type: string
        description:
          type: string
    OrderExternalLink:
      description: Link to external resources
      type: object
      required:
        - text
        - href
      properties:
        text:
          type: string
          example: Order Receipt
          description: |
            The Link text that will be visible to the reader
        href:
          description: |
            The URL to the external resource
          type: string
          format: uri
          example: >-
            https://example.dintero.com/receipts/234CC019-8BA9-4DDB-9A40-8C9EE0BB943C?type=pdf
        public:
          description: |
            The external resources is public and requires no
            aditional authorization.
          type: boolean
    OrderTravelItinerary:
      type: object
      description: |
        Travel itinerary leg
      properties:
        id:
          type: string
        operator:
          type: string
        arrival_address:
          $ref: '#/components/schemas/OrderItineraryAddress'
        arrival_at:
          type: string
          format: datetime
        departure_address:
          $ref: '#/components/schemas/OrderItineraryAddress'
        departure_at:
          type: string
          format: datetime
        travel_mode:
          $ref: '#/components/schemas/ItineraryTravelMode'
        route_id:
          type: string
        vehicle_id:
          type: string
        summary:
          type: string
        distance:
          required:
            - value
          properties:
            value:
              type: integer
              format: meter
        duration:
          type: object
          required:
            - value
          properties:
            value:
              type: integer
              format: minute
        tickets:
          type: array
          minItems: 1
          items:
            properties:
              class:
                type: string
              line:
                type: string
              seat:
                type: string
              zone:
                type: string
              passenger_id:
                type: array
                minItems: 1
                items:
                  type: string
        line_ids:
          type: array
          description: |
            related order items
          minItems: 1
          items:
            type: integer
        waypoints:
          type: array
          items:
            type: object
            required:
              - latitude
              - longitude
            properties:
              display_name:
                type: string
              latitude:
                type: number
              longitude:
                type: number
              arrival_schedule_at:
                type: string
                format: datetime
              departure_schedule_at:
                type: string
                format: datetime
    LineItemReservationAttachment:
      type: object
      properties:
        booking_id:
          type: string
          description: |
            Trip booking number
          example: NE 138 47794
        line_ids:
          type: array
          description: |
            related order items
          minItems: 1
          items:
            type: integer
        passengers:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              id:
                type: string
              title:
                type: string
              first_name:
                type: string
              last_name:
                type: string
        itinerary:
          type: array
          description: Itineray data, one item per segment
          minItems: 1
          items:
            type: object
            properties:
              departure_address:
                $ref: '#/components/schemas/Address'
              departure_at:
                type: string
                format: date-time
              arrival_address:
                $ref: '#/components/schemas/Address'
              arrival_at:
                type: string
                format: date-time
              operator:
                type: string
                example: SAS
              class:
                type: string
              line:
                type: string
              seat:
                type: string
              zone:
                type: string
              expires_at:
                type: string
                format: date-time
              activates_at:
                type: string
                format: date-time
              passenger_id:
                type: array
                minItems: 1
                items:
                  type: string
        insurance:
          type: array
          description: Insurance data
          minItems: 1
          items:
            $ref: '#/components/schemas/LineItemIsuranceAttachment'
    LineItemReservationCarAttachment:
      type: object
      properties:
        booking_id:
          type: string
          description: |
            Trip booking number
          example: TV 347794
        line_ids:
          type: array
          description: |
            related order items
          minItems: 1
          items:
            type: integer
        itinerary:
          type: array
          minItems: 1
          description: Car itineray data
          items:
            type: object
            properties:
              rental_company:
                type: string
                example: Avis
              drivers_id:
                type: array
                items:
                  type: string
              pick_up_address:
                $ref: '#/components/schemas/Address'
              pick_up_at:
                type: string
                format: date-time
              drop_off_address:
                $ref: '#/components/schemas/Address'
              drop_off_at:
                type: string
                format: date-time
              class:
                type: string
        drivers:
          type: array
          minItems: 1
          items:
            type: string
        insurance:
          type: array
          description: Insurance data
          minItems: 1
          items:
            $ref: '#/components/schemas/LineItemIsuranceAttachment'
    OrderComment:
      type: object
      required:
        - body
      properties:
        id:
          type: string
          description: |
            An id that uniquely identifies the resource
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was created
          readOnly: true
        created_by:
          type: string
          description: |
            The ID of the user/client created the resource
          readOnly: true
        deleted_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        deleted_at:
          type: string
          format: date-time
          readOnly: true
        body:
          type: string
        visibility:
          type: string
          enum:
            - private
            - public
          default: private
          description: >
            The comment is private, hidden from the
            [customer](#tag/customer.order)
    Customer:
      type: object
      allOf:
        - $ref: '#/components/schemas/Person'
        - properties:
            id:
              type: string
              maxLength: 255
              description: |
                The customer id identifying the customer.
                (must not have trailing or leading spaces)
            gender:
              type: string
              example: male
            email:
              type: string
              example: customer@example.com
            metadata:
              type: object
              description: |
                A set of key/value pairs that you can attach to a
                customer object. It can be useful for storing additional
                information about the customer in a structured format.
              example:
                dob_year: 1985
            phone_number:
              type: string
              description: |
                A phone number in E.164 number formatting.
              format: ^\+?[1-9]\d{1,14}$
              example: '+4799999999'
            addresses:
              type: array
              items:
                allOf:
                  - $ref: '#/components/schemas/Address'
                  - properties:
                      type:
                        type: string
                      custom_type:
                        type: string
            pays_tax:
              type: boolean
              description: |
                Is customer required to pay tax
              example: false
            date_of_birth:
              format: date
              example: '1990-09-20'
              nullable: true
              type: string
            enrolled_by:
              type: object
              required:
                - value
              description: The source that recruited the customer
              properties:
                type:
                  type: string
                  description: |
                    Enrollment type, e.g. `url`, `store`, `qr_code`, any string
                  example: url
                value:
                  example: https://facebook.com
                  nullable: true
                  type: string
            favorite_store:
              description: customer favorite store
              nullable: true
              type: string
            company:
              type: object
              required:
                - bussiness_name
              description: |
                Company details, supported when type is Company
              properties:
                organization_number:
                  type: string
                  description: Companys identification number
                  example: 123456789MVA
                bussiness_name:
                  type: string
                  example: TKP tech AS
                department:
                  type: string
                  description: companys department
                  example: sales department
                industry:
                  type: string
                  example: computer industry
                website:
                  type: string
                number_of_employees:
                  type: string
            marketing_consent:
              type: object
              description: Customers consent for marketing in different channels
              properties:
                sms:
                  type: object
                  properties:
                    consent:
                      type: boolean
                      example: true
                    updated_at:
                      readOnly: true
                      type: string
                      format: date-time
                      example: '2018-01-12T13:42:00Z'
                      description: |
                        The date-time when the resource was last updated:
                email:
                  type: object
                  properties:
                    consent:
                      type: boolean
                      example: true
                    updated_at:
                      readOnly: true
                      type: string
                      format: date-time
                      example: '2018-01-12T13:42:00Z'
                      description: |
                        The date-time when the resource was last updated:
            status:
              type: string
              description: |
                Status of the customer
            term:
              description: The term and condition accepted by the customer
              properties:
                id:
                  type: string
            type:
              type: string
              enum:
                - customer
                - company
                - contact
                - employee
                - other
              description: |
                Describe type of an customer.
                Company only allowed to be set when the type is "Company"
    GrossAmount:
      type: integer
      example: 39800
      description: |
        Monetary amount in smallest unit for the currency
        before discounts
    NetAmount:
      type: integer
      example: 27840
      description: |
        Monetary amount in smallest unit for the currency
        after discounts
    ContactObject:
      type: object
      allOf:
        - $ref: '#/components/schemas/Address'
        - $ref: '#/components/schemas/Person'
        - properties:
            comment:
              type: string
              description: |
                Comment about the address
              example: 5th floor, use doorbell.
    TaxItem:
      type: object
      properties:
        amount:
          type: integer
          example: 5584
          description: |
            Monetary amount in smallest unit for the currency
        amount_dwh:
          type: string
          example: '5584.0440'
          description: Monetary value with decimal
        exempt:
          type: boolean
          example: false
        included_in_price:
          type: boolean
          example: true
        percentage:
          type: number
          example: 25
        tax_basis:
          type: integer
          example: 27920
          description: Total monetary value without tax
        tax_basis_dwh:
          type: string
          example: '27920.22'
          description: Total monetary value without tax in decimal
        tax_code:
          type: string
          example: '3'
        tax_group:
          type: string
          example: Vmva-høy
    Dimension:
      type: object
      description: |
        Identify item attributes, such as size and color
      properties:
        color:
          type: string
        size:
          type: string
        style:
          type: string
        config:
          type: string
        variant:
          type: string
    DiscountItem:
      type: object
      required:
        - amount
      properties:
        amount:
          type: integer
          example: 23130
          description: |
            Monetary amount in smallest unit for the currency
        percentage:
          type: number
          description: |
            Optional, set if the amount given was from a percentage discount
          example: 10
        discount_type:
          type: string
          enum:
            - customer
            - periodic
            - manual
            - loyalty
            - total
            - employee
            - external
        discount_subtype:
          type: string
          description: |
            Custom subtype details
          maxLength: 120
          example: campaign-periode-q3
        discount_id:
          type: string
          example: 766da0ef-9283-42bd-b012-0582344ec53c
        description:
          type: string
        line_id:
          type: integer
          example: 1
    SplitPayout:
      description: |
        The payout split calculated for the item
      allOf:
        - $ref: '#/components/schemas/BillingPayoutRule'
        - example:
            destinations:
              - type: percentage
                value: '10'
                amount: 4000
                destinations:
                  - amount: 500
                  - destinations:
                      - amount: 3500
              - amount: 500
              - destinations:
                  - amount: 192
                  - amount: 38308
    OrderOperationItems:
      type: object
      required:
        - items
      properties:
        items:
          description: |
            Selected items from the order
          type: array
          items:
            type: object
            required:
              - amount
              - line_id
            properties:
              amount:
                $ref: '#/components/schemas/Amount'
              line_id:
                type: integer
        processed_at:
          type: string
          format: date-time
          description: >
            The date and time when the payment operation was processed by
            payment

            gateway
        processed_by:
          type: string
          description: |
            The gateway the processed the payment operation
          example: dintero-checkout
        payment_details:
          type: object
          properties:
            psp:
              type: string
              example: Bambora
            payment_id:
              type: string
            payment_product:
              type: string
              example: bambora
            payment_product_type:
              type: string
              example: bambora.creditcard
            card:
              $ref: '#/components/schemas/OrderOperationCard'
        metadata:
          type: object
          description: |
            Additional details about the operation
    OrderOperationRead:
      type: object
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        created_at:
          readOnly: true
          description: |
            The date-time when the resource was created
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        created_by:
          readOnly: true
          description: |
            The ID of the user/client created the resource
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        amount:
          readOnly: true
          type: integer
          example: 27840
          description: >
            Total monetary amount for the operation in smallest unit for the
            currency
        success:
          description: |
            The result from the operation.
          type: boolean
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          items:
            $ref: '#/components/schemas/Link'
        items:
          type: array
          items:
            type: object
            properties:
              payout:
                type: object
                readOnly: true
                description: |
                  Describe the payout for the operation item
                required:
                  - rule_id
                  - rule_type
                  - destinations
                properties:
                  rule_id:
                    type: string
                  rule_type:
                    type: string
                  destinations:
                    type: array
                    readOnly: true
                    minItems: 1
                    description: |
                      How the operation monetary amount should be split given
                      the payout rule. The items are aggregated by destination
                    items:
                      type: object
                      required:
                        - destination
                        - amount
                      properties:
                        destination:
                          type: string
                          description: |
                            The destination reciving the payout
                        amount:
                          type: integer
                          description: |
                            The monetary amount reserved for the destination
        authorization_id:
          description: |
            The authorization for this operation. Only included if the order
            was created with `multiple_authorizations` option enabled
          allOf:
            - $ref: '#/components/schemas/ResourceId'
    OrderItineraryAddress:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        address_line:
          type: string
          example: Sommerkroveien 34
        address_line_2:
          type: string
          example: PB 123
        postal_code:
          type: string
          example: '0349'
        postal_place:
          type: string
          example: Oslo
        latitude:
          type: number
          example: 59.942112
        longitude:
          type: number
          example: 10.716991
        country:
          type: string
          format: iso3166-alpha2
          description: |
            ISO 3166-1 country code
          example: 'NO'
        external_ids:
          description: |
            External IDs related to the address.
          items:
            type: object
            required:
              - id
              - source
            properties:
              id:
                type: string
              source:
                type: string
              description:
                type: string
    ItineraryTravelMode:
      type: string
      enum:
        - BUS
        - CAR
        - FERRY
        - METRO
        - TAXI
        - TRAIN
        - TRAM
        - WALK
        - WAIT
        - CUSTOM
    Address:
      type: object
      required:
        - address_line
        - postal_place
        - country
      properties:
        address_line:
          type: string
          example: Sommerkroveien 34
        address_line_2:
          type: string
          example: PB 123
        postal_code:
          type: string
          example: '0349'
        postal_place:
          type: string
          example: Oslo
        latitude:
          type: number
          example: 59.942112
        longitude:
          type: number
          example: 10.716991
        country:
          type: string
          format: iso3166-alpha2
          description: |
            ISO 3166-1 country code
          example: 'NO'
    LineItemIsuranceAttachment:
      type: object
      description: Insurance data
      properties:
        insurance_company:
          type: string
        insurance_type:
          type: string
    Person:
      type: object
      properties:
        first_name:
          type: string
          example: John
        last_name:
          type: string
          example: Doe
    BillingPayoutRule:
      type: object
      description: |
        A Payout rule describes how a payout should be
        splitted between multiple destinations.
      required:
        - rule_id
        - rule_type
        - destinations
      properties:
        account_id:
          type: string
          description: |
            An id that uniquely identifies the account.
          format: ^[PT]{1}\d{8}$
          readOnly: true
        rule_type:
          type: string
          example: order.items.store.id
        rule_id:
          type: string
          description: |
            Unique ID given the rule type.
          example: sc029
        rule_version:
          readOnly: true
          type: number
          format: integer
          example: 1
        destinations:
          description: >
            Destinations for the payout splits tree. The splitting is done

            in the order of the destinations.


            - A destination must include a `destination` or `destinations`.

            - The destination `value` is required for destinations with type
            `percentage` and `flat_amount`
          type: array
          items:
            $ref: '#/components/schemas/BillingPayoutRuleDestination'
          example:
            - type: percentage
              value: 10
              destinations:
                - type: flat_amount
                  value: '500'
                  destination: account-a
                - type: remaining_amount
                  destinations:
                    - type: percentage
                      value: '5.0'
                      destination: account-b
            - type: flat_amount
              value: '500'
              destination: account-a
            - type: remaining_amount
              destinations:
                - type: percentage
                  value: '5'
                  destination: account-b
                - type: percentage
                  value: '95.0'
                  destination: account-c
        metadata:
          type: object
          maxProperties: 10
          description: |
            Additional metadata about the payout rule
    OrderOperationCard:
      type: object
      properties:
        masked_pan:
          type: string
          example: 4444 **** **** 4448
        type:
          type: string
          example: Credit
        brand:
          type: string
          example: Visa
        metadata:
          type: object
          description: |
            Additional details about the payment
    BillingPayoutRuleDestination:
      type: object
      description: |
        Destination for a split.

        - A destination must have `destination` or `destinations` set, not both.
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - percentage
            - flat_amount
            - remaining_amount
        value:
          description: >
            The value that will be used for the payout to the destination or
            destinations.
          type: string
          format: numeric
        destination:
          type: string
          example: account-123
        destinations:
          type: array
          description: |
            Array of sub destinations.
          minItems: 1
          items:
            $ref: '#/components/schemas/BillingPayoutRuleDestinationNested'
        amount:
          readOnly: true
          type: integer
    BillingPayoutRuleDestinationNested:
      type: object
      description: |
        Destination for a split.

        - A destination must have `destination` or `destinations` set, not both.
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - percentage
            - flat_amount
            - remaining_amount
        value:
          description: >
            The value that will be used for the payout to the destination or
            destinations.
          type: string
          format: numeric
        destination:
          type: string
          example: account-123
        destinations:
          type: array
          description: |
            Array of sub destinations.
          minItems: 1
          items:
            type: object
        amount:
          readOnly: true
          description: >
            The split payout calculated for this destination or list of
            destinations.
          type: integer
  securitySchemes:
    JWT:
      type: http
      description: >
        Bearer authentication (token authentication) should be used for
        accessing the API.


        Use [Get
        Token](https://docs.dintero.com/api.html#operation/aid_auths_oauth_token_post)
        to get an access token for client credentials.

        Pass the token in the request header:

            Authorization: Bearer {access_token}

        where the **access_token** is JSON Web Tokens (JWT).
      scheme: bearer
      bearerFormat: JWT

````