title: Swaps
domain: store
routes:
  - method: GET
    path: /swaps/:cart_id
  - method: POST
    path: /swaps
route: /swaps
description: >
  A swap represents an order, that are created in the process of swapping items in an existing order. In the context of the store, the swap can be retrieved in order to make the payment (if relevant). Furthermore, it is possible to create / complete a swap in the store.
endpoints:
  - path: /
    method: GET
    title: Get swap by cart
    params:
      - name: cart_id
        type: String
        description: Id of cart to retrieve swap for.
    description: >
      Retrieves swap by cart id.
  - path: /
    method: POST
    title: Create swap
    description: >
      Creates / completes a swap.

response: |
  {
    "region": {
      "id": "reg_HMnixPlOicAs7aBlXuchAGxd",
      "name": "Denmark",
      "currency_code": "DKK",
      "currency": "DKK",
      "tax_rate": 0.25,
      "tax_code": null,
      "countries": [{
        "id": "1001",
        "iso_2": "DK",
        "iso_3": "DNK",
        "num_code": "208",
        "name": "denmark",
        "display_name": "Denmark"
      }],
      "payment_providers": [{
        "id": "stripe",
        "is_installed": true
      }],
      "fulfillment_providers": [{
        "id": "manual",
        "is_installed": true
      }],
      "created_at": "2020-12-11T17:03:54.458Z",
      "updated_at": "2020-12-11T17:03:54.458Z",
      "metadata": null
    }
  }
