curl --request PATCH \
--url https://api.juo.io/admin/v1/subscriptions/{subscriptionId} \
--header 'Content-Type: application/json' \
--header 'X-Juo-Admin-Api-Key: <api-key>' \
--header 'X-Tenant-ID: <x-tenant-id>' \
--data '
{
"deliveryPrice": 1,
"paymentMethod": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"backupPaymentMethod": "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>"
},
"deliveryMethod": {
"type": "shipping",
"title": "<string>",
"description": "<string>"
},
"nextBillingDate": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.juo.io/admin/v1/subscriptions/{subscriptionId}"
payload = {
"deliveryPrice": 1,
"paymentMethod": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"backupPaymentMethod": "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>"
},
"deliveryMethod": {
"type": "shipping",
"title": "<string>",
"description": "<string>"
},
"nextBillingDate": "2023-11-07T05:31:56Z"
}
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({
deliveryPrice: 1,
paymentMethod: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
backupPaymentMethod: '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>'
},
deliveryMethod: {type: 'shipping', title: '<string>', description: '<string>'},
nextBillingDate: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.juo.io/admin/v1/subscriptions/{subscriptionId}', 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}",
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([
'deliveryPrice' => 1,
'paymentMethod' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'backupPaymentMethod' => '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>'
],
'deliveryMethod' => [
'type' => 'shipping',
'title' => '<string>',
'description' => '<string>'
],
'nextBillingDate' => '2023-11-07T05:31:56Z'
]),
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}"
payload := strings.NewReader("{\n \"deliveryPrice\": 1,\n \"paymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"backupPaymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"deliveryAddress\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"address1\": \"<string>\",\n \"address2\": \"<string>\",\n \"zip\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"countryCode\": \"<string>\",\n \"provinceCode\": \"<string>\",\n \"province\": \"<string>\",\n \"phone\": \"<string>\",\n \"company\": \"<string>\"\n },\n \"deliveryMethod\": {\n \"type\": \"shipping\",\n \"title\": \"<string>\",\n \"description\": \"<string>\"\n },\n \"nextBillingDate\": \"2023-11-07T05:31:56Z\"\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}")
.header("X-Tenant-ID", "<x-tenant-id>")
.header("X-Juo-Admin-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"deliveryPrice\": 1,\n \"paymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"backupPaymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"deliveryAddress\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"address1\": \"<string>\",\n \"address2\": \"<string>\",\n \"zip\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"countryCode\": \"<string>\",\n \"provinceCode\": \"<string>\",\n \"province\": \"<string>\",\n \"phone\": \"<string>\",\n \"company\": \"<string>\"\n },\n \"deliveryMethod\": {\n \"type\": \"shipping\",\n \"title\": \"<string>\",\n \"description\": \"<string>\"\n },\n \"nextBillingDate\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.juo.io/admin/v1/subscriptions/{subscriptionId}")
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 \"deliveryPrice\": 1,\n \"paymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"backupPaymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"deliveryAddress\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"address1\": \"<string>\",\n \"address2\": \"<string>\",\n \"zip\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"countryCode\": \"<string>\",\n \"provinceCode\": \"<string>\",\n \"province\": \"<string>\",\n \"phone\": \"<string>\",\n \"company\": \"<string>\"\n },\n \"deliveryMethod\": {\n \"type\": \"shipping\",\n \"title\": \"<string>\",\n \"description\": \"<string>\"\n },\n \"nextBillingDate\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"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": {
"type": "shipping",
"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": 2,
"anchors": [
{
"type": "WEEKDAY",
"day": 16,
"month": 6,
"cutoffDay": 16
}
],
"minCycles": 2,
"maxCycles": 2
},
"deliveryPolicy": {
"interval": "DAY",
"intervalCount": 2,
"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",
"backupPaymentMethod": "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
}Update subscription
Used to update a subscription.
curl --request PATCH \
--url https://api.juo.io/admin/v1/subscriptions/{subscriptionId} \
--header 'Content-Type: application/json' \
--header 'X-Juo-Admin-Api-Key: <api-key>' \
--header 'X-Tenant-ID: <x-tenant-id>' \
--data '
{
"deliveryPrice": 1,
"paymentMethod": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"backupPaymentMethod": "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>"
},
"deliveryMethod": {
"type": "shipping",
"title": "<string>",
"description": "<string>"
},
"nextBillingDate": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.juo.io/admin/v1/subscriptions/{subscriptionId}"
payload = {
"deliveryPrice": 1,
"paymentMethod": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"backupPaymentMethod": "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>"
},
"deliveryMethod": {
"type": "shipping",
"title": "<string>",
"description": "<string>"
},
"nextBillingDate": "2023-11-07T05:31:56Z"
}
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({
deliveryPrice: 1,
paymentMethod: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
backupPaymentMethod: '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>'
},
deliveryMethod: {type: 'shipping', title: '<string>', description: '<string>'},
nextBillingDate: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.juo.io/admin/v1/subscriptions/{subscriptionId}', 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}",
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([
'deliveryPrice' => 1,
'paymentMethod' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'backupPaymentMethod' => '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>'
],
'deliveryMethod' => [
'type' => 'shipping',
'title' => '<string>',
'description' => '<string>'
],
'nextBillingDate' => '2023-11-07T05:31:56Z'
]),
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}"
payload := strings.NewReader("{\n \"deliveryPrice\": 1,\n \"paymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"backupPaymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"deliveryAddress\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"address1\": \"<string>\",\n \"address2\": \"<string>\",\n \"zip\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"countryCode\": \"<string>\",\n \"provinceCode\": \"<string>\",\n \"province\": \"<string>\",\n \"phone\": \"<string>\",\n \"company\": \"<string>\"\n },\n \"deliveryMethod\": {\n \"type\": \"shipping\",\n \"title\": \"<string>\",\n \"description\": \"<string>\"\n },\n \"nextBillingDate\": \"2023-11-07T05:31:56Z\"\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}")
.header("X-Tenant-ID", "<x-tenant-id>")
.header("X-Juo-Admin-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"deliveryPrice\": 1,\n \"paymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"backupPaymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"deliveryAddress\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"address1\": \"<string>\",\n \"address2\": \"<string>\",\n \"zip\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"countryCode\": \"<string>\",\n \"provinceCode\": \"<string>\",\n \"province\": \"<string>\",\n \"phone\": \"<string>\",\n \"company\": \"<string>\"\n },\n \"deliveryMethod\": {\n \"type\": \"shipping\",\n \"title\": \"<string>\",\n \"description\": \"<string>\"\n },\n \"nextBillingDate\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.juo.io/admin/v1/subscriptions/{subscriptionId}")
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 \"deliveryPrice\": 1,\n \"paymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"backupPaymentMethod\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"deliveryAddress\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"address1\": \"<string>\",\n \"address2\": \"<string>\",\n \"zip\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"countryCode\": \"<string>\",\n \"provinceCode\": \"<string>\",\n \"province\": \"<string>\",\n \"phone\": \"<string>\",\n \"company\": \"<string>\"\n },\n \"deliveryMethod\": {\n \"type\": \"shipping\",\n \"title\": \"<string>\",\n \"description\": \"<string>\"\n },\n \"nextBillingDate\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"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": {
"type": "shipping",
"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": 2,
"anchors": [
{
"type": "WEEKDAY",
"day": 16,
"month": 6,
"cutoffDay": 16
}
],
"minCycles": 2,
"maxCycles": 2
},
"deliveryPolicy": {
"interval": "DAY",
"intervalCount": 2,
"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",
"backupPaymentMethod": "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
Headers
Body
The id of the customer's payment method to charge after a renewal payment with the primary payment method is declined; null removes the backup. It must belong to the subscription's customer, must not be revoked, must be chargeable automatically and must differ from the primary payment method; otherwise the request fails with 400 and a BACKUP_PAYMENT_METHOD_* code.
Response
Default Response
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.
active, paused, canceled, failed, expired, merged "active"
The subscription's backup payment method: after a renewal payment with the primary paymentMethod is declined, the next attempt charges this one. null when the subscription has no backup. CustomerPaymentMethod id when not expanded, or the full CustomerPaymentMethod object when the field name is included in the expand query parameter. Can be null.