Rohan

Rohan

  • 1.1k
  • 1.3k
  • 37.4k

Get Data from Loop

May 18 2022 11:03 AM

{{
  "id": "sub_",
  "object": "subscription",
  "application_fee_percent": null,
  "automatic_tax": {
    "enabled": false
  },
  "billing_cycle_anchor": 1652864127,
  "billing_thresholds": null,
  "cancel_at": null,
  "cancel_at_period_end": false,
  "canceled_at": null,
  "collection_method": "charge_automatically",
  "created": 1652864127,
  "current_period_end": 1655542527,
  "current_period_start": 1652864127,
  "customer": "cus_Lh",
  "days_until_due": null,
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "discount": null,
  "ended_at": null,
  "items": {
    "object": "list",
    "data": [
      {
        "id": "si,
        "object": "subscription_item",
        "billing_thresholds": null,
        "created": 1652864128,
        "metadata": {},
        "plan": {
          "id": "price",
          "object": "plan",
          "active": true,
          "aggregate_usage": null,
          "amount": 34900,
          "amount_decimal": 34900.0,
          "billing_scheme": "per_unit",
          "created": 1633582871,
          "currency": "usd",
          "interval": "month",
          "interval_count": 1,
          "livemode": false,
          "metadata": {},
          "nickname": "Monthly ",
          "product": "prod",
          "tiers": null,
          "tiers_mode": null,
          "transform_usage": null,
          "trial_period_days": 7,
          "usage_type": "licensed"
        },
        "price": {
          "id": "price",
          "object": "price",
          "active": true,
          "billing_scheme": "per_unit",
          "created": 1633582871,
          "currency": "usd",
          "livemode": false,
          "lookup_key": null,
          "metadata": {},
          "nickname": "Monthly",
          "product": "prod",
          "recurring": {
            "aggregate_usage": null,
            "interval": "month",--- How to get this value from this data 
            "interval_count": 1,
            "trial_period_days": 7,
            "usage_type": "licensed"
          },
          "tax_behavior": "unspecified",
          "tiers": null,
          "tiers_mode": null,
          "transform_quantity": null,
          "type": "recurring",
          "unit_amount": 34900,
          "unit_amount_decimal": 34900.0
        },
        "quantity": 1,
        "subscription": "sub_1L0ifDL5yyM9sctMb9Y5esDH",
        "tax_rates": []
      }
    ],
    "has_more": false,
    "url": "/v1/subscription_items?subscription=sub_1L0ifDL5yyM9sctMb9Y5esDH"
  },
  "latest_invoice": "in_1L0ifDL5yyM9sctMzZXZExO1",
  "livemode": false,
  "metadata": {
    "UserID": "1762"
  },
  "next_pending_invoice_item_invoice": null,
  "pause_collection": null,
  "pending_invoice_item_interval": null,
  "pending_setup_intent": null,
  "pending_update": null,
  "schedule": null,
  "start_date": 1652864127,
  "status": "active",
  "transfer_data": null,
  "trial_end": null,
  "trial_start": null
}}

 

I have use this code but not working

var Plan = service.Get(SID);
                        var get_interval = JObject.Parse(Plan.ToJson().ToString());
                        var final_Interval = Convert.ToString(get_interval["data"][""]);


Answers (1)