Skip to content
Join our SlackContact usGet started

Change Subscription Rate Card

client.Subscriptions.ChangeRateCard(ctx, subscriptionID, body) (*SubscriptionChangeRateCardResponse, error)
post/subscriptions/{subscription_id}/change-rate-card

Change Subscription Rate Card

ParametersExpand Collapse
subscriptionID string
body SubscriptionChangeRateCardParams
CheckoutCallbackURLs param.Field[CheckoutCallback]

The URLs to redirect to after the checkout is completed or cancelled, if a checkout is required.

RateCardID param.Field[string]

The ID of the rate card to change the subscription to.

UpgradeBehavior param.Field[SubscriptionChangeRateCardParamsUpgradeBehavior]optional

The behavior to use when upgrading the subscription. If 'prorate', the customer will be charged for the prorated difference. If 'rate_difference', the customer will be charged for the difference in the rate cards without respect to time.

const SubscriptionChangeRateCardParamsUpgradeBehaviorProrate SubscriptionChangeRateCardParamsUpgradeBehavior = "prorate"
const SubscriptionChangeRateCardParamsUpgradeBehaviorRateDifference SubscriptionChangeRateCardParamsUpgradeBehavior = "rate_difference"
ReturnsExpand Collapse
type SubscriptionChangeRateCardResponse struct{…}
Result SubscriptionChangeRateCardResponseResultUnion

The result of the request. If the request is successful, the subscription resource will be returned. If the request is requires action, the action to take to complete the request will be returned.

Accepts one of the following:
type SubscriptionChangeRateCardResponseResultRequiresAction struct{…}
Action SubscriptionChangeRateCardResponseResultRequiresActionAction

The action to take to complete the request.

CheckoutURL string

The URL of the checkout page to redirect to in order to complete the request.

Type Checkout
Accepts one of the following:
const CheckoutCheckout Checkout = "checkout"
Type RequiresAction
Accepts one of the following:
const RequiresActionRequiresAction RequiresAction = "requires_action"
type SubscriptionChangeRateCardResponseResultSuccess struct{…}

The updated subscription resource.

ID string

The ID of the subscription.

CancelsAtEndOfCycle bool

Whether the subscription will be cancelled at the end of the current cycle.

CurrentPeriod SubscriptionResourceCurrentPeriod

The current period of the subscription if it is active.

End Time
formatdate-time
Start Time
formatdate-time
InclusiveEnd booloptional
InclusiveStart booloptional
CyclesNextAt Time

The date and time the next cycle of the subscription will start.

formatdate-time
EffectiveAt Time

The date and time the subscription became effective.

formatdate-time
Metadata map[string, string]
RateCardID string

The ID of the rate card of the subscription.

Status SubscriptionResourceStatus

The status of the subscription.

Accepts one of the following:
const SubscriptionResourceStatusActive SubscriptionResourceStatus = "active"
const SubscriptionResourceStatusCancelled SubscriptionResourceStatus = "cancelled"
const SubscriptionResourceStatusPaused SubscriptionResourceStatus = "paused"
SubjectID string

The ID of the subject that the subscription is for.

Type Success
Accepts one of the following:
const SuccessSuccess Success = "success"
Change Subscription Rate Card
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := lark.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Subscriptions.ChangeRateCard(
    context.TODO(),
    "subscription_id",
    lark.SubscriptionChangeRateCardParams{
      CheckoutCallbackURLs: lark.CheckoutCallbackParam{
        CancelledURL: "https://example.com/try-again",
        SuccessURL: "https://example.com/completed",
      },
      RateCardID: "rc_jQK2n0wutCj6bBcAIrL6o07g",
      UpgradeBehavior: lark.SubscriptionChangeRateCardParamsUpgradeBehaviorProrate,
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Result)
}
{
  "result": {
    "subscription": {
      "id": "rc_sub_PuLvkNSP3IBCvjayBD3TXNQ6",
      "cancels_at_end_of_cycle": false,
      "current_period": {
        "end": "2025-11-01T00:00:00Z",
        "start": "2025-10-01T00:00:00Z",
        "inclusive_end": false,
        "inclusive_start": true
      },
      "cycles_next_at": "2025-11-01T00:00:00Z",
      "effective_at": "2025-10-01T00:00:00Z",
      "metadata": {},
      "rate_card_id": "rc_AJWMxR81jxoRlli6p13uf3JB",
      "status": "active",
      "subject_id": "subj_VyX6Q96h5avMho8O7QWlKeXE"
    },
    "type": "success"
  }
}
Returns Examples
{
  "result": {
    "subscription": {
      "id": "rc_sub_PuLvkNSP3IBCvjayBD3TXNQ6",
      "cancels_at_end_of_cycle": false,
      "current_period": {
        "end": "2025-11-01T00:00:00Z",
        "start": "2025-10-01T00:00:00Z",
        "inclusive_end": false,
        "inclusive_start": true
      },
      "cycles_next_at": "2025-11-01T00:00:00Z",
      "effective_at": "2025-10-01T00:00:00Z",
      "metadata": {},
      "rate_card_id": "rc_AJWMxR81jxoRlli6p13uf3JB",
      "status": "active",
      "subject_id": "subj_VyX6Q96h5avMho8O7QWlKeXE"
    },
    "type": "success"
  }
}