Reactivate subscription
curl --request POST \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"token_id": 123
}
'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate"
payload = { "token_id": 123 }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({token_id: 123})
};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate', 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}/reactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'token_id' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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 := "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate"
payload := strings.NewReader("{\n \"token_id\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.post("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"token_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token_id\": 123\n}"
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
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}Reactivate Subscription
Reactivate an on-hold subscription, optionally using a saved payment token
POST
/
my-account
/
subscriptions
/
{id}
/
reactivate
Reactivate subscription
curl --request POST \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"token_id": 123
}
'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate"
payload = { "token_id": 123 }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({token_id: 123})
};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate', 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}/reactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'token_id' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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 := "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate"
payload := strings.NewReader("{\n \"token_id\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.post("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"token_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions/{id}/reactivate")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token_id\": 123\n}"
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
}
}{
"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
Body
application/json
Optional payment token for payment processing
Payment token ID to use for payment (if required)
Response
Subscription reactivated or payment required
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