Skip to main content
PATCH
/
subscriptions
/
{subscriptionId}
/
items
/
{itemId}
Update a subscription item
curl --request PATCH \
  --url https://api.juo.io/admin/v1/subscriptions/{subscriptionId}/items/{itemId} \
  --header 'Content-Type: application/json' \
  --header 'X-Juo-Admin-Api-Key: <api-key>' \
  --header 'X-Tenant-ID: <x-tenant-id>' \
  --data '
{
  "quantity": 1,
  "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
      }
    ]
  }
}
'
import requests

url = "https://api.juo.io/admin/v1/subscriptions/{subscriptionId}/items/{itemId}"

payload = {
    "quantity": 1,
    "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
            }
        ]
    }
}
headers = {
    "X-Tenant-ID": "<x-tenant-id>",
    "X-Juo-Admin-Api-Key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PATCH',
  headers: {
    'X-Tenant-ID': '<x-tenant-id>',
    'X-Juo-Admin-Api-Key': '<api-key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    quantity: 1,
    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}]
    }
  })
};

fetch('https://api.juo.io/admin/v1/subscriptions/{subscriptionId}/items/{itemId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.juo.io/admin/v1/subscriptions/{subscriptionId}/items/{itemId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => json_encode([
    'quantity' => 1,
    '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
                ]
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-Juo-Admin-Api-Key: <api-key>",
    "X-Tenant-ID: <x-tenant-id>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.juo.io/admin/v1/subscriptions/{subscriptionId}/items/{itemId}"

	payload := strings.NewReader("{\n  \"quantity\": 1,\n  \"billingPolicy\": {\n    \"interval\": \"DAY\",\n    \"intervalCount\": 183,\n    \"anchors\": [\n      {\n        \"type\": \"WEEKDAY\",\n        \"day\": 16,\n        \"month\": 6,\n        \"cutoffDay\": 16\n      }\n    ],\n    \"minCycles\": 2,\n    \"maxCycles\": 2\n  },\n  \"deliveryPolicy\": {\n    \"interval\": \"DAY\",\n    \"intervalCount\": 183,\n    \"anchors\": [\n      {\n        \"type\": \"WEEKDAY\",\n        \"day\": 16,\n        \"month\": 6,\n        \"cutoffDay\": 16\n      }\n    ]\n  }\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("X-Tenant-ID", "<x-tenant-id>")
	req.Header.Add("X-Juo-Admin-Api-Key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.juo.io/admin/v1/subscriptions/{subscriptionId}/items/{itemId}")
  .header("X-Tenant-ID", "<x-tenant-id>")
  .header("X-Juo-Admin-Api-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"quantity\": 1,\n  \"billingPolicy\": {\n    \"interval\": \"DAY\",\n    \"intervalCount\": 183,\n    \"anchors\": [\n      {\n        \"type\": \"WEEKDAY\",\n        \"day\": 16,\n        \"month\": 6,\n        \"cutoffDay\": 16\n      }\n    ],\n    \"minCycles\": 2,\n    \"maxCycles\": 2\n  },\n  \"deliveryPolicy\": {\n    \"interval\": \"DAY\",\n    \"intervalCount\": 183,\n    \"anchors\": [\n      {\n        \"type\": \"WEEKDAY\",\n        \"day\": 16,\n        \"month\": 6,\n        \"cutoffDay\": 16\n      }\n    ]\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.juo.io/admin/v1/subscriptions/{subscriptionId}/items/{itemId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["X-Tenant-ID"] = '<x-tenant-id>'
request["X-Juo-Admin-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"quantity\": 1,\n  \"billingPolicy\": {\n    \"interval\": \"DAY\",\n    \"intervalCount\": 183,\n    \"anchors\": [\n      {\n        \"type\": \"WEEKDAY\",\n        \"day\": 16,\n        \"month\": 6,\n        \"cutoffDay\": 16\n      }\n    ],\n    \"minCycles\": 2,\n    \"maxCycles\": 2\n  },\n  \"deliveryPolicy\": {\n    \"interval\": \"DAY\",\n    \"intervalCount\": 183,\n    \"anchors\": [\n      {\n        \"type\": \"WEEKDAY\",\n        \"day\": 16,\n        \"month\": 6,\n        \"cutoffDay\": 16\n      }\n    ]\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "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>"
}

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

itemId
string<uuid>
required

The subscription item identifier

Body

application/json
quantity
integer

Number of units ordered per billing cycle.

Required range: x >= 1
Example:

1

billingPolicy
null | object
deliveryPolicy
null | object

Response

Default Response

id
string<uuid>
required

Unique subscription item identifier (UUID).

Example:

"a1b2c3d4-e5f6-7890-abcd-ef1234567890"

resource
enum<string>
required
Available options:
subscription-item
title
string
required

Product title.

Minimum string length: 1
Example:

"Monthly Coffee Blend"

subtitle
null | string
required

Variant title. Matches the variant title in most cases.

Minimum string length: 1
Example:

"250g / Ground"

quantity
integer
required

Number of units ordered per billing cycle.

Required range: x >= 1
Example:

1

totalPrice
number
required

Final item price per billing cycle including all applicable discounts.

Required range: x >= 0
Example:

24.99

recurringCycleLimit
null | integer
required

Maximum number of billing cycles this item remains on the subscription. The item is automatically removed once this limit is reached. Null means no limit.

Required range: x >= 1
Example:

3

canceledAt
null | string<date-time>
required

Cancellation date of the item.

billingPolicy
null | BillingPolicy · object
required
deliveryPolicy
null | DeliveryPolicy · object
required
customAttributes
object[]
required

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

variant
required

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

Minimum string length: 1
product
required

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

Minimum string length: 1