Save the business surcharge rule
PUT
/order-surcharge
const url = 'https://example.com/order-surcharge';const options = { method: 'PUT', headers: { cookie: '__Host-bottle.session_token=<__Host-bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"enabled":true,"name":"example","amountPence":1,"priceIncludesVat":true,"appliesTo":"all_orders","chargeBy":"per_order","customerRule":"everyone","gasTypeIds":[],"productIds":[]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/order-surcharge \ --header 'Content-Type: application/json' \ --cookie __Host-bottle.session_token=<__Host-bottle.session_token> \ --data '{ "enabled": true, "name": "example", "amountPence": 1, "priceIncludesVat": true, "appliesTo": "all_orders", "chargeBy": "per_order", "customerRule": "everyone", "gasTypeIds": [], "productIds": [] }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
enabled
required
boolean
name
required
string
amountPence
required
integer
priceIncludesVat
required
boolean
appliesTo
string
chargeBy
string
customerRule
string
gasTypeIds
Array<string>
productIds
Array<string>
Responses
Section titled “Responses”Order surcharge settings
Media typeapplication/json
object
enabled
required
boolean
name
required
string
amountPence
required
integer
priceIncludesVat
required
boolean
appliesTo
string
chargeBy
string
customerRule
string
gasTypeIds
Array<string>
productIds
Array<string>
updatedAt
required
string format: date-time
Example
{ "appliesTo": "all_orders", "chargeBy": "per_order", "customerRule": "everyone", "gasTypeIds": [], "productIds": []}Not signed in
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Not permitted
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Invalid surcharge settings
Media typeapplication/json
object
error
required
string
message
required
string
issues
required
Array<object>
object
path
required
string
message
required
string
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}