API reference
Shipping Rates
Shipping rates describe the price of shipping presented to your customers and applied to a purchase. For more information, see Charge for shipping.
https://api.knoxapi.comCreate a shipping rate
POST/v1/shipping_rates
Creates a new shipping rate object.
Body parameters
display_namestringRequiredThe name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
delivery_estimateobjectThe estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
Show 2 child parameters
maximumobjectShow 2 child parameters
unitstringRequiredPossible valuesbusiness_daydayhourmonthweek
valueintegerRequired
minimumobjectShow 2 child parameters
unitstringRequiredPossible valuesbusiness_daydayhourmonthweek
valueintegerRequired
expandarray of stringsSpecifies which fields in the response should be expanded.
fixed_amountobjectDescribes a fixed amount to charge for shipping. Must be present if type is
fixed_amount.Show 3 child parameters
amountintegerRequiredcurrencystringRequiredcurrency_optionsobject
metadataobjectSet of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata.tax_behaviorstringSpecifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of
inclusive,exclusive, orunspecified.Possible valuesexclusiveinclusiveunspecified
tax_codestringA tax code ID. The Shipping tax code is
txcd_92010001.typestringThe type of calculation to use on the shipping rate.
Possible valuesfixed_amount
Returns
The shipping_rate object.
curl https://api.knoxapi.com/v1/shipping_rates \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
-d "display_name=Ground shipping"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const shippingRate = await stripe.shippingRates.create({
display_name: 'Ground shipping',
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
shipping_rate = client.v1.shipping_rates.create(params={
"display_name": "Ground shipping",
})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
shipping_rate = Stripe::ShippingRate.create({
display_name: 'Ground shipping',
}){
"active": true,
"created": 1234567890,
"delivery_estimate": {
"maximum": {
"unit": "month",
"value": 111972721
},
"minimum": {
"unit": "month",
"value": 111972721
}
},
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"id": "shr_1Pgc7AB7WZ01zgkWVPt4WhMx",
"livemode": false,
"metadata": {},
"object": "shipping_rate",
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
}List all shipping rates
GET/v1/shipping_rates
Returns a list of your shipping rates.
Query parameters
activebooleanOnly return shipping rates that are active or inactive.
createdobject | integerA filter on the list, based on the object
createdfield. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.Show 4 child parameters
gtintegergteintegerltintegerlteinteger
currencystringOnly return shipping rates for the given currency.
ending_beforestringA cursor for use in pagination.
ending_beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar, your subsequent call can includeending_before=obj_barin order to fetch the previous page of the list.expandarray of stringsSpecifies which fields in the response should be expanded.
limitintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
starting_afterstringA cursor for use in pagination.
starting_afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo, your subsequent call can includestarting_after=obj_fooin order to fetch the next page of the list.
Returns
A list of shipping_rate objects.
curl -G https://api.knoxapi.com/v1/shipping_rates \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
--data-urlencode limit=3const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const page = await stripe.shippingRates.list({
limit: 3,
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
page = client.v1.shipping_rates.list(params={
"limit": 3,
})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
page = Stripe::ShippingRate.list({
limit: 3,
}){
"object": "list",
"url": "/v1/shipping_rates",
"has_more": false,
"data": [
{
"active": true,
"created": 1234567890,
"delivery_estimate": {
"maximum": {
"unit": "month",
"value": 111972721
},
"minimum": {
"unit": "month",
"value": 111972721
}
},
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"id": "shr_1Pgc7AB7WZ01zgkWVPt4WhMx",
"livemode": false,
"metadata": {},
"object": "shipping_rate",
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
}
]
}Update a shipping rate
POST/v1/shipping_rates/{shipping_rate_token}
Updates an existing shipping rate object.
Path parameters
shipping_rate_tokenstringRequired
Body parameters
activebooleanWhether the shipping rate can be used for new purchases. Defaults to
true.expandarray of stringsSpecifies which fields in the response should be expanded.
fixed_amountobjectDescribes a fixed amount to charge for shipping. Must be present if type is
fixed_amount.Show 1 child parameter
currency_optionsobject
metadataobjectSet of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata.tax_behaviorstringSpecifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of
inclusive,exclusive, orunspecified.Possible valuesexclusiveinclusiveunspecified
Returns
The shipping_rate object.
curl https://api.knoxapi.com/v1/shipping_rates/shipping_rate_token_123 \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
-d "metadata[order_id]=6735"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const shippingRate = await stripe.shippingRates.update('shipping_rate_token_123', {
metadata: {
order_id: '6735',
},
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
shipping_rate = client.v1.shipping_rates.update("shipping_rate_token_123", params={
"metadata": {
"order_id": "6735",
},
})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
shipping_rate = Stripe::ShippingRate.update('shipping_rate_token_123', {
metadata: {
order_id: '6735',
},
}){
"active": true,
"created": 1234567890,
"delivery_estimate": {
"maximum": {
"unit": "month",
"value": 111972721
},
"minimum": {
"unit": "month",
"value": 111972721
}
},
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"id": "shr_1Pgc7AB7WZ01zgkWVPt4WhMx",
"livemode": false,
"metadata": {},
"object": "shipping_rate",
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
}Retrieve a shipping rate
GET/v1/shipping_rates/{shipping_rate_token}
Returns the shipping rate object with the given ID.
Path parameters
shipping_rate_tokenstringRequired
Query parameters
expandarray of stringsSpecifies which fields in the response should be expanded.
Returns
The shipping_rate object.
curl https://api.knoxapi.com/v1/shipping_rates/shipping_rate_token_123 \
-H "Authorization: Bearer $KNOX_SECRET_KEY"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const shippingRate = await stripe.shippingRates.retrieve('shipping_rate_token_123');import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
shipping_rate = client.v1.shipping_rates.retrieve("shipping_rate_token_123")require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
shipping_rate = Stripe::ShippingRate.retrieve('shipping_rate_token_123'){
"active": true,
"created": 1234567890,
"delivery_estimate": {
"maximum": {
"unit": "month",
"value": 111972721
},
"minimum": {
"unit": "month",
"value": 111972721
}
},
"display_name": "Ground shipping",
"fixed_amount": {
"amount": 500,
"currency": "usd"
},
"id": "shr_1Pgc7AB7WZ01zgkWVPt4WhMx",
"livemode": false,
"metadata": {},
"object": "shipping_rate",
"tax_behavior": "unspecified",
"tax_code": null,
"type": "fixed_amount"
}Operations and schemas come from the pinned Stripe OpenAPI specification (MIT); response examples from its fixtures. Nested object definitions and enums are in the complete specification.