Skip to main content

Get Payment Rules

Retrieves the store's payment rules in the order they are applied. Payment rules can hide a payment method, add a fee to it or change its name, based on the buyer, order total, cart contents, shipping method or currency. The store has two lists: rules apply at checkout, and invoiceRules apply when a buyer pays an invoice.

HTTP Request​

  • URL: /paymentRules
  • Method: GET
  • Headers:
    • accessToken: Required. Your API access token.
  • Required scope: READ_PAYMENT or READ_WRITE_PAYMENT

cURL Example​

curl --location '<BASE_URL>/paymentRules' \
--header 'accessToken: <ACCESS_TOKEN>'

Response​

  • 200 OK: The payment rules were returned successfully.
  • 401 Unauthorized: The access token is missing or invalid.
  • 403 Forbidden: The access token does not have the required scope.
  • 400 Bad Request: The request could not be completed.

Sample JSON Response​

{
"success": true,
"data": {
"rules": [
{
"id": "6712b0c4e5a1f2d3c4b5a697",
"name": "Card fee for B2C",
"active": true,
"conditions": {
"audiences": [
"b2c"
],
"companies": [],
"companyGroups": [],
"customers": [],
"orderTotal": {
"min": null,
"max": null,
"byCurrency": {}
},
"cart": {
"mode": "contains",
"target": null,
"products": [],
"categories": [],
"productGroups": []
},
"shippingMethods": [],
"currencies": []
},
"action": {
"type": "surcharge",
"targets": [
{
"method": "67644189a909f37370551d41",
"types": [
"card"
]
}
],
"surcharge": {
"percent": 3,
"fixed": 0,
"fixedByCurrency": {},
"label": "Card processing fee"
}
}
},
{
"id": "6712b0c4e5a1f2d3c4b5a698",
"name": "No cash on delivery over 1000",
"active": true,
"conditions": {
"audiences": [],
"companies": [],
"companyGroups": [],
"customers": [],
"orderTotal": {
"min": 1000,
"max": null,
"byCurrency": {}
},
"cart": {
"mode": "contains",
"target": null,
"products": [],
"categories": [],
"productGroups": []
},
"shippingMethods": [],
"currencies": []
},
"action": {
"type": "hide",
"targets": [
{
"method": "67644189a909f37370551d43",
"types": []
}
]
}
}
],
"invoiceRules": []
}
}

Response Details​

FieldTypeDescription
data.rulesArrayCheckout payment rules. See Payment Rule Data below.
data.invoiceRulesArrayInvoice payment rules. See Payment Rule Data below.

Payment Rule Data​

FieldTypeDescription
idStringUnique identifier of the rule.
nameStringName of the rule.
activeBooleanWhether the rule is applied. Default is true.
conditionsObjectWhen the rule applies. See below.
actionObjectWhat the rule does. See below.

Conditions Object​

A rule applies only when all the conditions you set are met. Leave a condition empty to skip it.

FieldTypeDescription
audiencesArrayBuyer types: guest, b2c and/or b2b.
customersArrayCustomer IDs.
companiesArrayCompany IDs.
companyGroupsArrayCompany group IDs.
orderTotal.minNumberMinimum order total.
orderTotal.maxNumberMaximum order total.
orderTotal.byCurrencyObjectMinimum and maximum per currency, for example { "EUR": { "min": 900 } }. Used when the shopper pays in that currency.
cart.modeStringcontains or notContains. Default is contains.
cart.productsArrayProduct IDs.
cart.categoriesArrayCategory IDs.
cart.productGroupsArrayProduct group IDs.
cart.targetObjectProduct selection made in the admin panel. When set, it is used instead of the three lists above.
shippingMethodsArrayShipping method IDs.
currenciesArrayThree-letter currency codes, for example USD.

The buyer matches customers, companies and companyGroups if it is any of the listed customers, companies or company groups. With cart.mode set to contains, the rule applies when at least one cart item is a listed product or belongs to a listed category or product group. With notContains, it applies when none do.

Action Object​

FieldTypeDescription
typeStringhide, surcharge or rename.
targetsArrayPayment methods the action applies to. Each item has method (payment method ID) and types (payment types; empty means the whole method).
surcharge.percentNumberFee as a percentage of the order total. Used with surcharge.
surcharge.fixedNumberFixed fee in the store currency. Used with surcharge.
surcharge.fixedByCurrencyObjectFixed fee per currency, for example { "EUR": 2 }.
surcharge.labelStringName of the fee shown at checkout. Default is Payment fee.
labelStringNew name for the payment method. Used with rename.

Notes​

  • Active rules are applied in list order.
  • Invoice payment rules do not use cart or shipping method conditions, and their fees apply to the whole payment method.
  • hide rules add up: each matching rule hides its targets.
  • If more than one surcharge or rename rule matches the same payment method, the first one is used.