Service Costs
General
Implement a custom fee service
The service costs feature enables you to implement complex variations for determining shipping fees. Basic service costs for shipping are already configurable via the SCAYLE Panel. Using this checkout extension allows you to use your very own logic to determine service costs and build a highly customized user experience around it.
Once you have configured the API Credentials for this service, checkout will execute calls to the given endpoint. The results of your calculation will be used and stored with the order.
How to implement
You need to provide a http service that can handle the usual load of your shop and which accepts requests from the SCAYLE networks.
If you want to limit incoming traffic by IP address, your SCAYLE Account Manager can provide more information about our networks.
This service needs to implement a POST endpoint according to the following schema:
Request
Your endpoint needs to be able to serve the following request.
Authentication
Basic auth according to SCAYLE Panel configuration.
Headers
| Parameter | Details |
|---|---|
| X-Shop-Id | Integer The current shop-country id |
Body
Request example
Request schema
idinteger
addressobject (optional)billingobject (optional)idintegeradditionalstring ([!-ɏ0-9 ]) (optional)citystring ([!-ɏ0-9 ])countryCodestring (optional) (minimum length: ) (maximum length: 3)houseNumberstring ([!-ɏ0-9 ])recipientobjectreferenceKeystring (optional)statestring (optional) (maximum length: 60)streetstring ([!-ɏ0-9 ])titlestring ([!-ɏ0-9 ]) (optional)zipCodestring ([A-z0-9\- ]{1,12})
shippingobject (optional)idintegeradditionalstring ([!-ɏ0-9 ]) (optional)citystring ([!-ɏ0-9 ])collectionPointobject (optional)countryCodestring (optional) (minimum length: ) (maximum length: 3)houseNumberstring ([!-ɏ0-9 ])recipientobjectreferenceKeystring (optional)statestring (optional) (maximum length: 60)streetstring ([!-ɏ0-9 ])titlestring ([!-ɏ0-9 ]) (optional)zipCodestring ([A-z0-9\- ]{1,12})
costobjectappliedReductionsarray (optional)amountobjectcategoryenum (voucher)codestring (optional)typeenum (relativeabsolute)
withoutTaxintegerwithTaxinteger
customDataobject (optional)
customerobjectidintegercustomDataobject (optional) (object is extensible as desired)firstNamestring (optional)genderenum (mfd) (optional)lastNamestring (optional)referenceKeystring (optional)
ipAddressstring (optional)
itemsarrayidinteger (optional)availableQuantityinteger (optional)currencystring (optional) (minimum length: ) (maximum length: 3)customDataobject (optional) (object is extensible as desired)deliveryForecastobject (optional)deliverableobjectsubsequentDeliveryobject
keystringmerchantobject (optional)idinteger
priceobjectappliedReductionsarray (optional)taxobjectwithoutTaxintegerwithTaxinteger
productobjectidintegerattributesobject (object is extensible as desired)
variantobjectidintegerreferenceKeystringstockobject (optional)
paymentarrayamountintegerkeystringoptionsobject (optional)countOfInstallmentsinteger (optional)hasPaybreakboolean (optional)
shippingobjectdeliveredOnstring ([0-9]{4}\-[0-9]{2}\-[0-9]{2}) (optional)policyenum (least_packagesearliest_shippingdelivery_deadlinenext_business_day_express) (optional)
Response
Your service needs to follow this specification when handling the checkout request.
Response body
Response example
Response schema
shippingobjectdeliveryCostsintegerexpressDeliveryCostsinteger (optional)
The response body will be written to the order.customData.fees property. In case the request failed, checkout will store "requestFailed": true.
Status Codes:
| Code | Description | Response Body |
|---|---|---|
201 | request was successful | |
401 | authentication failed | empty |