Create Rate Card
Parameters
Returns
Create 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"),
)
rateCardResource, err := client.RateCards.New(context.TODO(), lark.RateCardNewParams{
BillingInterval: lark.RateCardNewParamsBillingIntervalMonthly,
Name: "Pro Plan",
Description: lark.String("For production applicatidddons with moderate usage."),
FixedRates: []lark.RateCardNewParamsFixedRate{lark.RateCardNewParamsFixedRate{
Name: "Base Rate",
Price: lark.RateCardNewParamsFixedRatePriceUnion{
OfFlat: &lark.FlatPriceInputParam{
PriceType: lark.FlatPriceInputPriceTypeFlat,
Amount: lark.AmountInputParam{
Value: lark.AmountInputValueUnionParam{
OfFloat: lark.Float(2500),
},
CurrencyCode: "usd",
},
},
},
}},
Metadata: map[string]string{
},
UsageBasedRates: []lark.RateCardNewParamsUsageBasedRateUnion{lark.RateCardNewParamsUsageBasedRateUnion{
OfSimple: &lark.RateCardNewParamsUsageBasedRateSimple{
Name: "Compute Hours",
Price: lark.RateCardNewParamsUsageBasedRateSimplePriceUnion{
OfFlat: &lark.FlatPriceInputParam{
PriceType: lark.FlatPriceInputPriceTypeFlat,
Amount: lark.AmountInputParam{
Value: lark.AmountInputValueUnionParam{
OfFloat: lark.Float(100),
},
CurrencyCode: "usd",
},
},
},
IncludedUnits: lark.Int(30),
PricingMetricID: "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
},
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", rateCardResource.ID)
}
{
"id": "rc_jQK2n0wutCj6bBcAIrL6o07g",
"billing_interval": "monthly",
"created_at": "2025-11-01T00:00:00Z",
"fixed_rates": [
{
"id": "fr_04EjnYJoQLC7gtLKI6mPzZny",
"description": "description",
"name": "Base Rate",
"price": {
"amount": {
"currency_code": "usd",
"value": "2500"
},
"price_type": "flat"
}
}
],
"metadata": {},
"name": "Pro Plan",
"updated_at": "2025-11-01T00:00:00Z",
"usage_based_rates": [
{
"id": "ubr_zoXOJrDXlGGJWRNq3HqFYhbP",
"description": "description",
"included_units": 30,
"name": "Compute Hours",
"price": {
"amount": {
"currency_code": "usd",
"value": "100"
},
"price_type": "flat"
},
"pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
"usage_based_rate_type": "simple"
}
],
"description": "For production applications with moderate usage."
}Returns Examples
{
"id": "rc_jQK2n0wutCj6bBcAIrL6o07g",
"billing_interval": "monthly",
"created_at": "2025-11-01T00:00:00Z",
"fixed_rates": [
{
"id": "fr_04EjnYJoQLC7gtLKI6mPzZny",
"description": "description",
"name": "Base Rate",
"price": {
"amount": {
"currency_code": "usd",
"value": "2500"
},
"price_type": "flat"
}
}
],
"metadata": {},
"name": "Pro Plan",
"updated_at": "2025-11-01T00:00:00Z",
"usage_based_rates": [
{
"id": "ubr_zoXOJrDXlGGJWRNq3HqFYhbP",
"description": "description",
"included_units": 30,
"name": "Compute Hours",
"price": {
"amount": {
"currency_code": "usd",
"value": "100"
},
"price_type": "flat"
},
"pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
"usage_based_rate_type": "simple"
}
],
"description": "For production applications with moderate usage."
}