Skip to content

Carts API

Access abandoned cart data and send recovery emails for your store.

Scope Required

Cart endpoints require the carts:read scope for viewing carts and carts:write scope for sending recovery emails.

List Abandoned Carts

Retrieve a paginated list of abandoned shopping carts. Abandoned carts are carts that have items but have been inactive for more than 1 hour and have not been recovered (converted to orders).

http
GET /api/external/v1/carts

Query Parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 15, max: 100)
fromstringStart date (YYYY-MM-DD)
tostringEnd date (YYYY-MM-DD)
has_emailbooleanFilter to carts with customer email
recovery_sentbooleanFilter by whether recovery email was sent
value_minnumberMinimum cart value
value_maxnumberMaximum cart value
sortstringSort field: created_at, updated_at, value
orderstringSort order: asc, desc (default: desc)

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/carts?has_email=true&value_min=10" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": [
    {
      "id": 42,
      "customer_email": "player@example.com",
      "customer_id": 15,
      "items_count": 2,
      "total_quantity": 3,
      "cart_value": "49.97",
      "currency": "USD",
      "items": [
        {
          "id": 101,
          "product_id": 5,
          "product_name": "VIP Rank",
          "quantity": 1,
          "unit_price": "29.99",
          "total": "29.99"
        },
        {
          "id": 102,
          "product_id": 8,
          "product_name": "Crate Key Bundle",
          "quantity": 2,
          "unit_price": "9.99",
          "total": "19.98"
        }
      ],
      "is_guest": false,
      "recovery_email_sent": false,
      "recovery_email_sent_at": null,
      "created_at": "2025-01-20T10:30:00Z",
      "updated_at": "2025-01-20T10:45:00Z",
      "abandoned_at": "2025-01-20T11:45:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 5,
    "per_page": 15,
    "total": 68
  }
}

Get Single Cart

Retrieve details for a specific abandoned cart.

http
GET /api/external/v1/carts/{id}

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/carts/42" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": {
    "id": 42,
    "customer_email": "player@example.com",
    "customer_id": 15,
    "customer": {
      "id": 15,
      "email": "player@example.com",
      "username": "Player123",
      "created_at": "2024-12-01T09:00:00Z"
    },
    "items_count": 2,
    "total_quantity": 3,
    "cart_value": "49.97",
    "currency": "USD",
    "items": [
      {
        "id": 101,
        "product_id": 5,
        "product_name": "VIP Rank",
        "product_slug": "vip-rank",
        "quantity": 1,
        "unit_price": "29.99",
        "total": "29.99",
        "product": {
          "id": 5,
          "name": "VIP Rank",
          "slug": "vip-rank",
          "is_active": true,
          "in_stock": true
        }
      },
      {
        "id": 102,
        "product_id": 8,
        "product_name": "Crate Key Bundle",
        "product_slug": "crate-key-bundle",
        "quantity": 2,
        "unit_price": "9.99",
        "total": "19.98",
        "product": {
          "id": 8,
          "name": "Crate Key Bundle",
          "slug": "crate-key-bundle",
          "is_active": true,
          "in_stock": true
        }
      }
    ],
    "is_guest": false,
    "recovery_email_sent": false,
    "recovery_email_sent_at": null,
    "expires_at": "2025-01-27T10:30:00Z",
    "created_at": "2025-01-20T10:30:00Z",
    "updated_at": "2025-01-20T10:45:00Z",
    "abandoned_at": "2025-01-20T11:45:00Z"
  }
}

Get Cart Statistics

Retrieve aggregate statistics about abandoned and recovered carts.

http
GET /api/external/v1/carts/stats

Query Parameters

ParameterTypeDescription
daysintegerAnalysis period in days (default: 30, max: 365)

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/carts/stats?days=30" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": {
    "period_days": 30,
    "active_carts": 12,
    "abandoned_today": 3,
    "total_abandoned": 68,
    "recovered_carts": 24,
    "recovered_today": 2,
    "abandonment_rate": 45.6,
    "recovery_rate": 16.2,
    "avg_cart_value": "34.50",
    "abandoned_value": "2346.00",
    "recovered_value": "828.00",
    "recovered_value_today": "69.98",
    "recovery_emails_sent": 52,
    "currency": "USD"
  }
}

Send Recovery Email

Trigger a cart recovery email to be sent to the customer. This will queue the email for delivery using your store's configured email template.

http
POST /api/external/v1/carts/{id}/recover

Prerequisites

  • The cart must have a customer email address
  • Cart recovery must be enabled in your store settings
  • A recovery email must not have already been sent for this cart
  • The cart must not be already recovered

Example Request

bash
curl -X POST "https://yourstore.pixlpay.net/api/external/v1/carts/42/recover" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"

Response

json
{
  "success": true,
  "data": {
    "id": 42,
    "customer_email": "player@example.com",
    "recovery_email_sent": true,
    "recovery_email_sent_at": "2025-01-20T14:30:00Z"
  },
  "message": "Recovery email queued successfully"
}

Cart Object

FieldTypeDescription
idintegerUnique identifier
customer_emailstringCustomer's email address (null for guest carts without email)
customer_idintegerCustomer ID if logged in (null for guests)
customerobjectCustomer details (on single cart endpoint)
items_countintegerNumber of unique products in cart
total_quantityintegerTotal quantity of all items
cart_valuestringTotal cart value
currencystringCurrency code (e.g., USD, EUR)
itemsarrayCart items with product details
is_guestbooleanWhether this is a guest cart
recovery_email_sentbooleanWhether a recovery email was sent
recovery_email_sent_atstringISO 8601 timestamp of when recovery email was sent
expires_atstringISO 8601 timestamp when cart expires (guest carts only)
created_atstringISO 8601 timestamp
updated_atstringISO 8601 timestamp of last activity
abandoned_atstringISO 8601 timestamp (1 hour after last update)

Cart Item Object

FieldTypeDescription
idintegerCart item ID
product_idintegerProduct ID
product_namestringProduct name
product_slugstringProduct URL slug
quantityintegerQuantity in cart
unit_pricestringPrice per unit
totalstringLine total (quantity x unit_price)
productobjectProduct availability info (on single cart endpoint)

Statistics Object

FieldTypeDescription
period_daysintegerAnalysis period in days
active_cartsintegerCarts with items, not expired, not recovered
abandoned_todayintegerCarts abandoned today
total_abandonedintegerTotal abandoned carts in period
recovered_cartsintegerCarts converted to orders
recovered_todayintegerCarts recovered today
abandonment_ratenumberPercentage of carts abandoned
recovery_ratenumberPercentage of carts recovered
avg_cart_valuestringAverage cart value
abandoned_valuestringTotal value of abandoned carts
recovered_valuestringTotal value recovered
recovered_value_todaystringValue recovered today
recovery_emails_sentintegerNumber of recovery emails sent
currencystringStore's default currency

Errors

StatusErrorDescription
401UnauthorizedInvalid or missing token
403ForbiddenToken lacks carts:read or carts:write scope
404Not FoundCart doesn't exist
422Unprocessable EntityCart already recovered or missing email
429Too Many RequestsRate limit exceeded

Error Response Example

json
{
  "success": false,
  "error": {
    "code": "CART_ALREADY_RECOVERED",
    "message": "This cart has already been recovered"
  }
}

Use Cases

Cart Recovery Automation

Build custom cart recovery workflows by fetching abandoned carts and triggering recovery emails based on your own logic:

bash
# Get carts abandoned in last 2 hours with email and value > $20
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/carts?has_email=true&value_min=20&recovery_sent=false" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Send recovery email for high-value cart
curl -X POST "https://yourstore.pixlpay.net/api/external/v1/carts/42/recover" \
  -H "Authorization: Bearer YOUR_TOKEN"

Analytics Integration

Export cart data to your analytics platform for deeper insights:

bash
# Get daily stats for dashboard
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/carts/stats?days=7" \
  -H "Authorization: Bearer YOUR_TOKEN"

Customer Support

Look up cart details when customers report checkout issues:

bash
# Get specific cart details
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/carts/42" \
  -H "Authorization: Bearer YOUR_TOKEN"

Built for game developers, by game developers.