Suspend subscription
curl --request POST \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold', 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 => "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"subscription_id": 123,
"subscription_status": "<string>",
"requires_payment": true,
"payment_processed": true,
"payment_method": "<string>",
"is_manual": "true",
"payment_token": {
"id": 123,
"token": "<string>",
"type": "cc",
"gateway_id": "<string>",
"is_default": true,
"expires": "12/2025"
},
"available_tokens": [
{
"id": 123,
"token": "<string>",
"type": "cc",
"gateway_id": "<string>",
"is_default": true,
"expires": "12/2025"
}
],
"can_use_token": true,
"checkout_url": "<string>",
"order_id": 123,
"order_key": "<string>",
"order_total": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}Suspend Subscription
Put a subscription on hold
POST
/
my-account
/
subscriptions
/
{id}
/
on-hold
Suspend subscription
curl --request POST \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold', 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 => "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/on-hold")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"subscription_id": 123,
"subscription_status": "<string>",
"requires_payment": true,
"payment_processed": true,
"payment_method": "<string>",
"is_manual": "true",
"payment_token": {
"id": 123,
"token": "<string>",
"type": "cc",
"gateway_id": "<string>",
"is_default": true,
"expires": "12/2025"
},
"available_tokens": [
{
"id": 123,
"token": "<string>",
"type": "cc",
"gateway_id": "<string>",
"is_default": true,
"expires": "12/2025"
}
],
"can_use_token": true,
"checkout_url": "<string>",
"order_id": 123,
"order_key": "<string>",
"order_total": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}This endpoint is currently shown as a preview of what’s currently in development and is subject to change.
This endpoint supports only the official WooCommerce Subscriptions extension.
Authorizations
basicAuthbearerAuth
WordPress username and password
Path Parameters
Subscription ID
Response
Subscription suspended successfully
Subscription ID
Current subscription status
Whether payment is required
Whether payment was processed
Payment method display name
Whether subscription is manual renewal
Available options:
true, false Show child attributes
Show child attributes
Available payment tokens for the customer
Show child attributes
Show child attributes
Whether saved tokens can be used
Checkout API URL for payment
Order ID requiring payment
Order key for payment
Order total amount
Action result message