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_PAYMENTorREAD_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
| Field | Type | Description |
|---|---|---|
data.rules | Array | Checkout payment rules. See Payment Rule Data below. |
data.invoiceRules | Array | Invoice payment rules. See Payment Rule Data below. |
Payment Rule Data
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the rule. |
name | String | Name of the rule. |
active | Boolean | Whether the rule is applied. Default is true. |
conditions | Object | When the rule applies. See below. |
action | Object | What 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.
| Field | Type | Description |
|---|---|---|
audiences | Array | Buyer types: guest, b2c and/or b2b. |
customers | Array | Customer IDs. |
companies | Array | Company IDs. |
companyGroups | Array | Company group IDs. |
orderTotal.min | Number | Minimum order total. |
orderTotal.max | Number | Maximum order total. |
orderTotal.byCurrency | Object | Minimum and maximum per currency, for example { "EUR": { "min": 900 } }. Used when the shopper pays in that currency. |
cart.mode | String | contains or notContains. Default is contains. |
cart.products | Array | Product IDs. |
cart.categories | Array | Category IDs. |
cart.productGroups | Array | Product group IDs. |
cart.target | Object | Product selection made in the admin panel. When set, it is used instead of the three lists above. |
shippingMethods | Array | Shipping method IDs. |
currencies | Array | Three-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
| Field | Type | Description |
|---|---|---|
type | String | hide, surcharge or rename. |
targets | Array | Payment methods the action applies to. Each item has method (payment method ID) and types (payment types; empty means the whole method). |
surcharge.percent | Number | Fee as a percentage of the order total. Used with surcharge. |
surcharge.fixed | Number | Fixed fee in the store currency. Used with surcharge. |
surcharge.fixedByCurrency | Object | Fixed fee per currency, for example { "EUR": 2 }. |
surcharge.label | String | Name of the fee shown at checkout. Default is Payment fee. |
label | String | New 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.
hiderules add up: each matching rule hides its targets.- If more than one
surchargeorrenamerule matches the same payment method, the first one is used.