E-commerce Cart API

Get carts

If you want to get a list of carts for a given shop, send this GET request

GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts
1

Request parameters

ParameterTypeRequiredLimitations
shop_idintegeryesMust provide valid shop id
limitintegernoDefaults to 100
pageintegernoDefaults to 1

Response

{
  "data": [
    {
      "id": "12564435675647",
      "ecommerce_order_id": "3456678978907",
      "checkout_url": "https://url-to-cart-checkout.com",
      "cart_total": 1234.99,
      "customer": {
        "id": "319868430643456756",
        "email": "customer@email.com",
        "accepts_marketing": true,
        "subscriber": {
          "id": "31986843064993537",
          "email": "customer@email.com",
          "status": "active",
          "source": "api",
          "sent": 0,
          "opens_count": 0,
          "clicks_count": 0,
          "open_rate": 0,
          "click_rate": 0,
          "ip_address": null,
          "subscribed_at": "2021-09-01 14:03:50",
          "unsubscribed_at": null,
          "created_at": "2021-09-01 14:03:50",
          "updated_at": "2021-09-01 14:03:50",
          "fields": {
            "city": null,
            "company": null,
            "country": null,
            "last_name": "Testerson",
            "name": "Dummy",
            "phone": null,
            "state": null,
            "z_i_p": null
          },
          "groups": [],
          "opted_in_at": null,
          "optin_ip": null
        }
      },
      "items": [
        {
          "id": "45676855678345",
          "product": {
            "id": "31986843543567834",
            "name": "Product name",
            "price": 123.4,
            "url": "https://shop-url.com/product-name",
            "image": "https://shop-url.com/product-image.jpg",
            "exclude_from_automations": false,
            "categories": [
              {
                "id": "1234566457534276",
                "name": "Category 1",
                "exclude_from_automations": false,
                "created_at": "2021-09-01 14:03:50",
                "updated_at": "2021-09-01 14:03:50"
              },
              {
                "id": "1234566457534278",
                "name": "Category 2",
                "exclude_from_automations": false,
                "created_at": "2021-09-01 14:03:50",
                "updated_at": "2021-09-01 14:03:50"
              }
            ]
          },
          "variant": "product variant",
          "quantity": 1,
          "price": 123.4
        }
      ]
    }
  ],
  "links": {
    "first": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts?page=1",
    "last": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "« Previous",
        "active": false
      },
      {
        "url": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": null,
        "label": "Next »",
        "active": false
      }
    ],
    "path": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts",
    "per_page": 100,
    "to": 1,
    "total": 1
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

Update a cart

If you want to update a cart, please send this PUT request

PUT https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts/:cart_id
1

Note: Carts can only be created through the orders endpoint.

Request body

ParameterTypeRequiredLimitations
checkout_urlstringnoThe cart's checkout url.
cart_totalfloatnoThe cart's total price in the shop's currency. Defaults to 0.
{
    "checkout_url": "https://url-to-cart-checkout.com",
    "cart_total": 1234.99,
}
1
2
3
4

Response

If the cart was updated:

Response Code: 200 OK
1
{
  "data": {
    "id": "12564435675647",
    "ecommerce_order_id": "3456678978907",
    "checkout_url": "https://url-to-cart-checkout.com",
    "cart_total": 1234.99,
    "customer": {
      "id": "319868430643456756",
      "email": "customer@email.com",
      "accepts_marketing": true,
      "subscriber": {
        "id": "31986843064993537",
        "email": "customer@email.com",
        "status": "active",
        "source": "api",
        "sent": 0,
        "opens_count": 0,
        "clicks_count": 0,
        "open_rate": 0,
        "click_rate": 0,
        "ip_address": null,
        "subscribed_at": "2021-09-01 14:03:50",
        "unsubscribed_at": null,
        "created_at": "2021-09-01 14:03:50",
        "updated_at": "2021-09-01 14:03:50",
        "fields": {
          "city": null,
          "company": null,
          "country": null,
          "last_name": "Testerson",
          "name": "Dummy",
          "phone": null,
          "state": null,
          "z_i_p": null
        },
        "groups": [],
        "opted_in_at": null,
        "optin_ip": null
      }
    },
    "items": [
      {
        "id": "45676855678345",
        "product": {
          "id": "31986843543567834",
          "name": "Product name",
          "price": 123.4,
          "url": "https://shop-url.com/product-name",
          "image": "https://shop-url.com/product-image.jpg",
          "exclude_from_automations": false,
          "categories": [
            {
              "id": "1234566457534276",
              "name": "Category 1",
              "exclude_from_automations": false,
              "created_at": "2021-09-01 14:03:50",
              "updated_at": "2021-09-01 14:03:50"
            },
            {
              "id": "1234566457534278",
              "name": "Category 2",
              "exclude_from_automations": false,
              "created_at": "2021-09-01 14:03:50",
              "updated_at": "2021-09-01 14:03:50"
            }
          ]
        },
        "variant": "product variant",
        "quantity": 1,
        "price": 123.4
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

Notes:

You can use the respective cart items endpoints to update a cart's items.

Fetch a cart

If you want to fetch a cart, please send this GET request

GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts/:cart_id
1

Request

ParameterTypeRequiredLimitations
cart_idintegeryesMust provide valid cart id
shop_idintegeryesMust provide valid shop id
GET https://connect.mailerlite.com/api/ecommerce/shops/31986843064993537/products/319868430643456756
1

Response

If the shop and the cart exist:

Response Code: 200 OK
1
{
  "data": {
    "id": "12564435675647",
    "ecommerce_order_id": "3456678978907",
    "checkout_url": "https://url-to-cart-checkout.com",
    "cart_total": 1234.99,
    "customer": {
      "id": "319868430643456756",
      "email": "customer@email.com",
      "accepts_marketing": true,
      "subscriber": {
        "id": "31986843064993537",
        "email": "customer@email.com",
        "status": "active",
        "source": "api",
        "sent": 0,
        "opens_count": 0,
        "clicks_count": 0,
        "open_rate": 0,
        "click_rate": 0,
        "ip_address": null,
        "subscribed_at": "2021-09-01 14:03:50",
        "unsubscribed_at": null,
        "created_at": "2021-09-01 14:03:50",
        "updated_at": "2021-09-01 14:03:50",
        "fields": {
          "city": null,
          "company": null,
          "country": null,
          "last_name": "Testerson",
          "name": "Dummy",
          "phone": null,
          "state": null,
          "z_i_p": null
        },
        "groups": [],
        "opted_in_at": null,
        "optin_ip": null
      }
    },
    "items": [
      {
        "id": "45676855678345",
        "product": {
          "id": "31986843543567834",
          "name": "Product name",
          "price": 123.4,
          "url": "https://shop-url.com/product-name",
          "image": "https://shop-url.com/product-image.jpg",
          "exclude_from_automations": false,
          "categories": [
            {
              "id": "1234566457534276",
              "name": "Category 1",
              "exclude_from_automations": false,
              "created_at": "2021-09-01 14:03:50",
              "updated_at": "2021-09-01 14:03:50"
            },
            {
              "id": "1234566457534278",
              "name": "Category 2",
              "exclude_from_automations": false,
              "created_at": "2021-09-01 14:03:50",
              "updated_at": "2021-09-01 14:03:50"
            }
          ]
        },
        "variant": "product variant",
        "quantity": 1,
        "price": 123.4
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

Error

If the cart or shop cannot be found:

Response Code: 404 Not Found
1

Fetch total carts count

If you want to fetch total carts count, send this GET request

GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts?limit=0
1

Request parameters

ParameterTypeRequiredLimitations
shop_idintegeryesMust provide valid shop id
limitintegeryesValue must be 0

Response

Response Code: 200 OK
1
{
  "total": 123
}
1
2
3

Delete a cart

You cannot delete a cart. A cart is automatically deleted when its associated order gets deleted.

Last Updated: