Skip to main content

Documentation

List Subscription Items

Retrieve a list of all subscription items for a subscription.

    • ending_before

    • The ID of the subscription item created after the last subscription item you want to retrieve.

    • limit

    • The maximum number of subscription items to return. Range: 1-100.

      10

    • starting_after

    • The ID of the subscription item created before the first subscription item you want to retrieve.

    • subscription

    • ID of the subscription.

Code Samples
    • .NET

      • using System;
        using System.Text.Json;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string subscription = "sub_0de9c79c1e2beee09499dc8220493d59";
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $"/v1/subscription_items/{subscription}");
        
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
        
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const result = await makeRequest(
              'GET',
              '/v1/subscription_items/sub_0de9c79c1e2beee09499dc8220493d59'
            );
        
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        try {
            $object = make_request('get', '/v1/subscription_items/sub_0de9c79c1e2beee09499dc8220493d59');
            var_dump($object);
        } catch(Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        result = make_request(method='get', path='/v1/subscription_items/sub_0de9c79c1e2beee09499dc8220493d59')
        pprint(result)
        
  • /v1/subscription_items

  • List Subscription Items

  • curl -X get 'https://sandboxapi.rapyd.net/v1/subscription_items/sub_1219e2329c4c5b26f08203d826a59d92' \
    -H 'access_key: your-access-key-here' \
    -H 'Content-Type: application/json' \
    -H 'salt: your-random-string-here' \
    -H 'signature: your-calculated-signature-here' \
    -H 'timestamp: your-unix-timestamp-here'
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "594a6b8d-f3e1-457e-8447-7210ecc3c5f9"
        },
        "data": [
            {
                "id": "subi_41e09a78ca1a10c2aedaa7d0225fe43b",
                "created": 1761573700,
                "metadata": null,
                "quantity": 1,
                "plan": {
                    "id": "plan_4304ce1f6d347a2204711cd2d5354fa9",
                    "aggregate_usage": "sum",
                    "amount": 1500,
                    "billing_scheme": "per_unit",
                    "created_at": 1761210402,
                    "currency": "USD",
                    "interval": "month",
                    "interval_count": 2,
                    "metadata": {},
                    "product": {
                        "id": "product_88fde8f1365082b50e8f4b37127edd99",
                        "active": true,
                        "attributes": [
                            "users"
                        ],
                        "created_at": 1673509005,
                        "description": "SaaS Users",
                        "images": [
                            "64bit-encoded-image-1"
                        ],
                        "metadata": {
                            "merchant_defined": true
                        },
                        "name": "SaaS Users",
                        "package_dimensions": {
                            "height": 0,
                            "length": 0,
                            "weight": 0,
                            "width": 0
                        },
                        "shippable": false,
                        "skus": [],
                        "statement_descriptor": "Number of Users",
                        "type": "services",
                        "unit_label": "users",
                        "updated_at": 1673509005
                    },
                    "nickname": "Licenses",
                    "tiers": [],
                    "tiers_mode": "",
                    "transform_usage": {
                        "divide_by": 5,
                        "round": "up"
                    },
                    "trial_period_days": 0,
                    "usage_type": "licensed",
                    "active": true
                }
            },
            {
                "id": "subi_353e05ee1107b6ecb9f1a7661358e575",
                "created": 1761213125,
                "metadata": null,
                "quantity": 1,
                "plan": {
                    "id": "plan_9338044c6ca654abd79da7319c40b7dc",
                    "aggregate_usage": "sum",
                    "amount": 0,
                    "billing_scheme": "tiered",
                    "created_at": 1761210135,
                    "currency": "USD",
                    "interval": "month",
                    "interval_count": 2,
                    "metadata": {},
                    "product": {
                        "id": "product_88fde8f1365082b50e8f4b37127edd99",
                        "active": true,
                        "attributes": [
                            "users"
                        ],
                        "created_at": 1673509005,
                        "description": "SaaS Users",
                        "images": [
                            "64bit-encoded-image-1"
                        ],
                        "metadata": {
                            "merchant_defined": true
                        },
                        "name": "SaaS Users",
                        "package_dimensions": {
                            "height": 0,
                            "length": 0,
                            "weight": 0,
                            "width": 0
                        },
                        "shippable": false,
                        "skus": [],
                        "statement_descriptor": "Number of Users",
                        "type": "services",
                        "unit_label": "users",
                        "updated_at": 1673509005
                    },
                    "nickname": "SaaS Users",
                    "tiers": [
                        {
                            "amount": 35,
                            "up_to": 5,
                            "flat_amount": 25
                        },
                        {
                            "amount": 30,
                            "up_to": 10,
                            "flat_amount": 0
                        },
                        {
                            "amount": 25,
                            "up_to": 25,
                            "flat_amount": 0
                        },
                        {
                            "amount": 20,
                            "up_to": 100,
                            "flat_amount": 0
                        },
                        {
                            "amount": 15,
                            "up_to": 500,
                            "flat_amount": 0
                        },
                        {
                            "amount": 10,
                            "up_to": "inf",
                            "flat_amount": 0
                        }
                    ],
                    "tiers_mode": "volume",
                    "transform_usage": {
                        "divide_by": 1,
                        "round": "up"
                    },
                    "trial_period_days": 0,
                    "usage_type": "licensed",
                    "active": true
                }
            }
        ]
    }