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_0de9c79c1e2beee09499dc8220493d59
    -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": "c4a319d1-b303-4d1d-80a7-38fce0a7ce12"
        },
        "data": [
            {
                "id": "subi_e5dbbf84c68e5bb7db761625158d4262",
                "created": 1560329454,
    						"metadata": {
    							"merchant_defined": true
    						},
                "quantity": 2,
                "plan": {
                    "id": "plan_dad429f5e16c41499c9c23356a5e8dea",
                    "aggregate_usage": "sum",
                    "amount": 0,
                    "billing_scheme": "per_unit",
                    "created_at": 1559803170,
                    "currency": "USD",
                    "interval": "month",
                    "interval_count": 1,
                    "metadata": {},
                    "product": {
                        "id": "product_97f34708270f13d95d9c505eb785e3c5",
                        "active": true,
                        "attributes": [],
                        "created_at": 1546179439,
                        "description": "",
                        "images": [],
                        "metadata": {},
                        "name": "Monthly parking",
                        "package_dimensions": {
                            "height": 0,
                            "length": 0,
                            "weight": 0,
                            "width": 0
                        },
                        "shippable": false,
                        "skus": [],
                        "statement_descriptor": "MONTHLY PARKING",
                        "type": "service",
                        "unit_label": "",
                        "updated_at": 1546179439
                    },
                    "nickname": "",
                    "tiers": [],
                    "tiers_mode": "",
                    "transform_usage": {
                        "divide_by": 0,
                        "round": ""
                    },
                    "trial_period_days": 0,
                    "usage_type": "metered"
                }
            },
            {
                "id": "subi_93f7513e84c024ba1bb7efaeb75d9faf",
                "created": 1559805646,
                "metadata": null,
                "quantity": 1,
                "plan": {
                    "id": "555",
                    "aggregate_usage": "sum",
                    "amount": 0,
                    "billing_scheme": "per_unit",
                    "created_at": 1559805631,
                    "currency": "USD",
                    "interval": "month",
                    "interval_count": 1,
                    "metadata": {},
                    "product": {
                        "id": "product_97f34708270f13d95d9c505eb785e3c5",
                        "active": true,
                        "attributes": [],
                        "created_at": 1546179439,
                        "description": "",
                        "images": [],
                        "metadata": {},
                        "name": "Monthly parking",
                        "package_dimensions": {
                            "height": 0,
                            "length": 0,
                            "weight": 0,
                            "width": 0
                        },
                        "shippable": false,
                        "skus": [],
                        "statement_descriptor": "MONTHLY PARKING",
                        "type": "service",
                        "unit_label": "",
                        "updated_at": 1546179439
                    },
                    "nickname": "",
                    "tiers": [],
                    "tiers_mode": "",
                    "transform_usage": {
                        "divide_by": 0,
                        "round": ""
                    },
                    "trial_period_days": 0,
                    "usage_type": "metered"
                }
            }
        ]
    }