Skip to main content

Documentation

Retrieve Plan

Retrieve the details of a pricing plan for services.

    • plan

    • ID of the plan.

Code Samples
    • .NET

      • using System;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string plan = "plan_51788cf4ed1b672cb0a2a97773887f5b";
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $"/v1/plans/{plan}");
        
                        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/plans/plan_51788cf4ed1b672cb0a2a97773887f5b');
        
            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/plans/plan_51788cf4ed1b672cb0a2a97773887f5b');
            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/plans/plan_51788cf4ed1b672cb0a2a97773887f5b')
        pprint(result)
  • /v1/plans/:plan

  • Retrieve Plan

  • curl -X get
    https://sandboxapi.rapyd.net/v1/plans/plan_889a7dc707b2ca13a815b008bec61a7d
    -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": "74e7443f-6499-4bf8-8796-0d76bb33db86"
        },
        "data": {
            "id": "plan_889a7dc707b2ca13a815b008bec61a7d",
            "aggregate_usage": "sum",
            "amount": 5,
            "billing_scheme": "per_unit",
            "created_at": 1616315917,
            "currency": "USD",
            "interval": "day",
            "interval_count": 1,
            "metadata": {},
            "product": {
                "id": "product_903650fb06b7099413db8019c1646d4b",
                "active": true,
                "attributes": [],
                "created_at": 1616315223,
                "description": "",
                "images": [],
                "metadata": {},
                "name": "Acme music stream",
                "package_dimensions": {
                    "height": 0,
                    "length": 0,
                    "weight": 0,
                    "width": 0
                },
                "shippable": false,
                "skus": [],
                "statement_descriptor": "",
                "type": "services",
                "unit_label": "",
                "updated_at": 1616315223
            },
            "nickname": "Basic",
            "tiers": [],
            "tiers_mode": "",
            "transform_usage": {
                "divide_by": 1,
                "round": "up"
            },
            "trial_period_days": 0,
            "usage_type": "licensed",
            "active": false
        }
    }