🛍️ SmartCart API v1

REST API for merchants to access products, orders, customers, events and analytics.

Base URL: https://cart.melyx.id/api/v1.php

Authentication

All API requests require a Bearer token. Generate one in your merchant dashboard → API Keys.

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://cart.melyx.id/api/v1.php?action=products

Endpoints

GET ?action=products

List all your products with prices.

ParamTypeDefault
pageint1
limitint20 (max 100)
{"data":[{"id":1,"name":"TrustedWeb","type":"digital","prices":[{"id":1,"name":"Tier 1","amount":"59.00","billing_type":"one_time"}]}]}

GET ?action=orders

List orders with customer info. Filter by status.

ParamTypeDefault
statusstringall (paid/refunded/pending/failed)
page, limitint1, 20

GET ?action=customers

List customers with LTV and order count.

GET ?action=events

List behavior tracking events. Filter by type.

ParamTypeValues
typestringpage_view, product_view, add_to_cart, checkout_start, checkout_complete, abandon, upsell_accept, bump_check, coupon_apply

GET ?action=stats

Daily revenue stats (gross, net, orders, conversion, abandon rate).

ParamTypeDefault
daysint30 (max 90)

GET ?action=tax&country=IE

Get tax rate for a country. No auth required.

Behavior Tracker

Embed on checkout pages to track visitor behavior:

<script src="https://cart.melyx.id/assets/tracker.js"
  data-merchant="YOUR_MERCHANT_ID"
  data-product="PRODUCT_ID"
  data-page="PAGE_ID"></script>

JavaScript API:

SmartCart.checkoutStart(priceId)
SmartCart.checkoutComplete(orderId)
SmartCart.checkoutFail(reason)
SmartCart.addToCart(priceId)
SmartCart.bumpCheck(bumpId)
SmartCart.upsellAccept(step, priceId)
SmartCart.couponApply(code)

Buy Button

Embed a buy button on any website:

<div data-smartcart-buy="BUTTON_CODE"
     data-smartcart-label="Buy Now"
     data-smartcart-color="#8b5cf6"
     data-smartcart-style="popup"></div>
<script src="https://cart.melyx.id/assets/buy-button.js"></script>

Options: data-smartcart-size (small/medium/large), data-smartcart-style (popup/redirect), data-smartcart-dark (true/false)

Webhooks

Configure in dashboard → Notifications. Events:

EventWhen
order.paidPayment captured successfully
order.refundedRefund processed
subscription.newNew subscription created
subscription.cancelledSubscription cancelled
customer.newNew customer registered

Signature header: X-SmartCart-Signature: t=timestamp,v1=hmac

Rate Limits

60 requests/minute per API key. 429 returned when exceeded.

SmartCart by Melyx · cart.melyx.id · [email protected]