# Contracts

Read subscription contracts and change their state: list, pause, resume, cancel, reactivate and discount them.

https://www.kachingappz.com/developers/subscriptions/contracts/ · Updated 2026-11-23

Read subscription contracts and change their state.

## List contracts

```http
GET /shop-api/contracts
```

Permission: **Subscriptions** → View contracts (`contracts:read`).

Returns a paginated list of subscription contracts for the authenticated shop.

**Query parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `cursor` | string | No | — | Opaque pagination cursor from the previous response's `cursor` field. |
| `query` | string | No | `status:ACTIVE OR status:PAUSED OR status:FAILED OR status:CANCELLED` | Shopify GraphQL query syntax, e.g. `status:ACTIVE`, `status:PAUSED`. |
| `email` | string | No | — | Customer email (case-insensitive exact match). Narrows the result to that customer's contracts. Combines with `query` via AND. Unknown email returns an empty `data` array. |
| `customerId` | string | No | — | Shopify customer ID — either a numeric ID (e.g. `258369147`) or a full GID (`gid://shopify/Customer/258369147`). Narrows the result to that customer's contracts. Combines with `query` via AND. Unknown customer returns an empty `data` array. Takes precedence over `email` if both are supplied. |
| `orderId` | string | No | — | Shopify order ID — either a numeric ID (e.g. `369147258`) or a full GID (`gid://shopify/Order/369147258`). Narrows the result to the contract(s) attached to that order. Combines with `query` via AND. Unknown or non-subscription orders return an empty `data` array. Takes precedence over `customerId` and `email` if multiple are supplied. |

Each page returns up to 50 contracts.

**Example — fetch all active contracts**

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "query=status:ACTIVE"
```

**Example — paginate**

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "query=status:ACTIVE" \
  --data-urlencode "cursor=eyJsYXN0X2lkIjoi..."
```

Loop until `hasNextPage` is `false`, passing the previous response's `cursor` on each iteration.

**Example — fetch a single contract by ID**

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "query=id:123456789"
```

**Example — fetch a specific customer's contracts by email**

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "email=sarah@example.com"
```

Combine with `query` to narrow further, e.g. only that customer's cancelled contracts:

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "email=sarah@example.com" \
  --data-urlencode "query=status:CANCELLED"
```

**Example — fetch a specific customer's contracts by customer ID**

Customer ID is preferred over email when available — it's stable across email changes. Accepts either the numeric ID or the full Shopify GID.

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "customerId=258369147"
```

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "customerId=gid://shopify/Customer/258369147"
```

**Example — fetch a contract by orderId**

Use `orderId` when you have a Shopify order in hand and want to find the subscription contract(s) it was generated by. Accepts either the numeric ID or the full Shopify GID.

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "orderId=369147258"
```

```bash
curl -G "https://subscriptions.kachingappz.app/shop-api/contracts" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "orderId=gid://shopify/Order/369147258"
```

If multiple of `orderId`, `customerId`, and `email` are provided, priority is `orderId` \> `customerId` \> `email`; the lower-priority parameters are ignored.

**Response (200)**

```json
{
  "data": [
    {
      "node": {
        "id": "gid://shopify/SubscriptionContract/123456789",
        "status": "ACTIVE",
        "currencyCode": "USD",
        "lastPaymentStatus": "SUCCEEDED",
        "revisionId": "gid://shopify/SubscriptionContractRevision/987654321",
        "createdAt": "2024-01-15T10:30:00Z",
        "updatedAt": "2024-02-10T14:22:00Z",
        "deliveryPolicy": { "interval": "MONTH", "intervalCount": 1 },
        "billingPolicy": {
          "interval": "MONTH",
          "intervalCount": 1,
          "maxCycles": null,
          "minCycles": null
        },
        "deliveryPrice": { "amount": "5.99", "currencyCode": "USD" },
        "deliveryMethod": {
          "__typename": "SubscriptionDeliveryMethodShipping",
          "address": { "countryCodeV2": "US", "city": "San Francisco" }
        },
        "linesCount": { "count": 2 },
        "lines": {
          "edges": [
            {
              "node": {
                "id": "gid://shopify/SubscriptionLine/111222333",
                "title": "Product Title",
                "variantTitle": "Variant Title",
                "productId": "gid://shopify/Product/444555666",
                "variantId": "gid://shopify/ProductVariant/777888999",
                "quantity": 2,
                "lineDiscountedPrice": {
                  "amount": "47.98",
                  "currencyCode": "USD"
                },
                "pricingPolicy": {
                  "basePrice": { "amount": "25.99", "currencyCode": "USD" },
                  "cycleDiscounts": [
                    {
                      "adjustmentType": "PERCENTAGE",
                      "afterCycle": 0,
                      "computedPrice": {
                        "amount": "23.99",
                        "currencyCode": "USD"
                      },
                      "adjustmentValue": { "percentage": 8.0 }
                    }
                  ]
                },
                "discountAllocations": []
              }
            }
          ],
          "pageInfo": {
            "hasNextPage": false,
            "hasPreviousPage": false,
            "endCursor": null,
            "startCursor": null
          }
        },
        "discounts": { "edges": [] },
        "customer": {
          "id": "gid://shopify/Customer/258369147",
          "displayName": "Sarah Johnson",
          "defaultEmailAddress": { "emailAddress": "sarah@example.com" }
        },
        "orders": {
          "edges": [{ "node": { "id": "gid://shopify/Order/369147258" } }],
          "pageInfo": {
            "hasNextPage": false,
            "hasPreviousPage": false,
            "endCursor": null,
            "startCursor": null
          }
        }
      }
    }
  ],
  "hasNextPage": true,
  "cursor": "eyJsYXN0X2lkIjoiZ2lkOi8vc2hvcGlmeS...",
  "throttle": 1850
}
```

See the [Contract object reference](https://www.kachingappz.com/developers/subscriptions/contract-object/) below for field details.

---

## Pause a contract

```http
POST /shop-api/contracts/pause
```

Permission: **Subscriptions** → Pause contracts (`contracts:pause`).

Transitions an `ACTIVE` contract to `PAUSED`. No further billing cycles run until the contract is resumed: by you, or on its own when you pass `pausedCycleCount`.

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contractId` | string | Yes | Either a Shopify GID (`gid://shopify/SubscriptionContract/123`) or the bare numeric ID. |
| `pausedCycleCount` | number | No | `1`, `2` or `3`. Pause for that many deliveries, then resume automatically before the next order. Without it the pause lasts until it is resumed. |

**Example**

```bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/contracts/pause" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{"contractId":"gid://shopify/SubscriptionContract/123456789"}'
```

Pause for two deliveries, then resume automatically:

```bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/contracts/pause" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{"contractId":"gid://shopify/SubscriptionContract/123456789","pausedCycleCount":2}'
```

**Response (200)**

```json
{ "success": true }
```

**Pausing for a set number of deliveries.** With `pausedCycleCount`, the pause covers the contract's next that many orders, which are neither charged nor shipped, and the subscription comes back on the order after them. Orders the customer already skipped don't count. Kaching resumes the contract on its own at the shop's billing hour, at least a day before that order, and the customer gets the "Subscription resumed" email and the upcoming-charge reminder. The "Subscription paused" email and the `subscription_contract/paused` [webhook](https://www.kachingappz.com/developers/subscriptions/webhooks/#conditional-fields), Klaviyo and Omnisend events carry the resume date. Resuming the contract earlier, from anywhere, cancels the automatic resume.

This works whatever the shop's customer portal "Pause duration" setting is: that setting only applies to the customer's own pauses.

**Errors specific to this field**

- `400` — a `pausedCycleCount` that is not `1`, `2` or `3`. Nothing is paused.
- `422` — a length the contract cannot be paused for. Nothing is paused.
- A prepaid contract can only pause until it is resumed: `{ "error": "A prepaid subscription can only be paused until it is resumed" }`
- A contract whose subscription ends (`maxCycles`) before the order it would come back on: `{ "error": "This pause length is not available for the subscription" }`

---

## Resume a contract

```http
POST /shop-api/contracts/resume
```

Permission: **Subscriptions** → Resume contracts (`contracts:resume`).

Transitions a `PAUSED` contract back to `ACTIVE`. Billing resumes on the contract's configured schedule.

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contractId` | string | Yes | Shopify GID or numeric ID of the contract. |

**Example**

```bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/contracts/resume" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{"contractId":"gid://shopify/SubscriptionContract/123456789"}'
```

**Response (200)**

```json
{ "success": true }
```

---

## Cancel a contract

```http
POST /shop-api/contracts/cancel
```

Permission: **Subscriptions** → Cancel contracts (`contracts:cancel`).

Transitions a contract to `CANCELLED`.

> **Warning** A cancelled contract can never be resumed. It can be [reactivated](https://www.kachingappz.com/developers/subscriptions/contracts/#reactivate-a-cancelled-contract), but that creates a **new** contract with a new ID. To temporarily stop billing, use [Pause](https://www.kachingappz.com/developers/subscriptions/contracts/#pause-a-contract) instead.

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contractId` | string | Yes | Shopify GID or numeric ID of the contract. |
| `reason` | string | No | Why the subscription was cancelled, 1–500 characters (surrounding whitespace is trimmed). Shown to the merchant in Kaching. |
| `suppressEmailNotifications` | boolean | No | Defaults to `false`. When `true`, the customer gets no cancellation email and no Klaviyo or Omnisend "subscription cancelled" event. |

**Example**

```bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/contracts/cancel" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "contractId": "gid://shopify/SubscriptionContract/123456789",
    "reason": "Cancelled by Chargeblast: chargeback alert",
    "suppressEmailNotifications": true
  }'
```

**Response (200)**

```json
{ "success": true }
```

**The cancellation reason.** The `reason` is shown to the merchant on the contract's timeline (under "Subscription cancelled via API"), on **Customer portal → Cancellation reasons** with an "API" badge, in that page's CSV export, and in the cancellation-reasons breakdown on the Analytics page. It is also sent as `churnReasons` on the `subscription_contract/cancelled` [webhook](https://www.kachingappz.com/developers/subscriptions/webhooks/) and the Klaviyo and Omnisend events, and as `cancelReason` on the Shopify Flow "Subscription cancelled" trigger.

**Suppressing email notifications.** With `suppressEmailNotifications: true`, no cancellation email goes to the customer and no Klaviyo or Omnisend event is sent. The merchant's own cancellation notification, the `subscription_contract/cancelled` webhook and the Shopify Flow trigger still go out. The contract's timeline shows "Email notifications suppressed".

**Errors specific to these fields**

- `400` — an empty or over-500-character `reason`, a `reason` that is not a string, or a `suppressEmailNotifications` that is not a JSON boolean (`"true"` is refused). Nothing is changed.
- `500` — the options could not be recorded. The contract is **not** cancelled, so it is never cancelled with emails you asked us not to send. Retrying is safe.

---

## Reactivate a cancelled contract

```http
POST /shop-api/contracts/reactivate
```

Permission: **Subscriptions** → Reactivate contracts (`contracts:reactivate`).

Brings a cancelled subscription back.

> **Warning** A cancelled Shopify contract can never go live again, so reactivation **creates a new contract**, copied from the cancelled one. The contract you name stays cancelled, and the response carries a new ID — store it, because every later call for this subscription uses it.

The new contract keeps the customer, payment method, lines, prices, discounts, delivery method and billing interval of the old one. Anything a Kaching streak had placed on the old contract (a free gift line, a streak discount) is left behind; the new contract starts earning its own.

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contractId` | string | Yes | The **cancelled** contract: Shopify GID or numeric ID. |
| `reactivationDate` | string | No | `YYYY-MM-DD` in the shop's timezone — the day the new contract first bills, at 11:00 shop time. Tomorrow to 30 days out. Defaults to **tomorrow** in the shop's timezone. |

**Example**

```bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/contracts/reactivate" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "contractId": "gid://shopify/SubscriptionContract/123456789",
    "reactivationDate": "2026-10-20"
  }'
```

**Response (200)**

```json
{
  "success": true,
  "contract": {
    "id": "gid://shopify/SubscriptionContract/19001234567",
    "reactivatedFromId": "gid://shopify/SubscriptionContract/123456789"
  }
}
```

[List contracts](https://www.kachingappz.com/developers/subscriptions/contracts/#list-contracts) then shows the new contract as `ACTIVE` and the old one as `CANCELLED`.

**A contract gets one successor.** A second reactivation of the same contract is refused with `409`, so that a customer is never left paying for two live subscriptions:

```json
{ "error": "Subscription has already been reactivated" }
```

A contract that is not cancelled is refused with `409` too (`{ "error": "Subscription is not cancelled" }`), and one that cannot be rebuilt as it stands — no payment method, a revoked payment method, a prepaid plan, a line whose product no longer exists, or a currency the store no longer sells in — with `422` and a message naming the reason.

> **Warning** The "already reactivated" check reads a link written moments after the new contract is created, so two calls fired within a few seconds of each other can both succeed. Treat the returned contract ID as your idempotency key, and after a `500` read [list contracts](https://www.kachingappz.com/developers/subscriptions/contracts/#list-contracts) to check for a new contract before retrying.

---

## Add a discount to a contract

```http
POST /shop-api/contracts/add-discount
```

Permission: **Line items** → Add discounts (`contracts:add_discount`).

Applies a discount to every line of a contract. The value is supplied inline, so you do not need to create a Shopify discount code first. The discount shows up in `pricingPolicy.cycleDiscounts` and `discountAllocations` the next time you [list contracts](https://www.kachingappz.com/developers/subscriptions/contracts/#list-contracts).

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contractId` | string\|number | Yes | Shopify GID or numeric ID of the contract. |
| `discountType` | string | Yes | `PERCENTAGE` or `FIXED_AMOUNT`. |
| `value` | number | Yes | `PERCENTAGE`: a whole number from 1 to 100. `FIXED_AMOUNT`: a positive amount, at most 2 decimals, up to 100000. |
| `title` | string | Yes | 2–255 characters. Shown to the customer on the order. |
| `recurringCycleLimit` | number | No | How many upcoming orders the discount applies to (1–120). Omit it, or send `null`, to apply the discount to **every** future order. |

> **Warning** `FIXED_AMOUNT` takes the amount off the **order total** once — not off each item — and is interpreted in the contract's own currency. Read `currencyCode` from [list contracts](https://www.kachingappz.com/developers/subscriptions/contracts/#list-contracts) before choosing an amount. An amount larger than the order total floors the order at zero, so the next billing attempt charges `0.00`.

**Example**

```bash
curl -X POST "https://subscriptions.kachingappz.app/shop-api/contracts/add-discount" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "contractId": "gid://shopify/SubscriptionContract/123456789",
    "discountType": "PERCENTAGE",
    "value": 15,
    "title": "15% off your next 3 orders",
    "recurringCycleLimit": 3
  }'
```

**Response (200)**

```json
{
  "success": true,
  "discount": {
    "id": "gid://shopify/SubscriptionManualDiscount/12345678",
    "title": "15% off your next 3 orders",
    "type": "PERCENTAGE",
    "value": 15,
    "currencyCode": "USD",
    "recurringCycleLimit": 3
  }
}
```

**Every call applies — repeat calls stack.** There is no deduplication: two requests leave **two** discounts on the contract, whether or not they are identical. Stacking is deliberate, so that you can layer a second offer on a contract that already carries one.

> **Warning** A request that times out may still have applied its discount, so do not retry blindly — read [list contracts](https://www.kachingappz.com/developers/subscriptions/contracts/#list-contracts) first, or you will discount the customer twice. This matters because there is no endpoint to remove or update a discount: anything applied in error has to be taken off by the merchant from the Kaching admin.

---
