Pricing
get_customiser_pricing
readGet customiser pricing
Read the pricing rules a customiser applies, in the exact document shape a pricing replacement takes back.
Overview
Reads one customiser pricing document: its pricing model, the Store currency, and the rates, modifiers, minimums and rounding rules that turn a shopper design into a price. This is the read to make before changing pricing and the reference for interpreting an order total. Amounts are integer minor units and dimensions are centimetres. It requires the pricing:read scope, has no side effects and is safe to retry.
Permission
Requires thepricing:readpermission. A connection without it answersinsufficient_scopenaming the permission to approve.
Annotations
Prerequisites
- A customiser id from list_customisers.
- A merchant has connected this store and approved the pricing:read scope.
Arguments
The customiser id, from list_customisers.
Result
One pricing document. Its fields are those of the customiser own pricing model, so a frame_fit document and a simple_letter document do not carry the same members.
The pricing model the document is written against.
One of: simple_letter, advanced_letter, frame_fit
The ISO 4217 currency every amount in the document is expressed in, as integer minor units.
The canonical pricing document, in the shape update_customiser_pricing takes back with mode replace.
Error cases
The connection was approved without pricing:read. A connection holding only customisers:read can read the customiser but not its rates.
No customiser with that id belongs to this store. Call list_customisers to rediscover a valid id.
Read a simple_letter pricing document
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_customiser_pricing",
"arguments": {
"customiser_id": 42
}
}
}{
"jsonrpc": "2.0",
"id": 1,
"result": {
"structuredContent": {
"request_id": "req_01jz9x2k7c8f3m5n6p7q8r9s0t",
"store": {
"id": 12,
"name": "Demo Signs"
},
"customiser_id": 42,
"pricing_model": "simple_letter",
"currency": "USD",
"document": {
"customiser_id": 42,
"pricing_model": "simple_letter",
"pricing_model_display_name": "Simple Letter",
"currency": "USD",
"sizes": [
{
"size_id": 7,
"name": "Small",
"sort_order": 1,
"width_cm": 50,
"sizing_strategy": "fixed_width"
}
]
}
}
}
}A connection that reads customisers but not pricing (error)
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_customiser_pricing",
"arguments": {
"customiser_id": 42
}
}
}{
"jsonrpc": "2.0",
"id": 1,
"result": {
"isError": true,
"structuredContent": {
"error": {
"code": "insufficient_scope",
"title": "Insufficient scope",
"detail": "The tool [get_customiser_pricing] requires the pricing:read scope, which this connection was not granted.",
"recovery": "The connection was authorised without the scope this tool needs. Ask the merchant to reconnect the connector and approve the scope named in required_scopes. Do not retry this call.",
"required_scopes": [
"pricing:read"
],
"granted_scopes": [
"customisers:read"
]
}
}
}
}