Skip to main content

Overview

Merchant carts are server-scoped carts used in merchant operations (for example: creating carts on behalf of customers).

Authentication

Requires x-commerce-api-key.

Request

List merchant carts

const cart = await pepay.commerce.merchantCart.get({ customer_id: 'cust_123' });

Create a merchant cart

const created = await pepay.commerce.merchantCart.create({ customer_id: 'cust_123' });

Add an item

await pepay.commerce.merchantCart.addItem({
  customer_id: 'cust_123',
  productId: 'B08N5WRWNW',
  retailer: 'amazon',
  title: 'Echo (4th Gen)',
  price: 99.99,
  quantity: 1
});

Validate merchant cart

await pepay.commerce.merchantCart.validate({ customer_id: 'cust_123' });

Totals

await pepay.commerce.merchantCart.totals({ customer_id: 'cust_123', zip_code: '94105' });

Response

Example response (truncated):
{
  "success": true,
  "data": {
    "merchantId": 123,
    "customerId": "cust_123",
    "items": [
      { "productId": "B08N5WRWNW", "quantity": 1 }
    ]
  }
}

Errors

  • 401 missing/invalid commerce API key
  • 400 invalid cart id or payload

Examples

  • Prefer merchant carts when you need server-side cart control and auditing. Next: Products