Sample code for 30+ languages & platforms
C# Requires Chilkat v11.7.0+

Stripe: Review a customer's subscriptions

See more Stripe Examples

List a customer's subscriptions and inspect their items, prices, and seat counts.

Stripe documentation and cURL example

Chilkat C# Downloads

C#
bool success = false;

//  Requires an unlocked Chilkat bundle. See Global Unlock Sample.
//  Supply a restricted sandbox key from merchant-controlled configuration.
string apiKey = "YOUR_STRIPE_TEST_KEY";

Chilkat.HttpCurl curl = new Chilkat.HttpCurl();
Chilkat.StringBuilder cmd = new Chilkat.StringBuilder();
Chilkat.JsonObject json = new Chilkat.JsonObject();

int replaced;

string customerId = "cus_FROM_BILLING_ACCOUNT";

Chilkat.StringBuilder pageSuffix = new Chilkat.StringBuilder();
bool more = true;
string cursor = "";
while ((more == true)) {
    //  curl -X GET "https://api.stripe.com/v1/subscriptions?customer={customerId}&status=all&limit=100" \
    //    -u "$STRIPE_API_KEY:" \
    //    -H "Stripe-Version: 2026-10-28.endive"
    cmd.SetString("curl -X GET \"https://api.stripe.com/v1/subscriptions?customer=@ID@&status=all&limit=100@CURSOR@\"");
    cmd.Append(" -u \"@KEY@:\"");
    cmd.Append(" -H \"Stripe-Version: 2026-10-28.endive\"");
    replaced = cmd.Replace("@CURSOR@",pageSuffix.GetAsString());
    replaced = cmd.Replace("@ID@",customerId);
    replaced = cmd.Replace("@KEY@",apiKey);
    success = curl.DoYourThing(cmd.GetAsString());
    if (success != true) {
        Debug.WriteLine("No HTTP response. Chilkat failure code: " + Convert.ToString(curl.FailReason));
        return;
    }

    success = curl.GetResponseJson(json);
    if ((curl.StatusCode != 200) || (success != true)) {
        Debug.WriteLine("Stripe HTTP " + Convert.ToString(curl.StatusCode) + "  Request-Id: " + curl.GetResponseHeaderField("Request-Id"));
        if (success == true) {
            Debug.WriteLine(json.StringOf("error.message"));
        }

        return;
    }

    int i = 0;
    int count = json.SizeOfArray("data");
    while ((i < count)) {
        json.I = i;
        Debug.WriteLine(json.StringOf("data[i].id") + " | " + json.StringOf("data[i].status"));
        int j = 0;
        while ((j < json.SizeOfArray("data[i].items.data"))) {
            json.J = j;
            Debug.WriteLine("  Item " + json.StringOf("data[i].items.data[j].id") + "  price " + json.StringOf("data[i].items.data[j].price.id") + "  quantity " + json.StringOf("data[i].items.data[j].quantity"));
            j = j + 1;
        }

        if (json.BoolOf("data[i].items.has_more") == true) {
            Debug.WriteLine("Additional items are available via /v1/subscription_items for this subscription.");
        }

        i = i + 1;
    }

    more = json.BoolOf("has_more");
    if (more == true) {
        string next = json.StringOf("data[i].id");
        if ((count < 1) || (next == "") || (next == cursor)) {
            Debug.WriteLine("Invalid pagination cursor.");
            return;
        }

        cursor = next;
        pageSuffix.SetString("&starting_after=");
        pageSuffix.Append(cursor);
    }

}