Spree Seller SDK
import { createSellerClient } from '@spree/seller-sdk'
const client = createSellerClient({
baseUrl: 'https://your-store.com',
jwtToken: 'eyJhbGciOi...',
sellerId: 'sel_UkLWZg9DAJ',
})
const { data: calculators } = await client.deliveryMethods.calculators()curl --request GET \
--url http://{defaultHost}/api/v3/seller/delivery_methods/calculators \
--header 'Authorization: Bearer <token>' \
--header 'X-Spree-Seller-Id: <x-spree-seller-id>'{
"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 the ways a method can be priced
GET
/
api
/
v3
/
seller
/
delivery_methods
/
calculators
Spree Seller SDK
import { createSellerClient } from '@spree/seller-sdk'
const client = createSellerClient({
baseUrl: 'https://your-store.com',
jwtToken: 'eyJhbGciOi...',
sellerId: 'sel_UkLWZg9DAJ',
})
const { data: calculators } = await client.deliveryMethods.calculators()curl --request GET \
--url http://{defaultHost}/api/v3/seller/delivery_methods/calculators \
--header 'Authorization: Bearer <token>' \
--header 'X-Spree-Seller-Id: <x-spree-seller-id>'{
"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

