Check and validation
How to use the public endpoint to check and validate a rule against a specific payload
https://{{your_domain}}.commercelayer.io/api/rules/checkKey
Type
Description
Array
Array
Example
Check and outcomes
curl -g -X POST \
'https://{{your_domain}}.commercelayer.io/api/rules/check' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token' \
-H 'Content-Type: application/vnd.api+json' \
-d '{
"payload": [
{
"order": {
"id": "oKkhYLlzgE",
"payment_method": {
"id": "gnYtPpKLeG",
"payment_source_type": "credit_cards"
}
}
},
{
"order": {
"id": "DgkhGJlzgf",
"payment_method": {
"id": "snXtWdKLdC",
"payment_source_type": "wire_transfers"
}
}
}
],
"rules": [
{
"name": "Discount 3% if paid by credit card",
"conditions": [
{
"field": "order.payment_method.payment_source_type",
"matcher": "eq",
"value": "credit_cards",
"group": "discountable-orders"
}
],
"actions": [
{
"type": "percentage",
"selector": "order",
"value": 0.03,
"groups": [ "discountable-orders" ]
}
]
}
]
}'Validation and errors
Last updated