Get customer subscriptions
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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"
req, _ := http.NewRequest("GET", 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.get("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"subscriptions": {
"123": {
"order_id": 456,
"subscription_number": "#123",
"subscription_status": "Active",
"next_payment": "January 15, 2025",
"subscription_total": "$29.99",
"is_manual": false
},
"124": {
"order_id": 457,
"subscription_number": "#124",
"subscription_status": "On hold",
"next_payment": "N/A",
"subscription_total": "$19.99",
"is_manual": false
}
},
"pagination": {
"previous": null,
"next": null
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}My Account - Get Subscriptions
Retrieve customer subscription list with pagination
GET
/
my-account
/
subscriptions
Get customer subscriptions
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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"
req, _ := http.NewRequest("GET", 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.get("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/subscriptions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"subscriptions": {
"123": {
"order_id": 456,
"subscription_number": "#123",
"subscription_status": "Active",
"next_payment": "January 15, 2025",
"subscription_total": "$29.99",
"is_manual": false
},
"124": {
"order_id": 457,
"subscription_number": "#124",
"subscription_status": "On hold",
"next_payment": "N/A",
"subscription_total": "$19.99",
"is_manual": false
}
},
"pagination": {
"previous": null,
"next": null
}
}{
"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
Query Parameters
The pagination of subscriptions to return
Limit of subscriptions to return per page
Required range:
1 <= x <= 100Order sort attribute ascending or descending
Available options:
ASC, DESC Response
Subscriptions retrieved successfully
Object with subscription IDs as keys
Show child attributes
Show child attributes
Example:
{
"789": {
"order_id": 456,
"subscription_number": "#789",
"subscription_status": "Active",
"next_payment": "January 15, 2025",
"subscription_total": "$29.99",
"is_manual": false
}
}
Show child attributes
Show child attributes
⌘I