1. Line item metadata is the authoritative source for subscription configuration.
Mixed carts (subscription and one-time items together) are not supported in the current version. Standard one-time checkout is not affected by this route.
This endpoint is idempotent — if the completed order is already linked to a subscription, the existing subscription is returned instead of creating a duplicate.
POST /store/carts/:id/subscribe
Path parameters
Cart ID.
Line item metadata contract
The following metadata fields must be set on the subscription line item before calling this endpoint.Must be
true to mark the line item as a subscription.Billing interval. One of
week, month, or year.Billing cadence as a positive integer.
Optional cart metadata
When present, must be
"subscription". Mixed purchase mode is not supported.Line item metadata example
Response
Returns the created subscription on success. If the order is already linked to a subscription (idempotent re-call), returns the existing subscription.Errors
| Code | Error | Meaning |
|---|---|---|
400 | invalid_data | Mixed cart, missing subscription line item, invalid metadata, or unsupported purchase_mode value |