Correct a subscription before the shopper accepts it

Use POST /api/public/v1/subscriptions/{id}/replace when a subscription you created has wrong data — a mistyped phone, email or address, or the wrong products — and the shopper has not accepted it yet. It replaces the subscription's cart with a new one; the old cart and its link stop working.

When you can replace

Subscription statusReplace allowed
draftYes — the subscription stays draft
sentYes
in_progressYes, until the shopper accepts
Any other status, or the shopper already acceptedNo — 409

Request

The body is the same as POST /api/public/v1/subscriptions (create), with the same validations and the same price and fee calculation.

  • mobile_phone is required.
  • Send the full customer block, as in create. Omit it to keep the stored customer.
  • cart_items: omit to keep the current items and discounts; send it to rebuild both.
  • reference: may change, but not to a reference used by another of your subscriptions (422). If your references are auto-generated, the previous one is kept and this field is ignored.
  • operator_ref: optional, as in create.
curl -X POST https://<host>/api/public/v1/subscriptions/1049/replace \
  -u <user>:<password> \
  -H "Content-Type: application/json" \
  -d '{
    "mobile_phone": "611222333",
    "given_names": "John",
    "surnames": "Doe Jr",
    "email": "[email protected]",
    "date_of_birth": "2000-12-20",
    "nin": "12345678Z",
    "address": "C falsa, 123",
    "postal_code": "01234",
    "city": "Barcelona"
  }'

Response

200 with the subscription, exactly as create returns it. last_persisted_cart is the new cart, with its own code and expiry.

The shopper is not notified

Replace sends no SMS. To send the shopper the new link, call POST /api/public/v1/subscriptions/{id}/send_sms afterwards.

Errors

Same format as create: {"errors": [{"code", "title", "attribute"}]}.

StatusWhen
401Credentials missing or wrong
404No subscription with that id for your credentials
409The cart can no longer be replaced (e.g. already_accepted)
422The body is invalid, as create would refuse it, or the reference belongs to another subscription

Full schema: see Replace subscription cart in the API reference.


Did this page help you?