Shipping rates

A shipping rate is a fixed shipping cost with an optional delivery estimate, offered to customers in a checkout session or charged every period on a subscription.

The ShippingRate object

Name
object
Type
"shipping_rate",
Description
The object's type.
Name
id
Type
string,
Description
Unique identifier for the object.
Name
live
Type
boolean,
Description
true if the object is live, or false if it's in a sandbox.
Name
created_at
Type
integer,
Description
When the object was created, in milliseconds since the Unix epoch.
Name
active
Type
boolean,
Description
Whether the shipping rate can be set on a subscription.
Name
amount
Type
integer, at least 0,
Description
The shipping cost, in cents.
Name
deleted
Type
boolean,
Description
Whether the shipping rate has been deleted.
Name
delivery_estimate
Type
object or null,
Description
How long delivery is estimated to take.
Properties
Name
display_name
Type
string,
Description
The shipping rate's name, shown to customers.
Name
metadata
Type
object,
Description
Your own key-value data on the object.
Name
updated_at
Type
integer,
Description
When the object was last updated, in milliseconds since the Unix epoch.

The ShippingRate object

{
  "object": "shipping_rate",
  "id": "shr_z6TEWSU3AgYq95B7KHhEg5",
  "live": false,
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "deleted": false,
  "active": true,
  "display_name": "Standard shipping",
  "amount": 500,
  "delivery_estimate": {
    "maximum": {
      "unit": "business_day",
      "value": 5
    },
    "minimum": {
      "unit": "business_day",
      "value": 3
    }
  },
  "metadata": {}
}

Create a shipping rate

Create a new shipping rate.

Required parameters

Name
display_name
Type
string,
Description
The shipping rate's name, shown to customers.
Name
amount
Type
integer, at least 0,
Description
The shipping cost, in cents.

Optional parameters

Name
expand
Type
empty object,
Name
delivery_estimate
Type
object or null,
Description
How long delivery is estimated to take.
Properties
Name
metadata
Type
object or null,
Description
Your own key-value data on the object.

Returns

Returns the shipping rate object.

Create a shipping rate

const shippingRate = await bias.shippingRates.create({
  display_name: "Standard shipping",
  amount: 500,
  delivery_estimate: {
    maximum: {
      unit: "business_day",
      value: 5
    },
    minimum: {
      unit: "business_day",
      value: 3
    }
  },
  metadata: {}
});

Response example

{
  "object": "shipping_rate",
  "id": "shr_z6TEWSU3AgYq95B7KHhEg5",
  "live": false,
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "deleted": false,
  "active": true,
  "display_name": "Standard shipping",
  "amount": 500,
  "delivery_estimate": {
    "maximum": {
      "unit": "business_day",
      "value": 5
    },
    "minimum": {
      "unit": "business_day",
      "value": 3
    }
  },
  "metadata": {}
}

Get a shipping rate

Retrieve a shipping rate by its ID.

Required parameters

Name
id
Type
string,
Description
The ID of the shipping rate to retrieve.

Optional parameters

Name
expand
Type
empty object,
Description
Related objects to expand in the response.

Returns

Returns the shipping rate object.

Retrieve a shipping rate

const shippingRate = await bias.shippingRates.get("id");

Response example

{
  "object": "shipping_rate",
  "id": "shr_z6TEWSU3AgYq95B7KHhEg5",
  "live": false,
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "deleted": false,
  "active": true,
  "display_name": "Standard shipping",
  "amount": 500,
  "delivery_estimate": {
    "maximum": {
      "unit": "business_day",
      "value": 5
    },
    "minimum": {
      "unit": "business_day",
      "value": 3
    }
  },
  "metadata": {}
}

Update a shipping rate

A shipping rate’s amount can’t change. To charge a different amount, create a new rate.

Required parameters

Name
id
Type
string,

Optional parameters

Name
expand
Type
empty object,
Name
active
Type
boolean,
Description
Whether the shipping rate can be set on a subscription.
Name
display_name
Type
string,
Description
The shipping rate's name, shown to customers.
Name
delivery_estimate
Type
object or null,
Description
How long delivery is estimated to take.
Properties
Name
metadata
Type
object or null,
Description
Your own key-value data on the object.

Returns

Returns the updated shipping rate object.

Update a shipping rate

const shippingRate = await bias.shippingRates.update("id", {
  active: false,
  display_name: "Standard shipping"
});

Response example

{
  "object": "shipping_rate",
  "id": "shr_z6TEWSU3AgYq95B7KHhEg5",
  "live": false,
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "deleted": false,
  "active": true,
  "display_name": "Standard shipping",
  "amount": 500,
  "delivery_estimate": {
    "maximum": {
      "unit": "business_day",
      "value": 5
    },
    "minimum": {
      "unit": "business_day",
      "value": 3
    }
  },
  "metadata": {}
}

List all shipping rates

Retrieve a paginated list of shipping rates, most recently created first.

Optional parameters

Name
expand
Type
empty object,
Description
Related objects to expand in the response.
Name
ending_before
Type
string,
Description
The ID of the object to list before, for pagination.
Name
starting_after
Type
string,
Description
The ID of the object to list after, for pagination.
Name
limit
Type
integer, at least 1, at most 1000, default is 50
Description
The maximum number of objects to return, from 1 to 1000. Defaults to 50.
Name
filters
Type
object, object, or object,
Description
Filters for the list, combined with and and or.
Properties

Returns

Returns a list of shipping rate objects.

List all shipping rates

const shippingRate = await bias.shippingRates.list();

Response example

{
  "object": "list",
  "items": [
    {
      "object": "shipping_rate",
      "id": "shr_z6TEWSU3AgYq95B7KHhEg5",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "deleted": false,
      "active": true,
      "display_name": "Standard shipping",
      "amount": 500,
      "delivery_estimate": {
        "maximum": {
          "unit": "business_day",
          "value": 5
        },
        "minimum": {
          "unit": "business_day",
          "value": 3
        }
      },
      "metadata": {}
    }
  ],
  "has_more": true
}