Skip to main content
POST
/
subscriptions
/
{subscriptionId}
/
cancel
Cancel a subscription
curl --request POST \
  --url https://api.juo.io/admin/v1/subscriptions/{subscriptionId}/cancel \
  --header 'Content-Type: application/json' \
  --header 'X-Juo-Admin-Api-Key: <api-key>' \
  --header 'X-Tenant-ID: <x-tenant-id>' \
  --data '
{
  "notifyCustomer": true,
  "cancellationReason": "<string>"
}
'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "resource": "subscription",
  "serial": "1042",
  "status": "active",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "canceledAt": "2023-11-07T05:31:56Z",
  "nextBillingDate": "2024-02-15T10:00:00.000Z",
  "currentCycle": 1,
  "currencyCode": "USD",
  "billingPolicy": {
    "interval": "MONTH",
    "intervalCount": 1
  },
  "deliveryPolicy": {
    "interval": "MONTH",
    "intervalCount": 1
  },
  "deliveryMethod": {
    "title": "<string>",
    "description": "<string>"
  },
  "customAttributes": [
    {
      "key": "<string>",
      "value": "<string>"
    }
  ],
  "customer": "7654321",
  "items": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "resource": "subscription-item",
      "title": "Monthly Coffee Blend",
      "subtitle": "250g / Ground",
      "quantity": 1,
      "totalPrice": 24.99,
      "recurringCycleLimit": 3,
      "canceledAt": "2023-11-07T05:31:56Z",
      "billingPolicy": {
        "interval": "DAY",
        "intervalCount": 183,
        "anchors": [
          {
            "type": "WEEKDAY",
            "day": 16,
            "month": 6,
            "cutoffDay": 16
          }
        ],
        "minCycles": 2,
        "maxCycles": 2
      },
      "deliveryPolicy": {
        "interval": "DAY",
        "intervalCount": 183,
        "anchors": [
          {
            "type": "WEEKDAY",
            "day": 16,
            "month": 6,
            "cutoffDay": 16
          }
        ]
      },
      "customAttributes": [
        {
          "key": "<string>",
          "value": "<string>"
        }
      ],
      "variant": "<string>",
      "product": "<string>"
    }
  ],
  "discounts": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "resource": "subscription-discount",
      "title": "<string>",
      "target": {
        "type": "shipping"
      },
      "value": {
        "amount": 123,
        "type": "fixed-amount",
        "appliesOnEachItem": true
      },
      "recurringCycleLimit": 2
    }
  ],
  "paymentMethod": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "deliveryAddress": {
    "firstName": "<string>",
    "lastName": "<string>",
    "address1": "<string>",
    "address2": "<string>",
    "zip": "<string>",
    "city": "<string>",
    "country": "<string>",
    "countryCode": "<string>",
    "provinceCode": "<string>",
    "province": "<string>",
    "phone": "<string>",
    "company": "<string>"
  },
  "deliveryPrice": 1
}

Authorizations

X-Juo-Admin-Api-Key
string
header
required

Long-lived Admin API key issued from the Juo merchant portal. Pass as the X-Juo-Admin-Api-Key header.

Headers

X-Tenant-ID
string
required

Unique identifier of the tenant in the system (usually a store identifier)

Path Parameters

subscriptionId
string<uuid>
required

The subscription identifier

Body

application/json
notifyCustomer
boolean
required

Choose whether to send notifications to customers when their subscription is canceled.

cancellationReason
string

The reason for canceling the subscription.

Minimum string length: 1

Response

Default Response

id
string<uuid>
required

Unique subscription identifier (UUID).

Example:

"550e8400-e29b-41d4-a716-446655440000"

resource
enum<string>
required
Available options:
subscription
serial
string
required

Unique serial number that increments sequentially with each new subscription within a store.

Minimum string length: 1
Example:

"1042"

status
enum<string>
required

Subscription lifecycle status. active: billing runs on schedule; paused: billing suspended until resumed; canceled: permanently stopped (can be reactivated); failed: latest billing attempt failed; expired: reached configured end date; merged: consolidated into another subscription.

Available options:
active,
paused,
canceled,
failed,
expired,
merged
Example:

"active"

createdAt
string<date-time>
required

Purchase date of the subscription.

updatedAt
string<date-time>
required

Last update date of the subscription.

canceledAt
null | string<date-time>
required

Cancellation date of the subscription.

nextBillingDate
null | string<date-time>
required

The next billing date determines when the renewal process begins its billing phase. When billing succeeds, it creates one order—or multiple orders for prepaid subscriptions.

Example:

"2024-02-15T10:00:00.000Z"

currentCycle
integer
required

The subscription's billing cycle count. Starts at 0 before the first billing completes, increments by 1 with each successful billing.

Required range: x >= 0
Example:

1

currencyCode
string
required

ISO 4217 currency code that applies to both item prices and delivery price.

Required string length: 3
Example:

"USD"

billingPolicy
object
required

How often and when the subscription is billed.

deliveryPolicy
object
required

How often shipments are dispatched. Usually matches the billing policy.

deliveryMethod
null | object
required
customAttributes
object[]
required

Arbitrary key-value pairs attached to this subscription. In the Customer API, attributes whose key starts with _ are hidden and excluded.

customer
required

Customer id when not expanded, or the full Customer object when the field name is included in the expand query parameter. Can be null.

Minimum string length: 1
Example:

"7654321"

items
SubscriptionItem · object[]
required
Minimum array length: 1
discounts
SubscriptionDiscount · object[]
required
paymentMethod
required

CustomerPaymentMethod id when not expanded, or the full CustomerPaymentMethod object when the field name is included in the expand query parameter. Can be null.

deliveryAddress
null | Address · object
required
deliveryPrice
number
required

The delivery price for the upcoming renewal.

Required range: x >= 0