Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'
const client = createAdminClient({
baseUrl: 'https://your-store.com',
secretKey: 'sk_xxx',
})
const { data: calculators } = await client.deliveryMethods.calculators()spree api get /delivery_methods/calculators{
"data": [
{
"type": "flat_percent_item_total",
"name": "Flat Percent",
"schema": {
"type": "object",
"properties": {
"flat_percent": {
"type": "string",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
}
},
"additionalProperties": false
}
},
{
"type": "flat_rate",
"name": "Flat rate",
"schema": {
"type": "object",
"properties": {
"amounts": {
"type": "object",
"propertyNames": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
},
"additionalProperties": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
},
"default": {}
},
"amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
},
{
"type": "flexi_rate",
"name": "Flexible Rate per package item",
"schema": {
"type": "object",
"properties": {
"first_item": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"additional_item": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"max_items": {
"type": "integer",
"default": 0
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
},
{
"type": "per_item",
"name": "Flat rate per package item",
"schema": {
"type": "object",
"properties": {
"amounts": {
"type": "object",
"propertyNames": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
},
"additionalProperties": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
},
"default": {}
},
"amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
},
{
"type": "price_sack",
"name": "Price sack",
"schema": {
"type": "object",
"properties": {
"minimal_amount": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"normal_amount": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"discount_amount": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
},
{
"type": "digital_delivery",
"name": "Digital Delivery",
"schema": {
"type": "object",
"properties": {
"amounts": {
"type": "object",
"propertyNames": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
},
"additionalProperties": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
},
"default": {}
},
"amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
}
]
}List delivery calculators
Registered delivery calculator classes with preference schemas for building configuration forms.
Required scope: write_settings (for API-key authentication).
GET
/
api
/
v3
/
admin
/
delivery_methods
/
calculators
Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'
const client = createAdminClient({
baseUrl: 'https://your-store.com',
secretKey: 'sk_xxx',
})
const { data: calculators } = await client.deliveryMethods.calculators()spree api get /delivery_methods/calculators{
"data": [
{
"type": "flat_percent_item_total",
"name": "Flat Percent",
"schema": {
"type": "object",
"properties": {
"flat_percent": {
"type": "string",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
}
},
"additionalProperties": false
}
},
{
"type": "flat_rate",
"name": "Flat rate",
"schema": {
"type": "object",
"properties": {
"amounts": {
"type": "object",
"propertyNames": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
},
"additionalProperties": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
},
"default": {}
},
"amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
},
{
"type": "flexi_rate",
"name": "Flexible Rate per package item",
"schema": {
"type": "object",
"properties": {
"first_item": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"additional_item": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"max_items": {
"type": "integer",
"default": 0
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
},
{
"type": "per_item",
"name": "Flat rate per package item",
"schema": {
"type": "object",
"properties": {
"amounts": {
"type": "object",
"propertyNames": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
},
"additionalProperties": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
},
"default": {}
},
"amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
},
{
"type": "price_sack",
"name": "Price sack",
"schema": {
"type": "object",
"properties": {
"minimal_amount": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"normal_amount": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"discount_amount": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
},
{
"type": "digital_delivery",
"name": "Digital Delivery",
"schema": {
"type": "object",
"properties": {
"amounts": {
"type": "object",
"propertyNames": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
},
"additionalProperties": {
"type": "string",
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
},
"default": {}
},
"amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$",
"default": "0"
},
"currency": {
"type": "string",
"format": "currency",
"pattern": "^[A-Z]{3}$"
}
},
"additionalProperties": false
}
}
]
}Was this page helpful?
⌘I

