# com.atiproto.cart

> Published by [atiproto.com](https://lexicon.garden/identity/did:plc:4x5dcv6u4wlkjcssto7f22nu)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:4x5dcv6u4wlkjcssto7f22nu/com.atiproto.cart)
- [Documentation](https://lexicon.garden/lexicon/did:plc:4x5dcv6u4wlkjcssto7f22nu/com.atiproto.cart/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:4x5dcv6u4wlkjcssto7f22nu/com.atiproto.cart/examples)

## Definitions

### `com.atiproto.cart`

**Type**: `record`

A record representing a shopping cart for items/subscriptions

**Key**: `any`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `items` | `array` | Yes |  |
| `total` | `integer` | Yes | Total amount in cents |
| `status` | `string` | Yes | Cart status |
| `currency` | `string` | Yes | ISO 4217 currency code |
| `createdAt` | `string` (datetime) | Yes | Creation timestamp |
| `expiresAt` | `string` (datetime) | Yes | Expiration timestamp |
| `completedAt` | `string` (datetime) | No | Completion timestamp |

### `com.atiproto.cart#view`

**Type**: `object`

View of a cart record for use in API responses

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | Yes | AT-URI of the cart record |
| `items` | `array` | Yes |  |
| `total` | `integer` | Yes | Total amount in cents |
| `status` | `string` | Yes | Cart status |
| `currency` | `string` | Yes | ISO 4217 currency code |
| `createdAt` | `string` (datetime) | Yes | Creation timestamp |
| `expiresAt` | `string` (datetime) | Yes | Expiration timestamp |
| `completedAt` | `string` (datetime) | No | Completion timestamp |

### `com.atiproto.cart#cartItem`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `string` | Yes | Type of cart item: item or subscription |
| `recordUri` | `string` (at-uri) | Yes | AT-URI for item on record |

## Raw Schema

```json
{
  "id": "com.atiproto.cart",
  "defs": {
    "main": {
      "key": "any",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "items",
          "currency",
          "total",
          "status",
          "createdAt",
          "expiresAt"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "ref": "#cartItem",
              "type": "ref"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total amount in cents"
          },
          "status": {
            "enum": [
              "open",
              "completed",
              "expired",
              "abandoned"
            ],
            "type": "string",
            "maxLength": 64,
            "description": "Cart status"
          },
          "currency": {
            "type": "string",
            "maxLength": 3,
            "description": "ISO 4217 currency code"
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "Creation timestamp"
          },
          "expiresAt": {
            "type": "string",
            "format": "datetime",
            "description": "Expiration timestamp"
          },
          "completedAt": {
            "type": "string",
            "format": "datetime",
            "description": "Completion timestamp"
          }
        }
      },
      "description": "A record representing a shopping cart for items/subscriptions"
    },
    "view": {
      "type": "object",
      "required": [
        "uri",
        "items",
        "currency",
        "total",
        "status",
        "createdAt",
        "expiresAt"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the cart record"
        },
        "items": {
          "type": "array",
          "items": {
            "ref": "#cartItem",
            "type": "ref"
          }
        },
        "total": {
          "type": "integer",
          "description": "Total amount in cents"
        },
        "status": {
          "enum": [
            "open",
            "completed",
            "expired",
            "abandoned"
          ],
          "type": "string",
          "maxLength": 64,
          "description": "Cart status"
        },
        "currency": {
          "type": "string",
          "maxLength": 3,
          "description": "ISO 4217 currency code"
        },
        "createdAt": {
          "type": "string",
          "format": "datetime",
          "description": "Creation timestamp"
        },
        "expiresAt": {
          "type": "string",
          "format": "datetime",
          "description": "Expiration timestamp"
        },
        "completedAt": {
          "type": "string",
          "format": "datetime",
          "description": "Completion timestamp"
        }
      },
      "description": "View of a cart record for use in API responses"
    },
    "cartItem": {
      "type": "object",
      "required": [
        "type",
        "recordUri"
      ],
      "properties": {
        "type": {
          "enum": [
            "com.atiproto.item",
            "com.atiproto.subscription"
          ],
          "type": "string",
          "maxLength": 128,
          "description": "Type of cart item: item or subscription"
        },
        "recordUri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI for item on record"
        }
      }
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
