Selling plans

Create, copy, update and delete the shop's Kaching selling plans, and add or remove their products.

Subscriptions docs
On this page

Create, copy, update and delete the shop's Kaching selling plans, and add or remove their products — for example, to keep plans in step with a product sync across many stores. A plan written through the API is an ordinary Kaching plan: it shows in the plan editor, renders through the shop's widget, and gets an entry in the plan's activity log, exactly as if it had been saved in the admin.

Copying a plan to another store is two calls. Read the plan with the first store's token (Get a plan), replace its product and variant ids with the second store's, and create it with the second store's token. create ignores the ids the read returned for the plan and its delivery options. Every other id the plan holds must exist in the store it is created in — products, variants, the gift and automatic-action products, and widgetId — or the create is refused naming each one, and nothing is created.

Ids. planId, on every plan endpoint, takes the numeric id as a number (123456) or a string ("123456"), or the gid://shopify/SellingPlanGroup/123456 GID. Every id inside a request body must be a GID, and a numeric one gets 400: products and variants (gid://shopify/Product/<id>, gid://shopify/ProductVariant/<id>) in every field, gifts and automatic actions included, and a delivery option's id (gid://shopify/SellingPlan/<id>). Responses always return GIDs, so a plan read with Get a plan can be sent back as is.

Limits are the plan editor's: discounts and prices take at most 2 decimals, a percentage is at most 100, a plan's delivery frequencies must be unique, a daily frequency is at least 7 days, a plan has at most 31 delivery options, an option at most 20 gifts and a gift at most 100 variants, afterCycle is at most 250. A value the editor would refuse gets 400 naming the field, for example { "error": "deliveryOptions[0].discount.value: Discount value can have at most 2 decimal places" }. On top of those, one request may name at most 1,000 different product and variant ids in total (productIds, variantIds and every id inside the delivery options), or it gets 400 { "error": "at most 1000 different product and variant ids per request" }.

The plan object

What Get a plan returns and Create a plan takes. Update a plan takes it without productIds and variantIds.

FieldTypeDescription
idstringThe plan's GID. Returned by reads, ignored by create.
merchantCodestringRequired. The internal title ("Plan title" in the admin). Unique per store through the API: see Create a plan.
namestringRequired. The title shoppers see ("Purchase option title" in the admin).
productIdsstring[]Products the plan is offered on. create only, at most 250.
variantIdsstring[]Single variants the plan is offered on. create only, at most 250.
permissionsobject{ canSwapProducts, canChangeVariant, canChangeQuantity, keepDiscountsOnSwap } ("Customer product changes" in the admin). Each defaults to true on create.
widgetIdnumber | nullA Kaching widget of this shop. null or left out on create: the shop's default widget.
deliveryOptionsobject[]Required, 1 to 31. See below.

Delivery option fields (deliveryOptions[])

FieldTypeDescription
idstringThe option's selling plan GID. On update it names the option to change; leave it out for a new option.
namestringThe option's name. Left out: generated as in the editor (on update, an existing option keeps its current name).
typestringDEFAULT (pay per delivery, the default) or PRE_PAID.
deliveryIntervalstringRequired. DAY, WEEK, MONTH or YEAR.
deliveryFrequencynumberRequired. Deliveries every this many intervals.
billingIntervalstringDefaults to deliveryInterval, and must match it.
billingFrequencynumberDefaults to deliveryFrequency. PRE_PAID: a multiple of deliveryFrequency, at least 2.
minCyclesnumber | nullMinimum number of orders before the customer can cancel.
maxCyclesnumber | nullThe subscription ends after this many billing cycles.
discountobject | null{ type, value }, type being PERCENTAGE, FIXED_AMOUNT or PRICE.
laterDiscountobject | null{ type, value, afterCycle }: a different discount from order afterCycle on.
quantityOnSelectnumber | nullMinimum quantity a shopper picks when choosing this option ("Minimum quantity" in the admin).
quantityPolicyobject | null{ quantity, afterCycle, products: [{ productId, variantIds }] }: set those products' quantity on recurring orders after afterCycle deliveries, never above the first order's quantity.
freeProductsPolicyobject | null{ afterCycle, products: [{ productId, variantIds }] }: these free products are removed from the subscription after afterCycle orders.
deliveryPricePolicyobject | null{ type, amount, afterCycle }: a shipping discount from order afterCycle on.
giftsobject[]Free gifts on the first order: [{ productId, variantIds, quantity, discountName }]. An empty variantIds means every variant.
automaticLineActionsobject | nullLine changes keyed by the order number they apply from, as a string: { "2": [action, ...] }. See below.

An automatic line action is one of:

json
{ "type": "swap", "productId": "gid://shopify/Product/1", "variantId": "gid://shopify/ProductVariant/11",
  "swapTo": [{ "productId": "gid://shopify/Product/2", "variantId": "gid://shopify/ProductVariant/21" }] }
{ "type": "remove", "productId": "gid://shopify/Product/1", "variantId": "gid://shopify/ProductVariant/11" }
{ "type": "add", "productId": "gid://shopify/Product/3", "variantId": "gid://shopify/ProductVariant/31",
  "quantity": 1, "discount": { "type": "PERCENTAGE", "value": 100 } }

variantId is optional on swap and remove (without it the action matches the product), and discount is optional on add.


List plans

http
GET /shop-api/plans

Permission: Selling plans → View plans (selling_plans:read).

The shop's published plans, 50 per page, oldest first. Drafts are never returned.

Query parameters

ParameterTypeRequiredDescription
cursorstringNoThe cursor of the previous page.
merchantCodestringNoOnly plans whose internal title is exactly this (ignoring case and spaces around it).

Example

bash
curl "https://subscriptions.kachingappz.app/shop-api/plans?merchantCode=Coffee%20subscription" \
  -H "Authorization: Bearer <your-api-token>"

Response (200)

json
{
  "plans": [
    {
      "id": "gid://shopify/SellingPlanGroup/123456",
      "merchantCode": "Coffee subscription",
      "name": "Subscribe & save",
      "productCount": 12,
      "variantCount": 0,
      "deliveryOptionCount": 2,
      "createdAt": "2026-11-10T09:00:00Z"
    }
  ],
  "hasNextPage": false,
  "cursor": "eyJsYXN0X2lkIjo…"
}

Get a plan

http
GET /shop-api/plans?planId=<id>

Permission: Selling plans → View plans (selling_plans:read).

Query parameters

ParameterTypeRequiredDescription
planIdstringYesNumeric id or gid://shopify/SellingPlanGroup/<id> GID.

One plan as a plan object, every product and variant included. A plan the shop does not have gets 404 { "error": "Plan not found" }.

Example

bash
curl "https://subscriptions.kachingappz.app/shop-api/plans?planId=123456" \
  -H "Authorization: Bearer <your-api-token>"

Response (200)

json
{
  "plan": {
    "id": "gid://shopify/SellingPlanGroup/123456",
    "merchantCode": "Coffee subscription",
    "name": "Subscribe & save",
    "productIds": ["gid://shopify/Product/1001"],
    "variantIds": [],
    "permissions": {
      "canSwapProducts": true,
      "canChangeVariant": true,
      "canChangeQuantity": true,
      "keepDiscountsOnSwap": true
    },
    "widgetId": null,
    "deliveryOptions": [
      {
        "id": "gid://shopify/SellingPlan/7001",
        "name": "Delivery every month, 10% off",
        "type": "DEFAULT",
        "deliveryInterval": "MONTH",
        "deliveryFrequency": 1,
        "billingInterval": "MONTH",
        "billingFrequency": 1,
        "minCycles": null,
        "maxCycles": null,
        "discount": { "type": "PERCENTAGE", "value": 10 },
        "laterDiscount": { "type": "PERCENTAGE", "value": 15, "afterCycle": 3 },
        "quantityOnSelect": null,
        "quantityPolicy": null,
        "freeProductsPolicy": null,
        "deliveryPricePolicy": null,
        "gifts": [],
        "automaticLineActions": null
      }
    ]
  }
}

Create a plan

http
POST /shop-api/plans/create

Permission: Selling plans → Create plans (selling_plans:create).

Creates a published plan from a plan object. It needs at least one product or variant; for a plan on more than 250 of either, create it with the first 250 and send the rest to Add products to a plan.

Example

bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/plans/create" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantCode": "Coffee subscription",
    "name": "Subscribe & save",
    "productIds": ["gid://shopify/Product/1001"],
    "deliveryOptions": [
      { "deliveryInterval": "MONTH", "deliveryFrequency": 1, "discount": { "type": "PERCENTAGE", "value": 10 } }
    ]
  }'

Response (200)

json
{ "success": true, "planId": "gid://shopify/SellingPlanGroup/123457" }

Errors specific to this endpoint

  • 409 — the store already has a published plan with that merchantCode (ignoring case and spaces around it). This makes a sync safe to re-run; the admin editor itself allows duplicate titles. { "error": "Conflict", "message": "plan_title_taken", "planIds": ["gid://shopify/SellingPlanGroup/123456"] }
  • 400 — product or variant ids that do not exist in this store, wherever they appear in the body. Every one is listed, and nothing is created. { "error": "Unknown ids", "unknownIds": ["gid://shopify/ProductVariant/1"] }
  • 400 — a widgetId that is not a widget of this shop.

Update a plan

http
POST /shop-api/plans/update

Permission: Selling plans → Edit plans (selling_plans:update).

Replaces a plan's configuration. The body is the plan object without productIds and variantIds, plus:

FieldTypeRequiredDescription
planIdstring | numberYesNumeric id or gid://shopify/SellingPlanGroup/<id> GID.
forcebooleanNoRemove options that live subscriptions are on (see below). Default false.

Products are changed only by add-products and remove-products; sending productIds or variantIds here is a 400.

  • Options with an id are updated, options without one are added, and the plan's options left out are removed.
  • An option sent without name keeps its current name — even when the change makes that name wrong (a generated "10% off" name stays after the discount moves to 15%). Send name with such a change.
  • permissions fields and widgetId left out keep their current values; "widgetId": null moves the plan to the shop's default widget.

Example (with the body of Get a plan, its productIds and variantIds removed and the discount changed):

bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/plans/update" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "planId": "123456",
    "merchantCode": "Coffee subscription",
    "name": "Subscribe & save",
    "deliveryOptions": [
      {
        "id": "gid://shopify/SellingPlan/7001",
        "name": "Delivery every month, 15% off",
        "deliveryInterval": "MONTH",
        "deliveryFrequency": 1,
        "discount": { "type": "PERCENTAGE", "value": 15 }
      }
    ]
  }'

Response (200)

json
{ "success": true }

Errors specific to this endpoint

  • 409 — the update would remove an option that active, paused or failed subscriptions are on. Nothing is changed. Send "force": true to remove it anyway: those subscriptions keep billing at their price, but lose what the option drives (later-order discounts, gifts, automatic actions). { "error": "Conflict", "message": "plan_has_subscriptions", "subscriptionCount": 3 }
  • 409 plan_title_taken — the new merchantCode belongs to another plan. Keeping the plan's own title is always allowed.
  • 400 — an option id that is not an option of this plan, or Unknown ids as on create.

Delete a plan

http
POST /shop-api/plans/delete

Permission: Selling plans → Delete plans (selling_plans:delete).

Request body

FieldTypeRequiredDescription
planIdstring | numberYesNumeric id or gid://shopify/SellingPlanGroup/<id> GID.
forcebooleanNoDelete even when live subscriptions are on the plan. Default false.

Example

bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/plans/delete" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{"planId":"123456"}'

Response (200)

json
{ "success": true }

A plan that active, paused or failed subscriptions are on is refused with 409 { "error": "Conflict", "message": "plan_has_subscriptions", "subscriptionCount": 3 } unless force is true. A forced delete works like the admin's Delete button: the subscriptions keep billing at their current price, but lose the plan's later-order discounts, gifts and automatic actions.


Add products to a plan

http
POST /shop-api/plans/add-products

Permission: Selling plans → Edit plans (selling_plans:update).

Request body

FieldTypeRequiredDescription
planIdstring | numberYesNumeric id or gid://shopify/SellingPlanGroup/<id> GID.
productIdsstring[]No\*Product GIDs, at most 250.
variantIdsstring[]No\*Variant GIDs, at most 250.

\* At least one id between them.

Ids already in the plan, and variants whose whole product is already in the plan, are skipped, so a sync can send the same list on every run. Any id that does not exist in the store gets 400 Unknown ids and nothing is added.

Example

bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/plans/add-products" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{"planId":"123456","productIds":["gid://shopify/Product/1002","gid://shopify/Product/1003"]}'

Response (200) — added counts the ids that were not in the plan yet:

json
{ "success": true, "added": 2 }

Remove products from a plan

http
POST /shop-api/plans/remove-products

Permission: Selling plans → Edit plans (selling_plans:update), and Delete plans (selling_plans:delete) for a remove that empties the plan.

Request body

FieldTypeRequiredDescription
planIdstring | numberYesNumeric id or gid://shopify/SellingPlanGroup/<id> GID.
productIdsstring[]No\*Product GIDs, at most 250.
variantIdsstring[]No\*Variant GIDs, at most 250.
forcebooleanNoOnly matters when the remove empties the plan; see below. Default false.

\* At least one id between them.

A product id also removes that product's variants that were added one by one. Ids not in the plan, including products since deleted from the store, are skipped. Subscriptions already on the removed products are unchanged.

Example

bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/plans/remove-products" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{"planId":"123456","productIds":["gid://shopify/Product/1003"]}'

Response (200)

json
{ "success": true, "removed": 1, "deleted": false }

A remove that leaves the plan with no products or variants deletes the plan ("deleted": true), as the product page's purchase options action in the Shopify admin does. That needs the Delete plans permission too: a token without it gets 403 { "error": "Forbidden", "message": "insufficient_scope", "requiredScope": "selling_plans:delete" } and nothing is removed, whatever force says. When active, paused or failed subscriptions are on the plan, the delete is refused with 409 plan_has_subscriptions and nothing is removed, unless force is true.


Can’t find what you need?

Ask the Kaching team about your integration in chat.