code: import stripe
  stripe.api_key = "sk_test_your_key"
  
  stripe.SubscriptionSchedule.cancel(
    "sub_sched_1JuFVT2eZvKYlo2CSOQvG7P6",
  )
  '''Response {
    "id": "sub_sched_1JuFVT2eZvKYlo2CSOQvG7P6",
    "object": "subscription_schedule",
    "application": null,
    "canceled_at": 1659518858,
    "completed_at": null,
    "created": 1636545743,
    "current_phase": null,
    "customer": "cus_8TEMHVY5moxIPI",
    "default_settings": {
      "application_fee_percent": null,
      "automatic_tax": {
        "enabled": false
      },
      "billing_cycle_anchor": "automatic",
      "billing_thresholds": null,
      "collection_method": "charge_automatically",
      "default_payment_method": null,
      "invoice_settings": null,
      "transfer_data": null
    },
    "end_behavior": "release",
    "livemode": false,
    "metadata": {},
    "phases": [
      {
        "add_invoice_items": [],
        "application_fee_percent": null,
        "billing_cycle_anchor": null,
        "billing_thresholds": null,
        "collection_method": null,
        "coupon": null,
        "default_payment_method": null,
        "default_tax_rates": [],
        "end_date": 1668685170,
        "invoice_settings": null,
        "items": [
          {
            "billing_thresholds": null,
            "price": "plan_JiX4v6L7JY0Vyt",
            "quantity": 1,
            "tax_rates": []
          }
        ],
        "metadata": {},
        "proration_behavior": "create_prorations",
        "start_date": 1637149170,
        "transfer_data": null,
        "trial_end": null
      }
    ],
    "released_at": null,
    "released_subscription": null,
    "status": "canceled",
    "subscription": null,
    "test_clock": null
  }'''
nl: Cancel a scheduleCancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.Parameters invoice_now optional If the subscription schedule is active, indicates if a final invoice will be generated that contains any un-invoiced metered usage and new/pending proration invoice items. Defaults to true.More parametersExpand all  prorate optional ReturnsThe canceled subscription_schedule object. Its status will be canceled and canceled_at will be the current time