# Payment method rules

URL: https://docs.sparklayer.io/help/ordering/payment-method-rules
Applies to: Shopify

Add a discount or surcharge to a payment method, or hide it, when an order meets your conditions, such as its sub-total, items, credit or shipping destination.

> **Quick summary**
>
> - A payment method rule gives a payment method a discount or a surcharge, or hides it, when an order meets your conditions, for example a 2% surcharge on card payments under £500.
> - Add rules to each payment method in a customer group's **Payment methods** rule, at **Customers > Groups > Payment methods** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/customers/groups)), or **SparkLayer Wholesale > Customers > Customer groups > Payment methods** in the Shopify app.
> - Needs the Growth plan or above and Core Script 4.13.0 or later. For Shopify stores.
> - Rules don't apply to quotes.

## How it works

A rule belongs to one payment method in one customer group. It has 2 parts:

- **When:** the conditions the order must meet, such as an order sub-total of at least £500. A rule with no conditions applies to every order.
- **Then:** the outcome. **Apply a discount**, **Apply a surcharge** or **Hide this payment method**.

An order must meet every condition on a rule for it to apply. Every rule that applies is used, so a method can have a discount and a surcharge at the same time. There's no priority to set: SparkLayer always works them out in the same order.

How payment method rules are applied to an order:

1. **Hide rules**: A method with a matching hide rule isn't shown, and its other rules don't apply
2. **Discounts**: Your normal discounts, then payment rule discounts, off the net sub-total
3. **Surcharges**: Added to the net sub-total after every discount
4. **Shipping and tax**: Worked out with the surcharge included

> **Check surcharge laws where you sell**
>
> Laws on surcharges, and on charging different amounts for different payment methods, vary by country and region. Some places limit or ban surcharges on certain payment methods. Check the rules in every country you sell to before you add a surcharge. You're responsible for making sure your rules comply: SparkLayer doesn't check them against any law.

### A worked example

A customer pays by card for £1,000 (net) of products, with a 10% off coupon. **Card at checkout** has 2 rules:

- **Rule 1:** a 5% discount, with no conditions.
- **Rule 2:** a 2% surcharge, when the order sub-total is at least £500.

| Step | Amount | Order sub-total |
| --- | --- | --- |
| Products | £1,000.00 | £1,000.00 |
| 10% off coupon | -£100.00 | £900.00 |
| Rule 1: 5% of £900.00 | -£45.00 | £855.00 |
| Rule 2: 2% of £855.00 | +£17.10 | £872.10 |
| Shipping and tax | Worked out on £872.10 | |

Rule 2's minimum is checked against £900.00: the sub-total after the coupon, before the payment rule discount. See [Which sub-total conditions use](#which-sub-total-conditions-use).

## Add a rule

1. Go to **Customers > Groups** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/customers/groups)), or **SparkLayer Wholesale > Customers > Customer groups** in the Shopify app and click the group's name. To add rules for every group, click **Edit** on the base customer group.
2. If **Payment methods** is under **Inherited rules**, click **+ Override** next to it (on the base group, **+ Customize**).
3. Under a ticked payment method, click **Add rule**.
4. Under **When**, tick the conditions the order must meet and fill them in. To apply the rule to every order, leave them all unticked.
5. Under **Then**, choose **Apply a discount**, **Apply a surcharge** or **Hide this payment method**.
6. For a discount or surcharge, choose **Percentage** or **Fixed amount**, and enter the amount.
7. Click **Update customer group**.

**More detail**

- Groups that inherit the **Payment methods** rule inherit its payment method rules too.
- Unticking a payment method deletes its rules when you save.
- **Reset** on the **Payment methods** rule deletes the group's rules, and the group goes back to the inherited methods and rules.

## Conditions

| Condition | The rule applies when | Notes |
| --- | --- | --- |
| **Order sub-total** | The order's net sub-total is between the **Minimum** and **Maximum** | Excludes shipping and tax. See [Which sub-total conditions use](#which-sub-total-conditions-use) |
| **Order items** | The number of items is between the **Minimum** and **Maximum** | Count the **Quantity across all line items** or the **Number of line items**. Free products from discounts and custom line items count |
| **Available credit** | The customer's remaining credit is between the **Minimum** and **Maximum** | How much [credit](https://docs.sparklayer.io/help/ordering/credit-net-terms-and-invoicing.md) they have left on their account when they reach checkout. A customer with no credit limit meets any minimum and never meets a maximum |
| **Products** | The order contains a product that matches any of your filters | Filter on **SKU**, **Shopify Vendor** or **Shopify Tags**. Values must be spelled as in your store, but capitals don't matter |
| **Pre-order items** | The cart contains a pre-order item, or contains none | A pre-order item is one the customer can order without stock. This doesn't check that the other items are in stock |
| **Shipping destination** | The shipping address is in one of the **Countries** you choose | Narrow a country to some regions, or leave its regions empty for the whole country. The billing address isn't checked |

The minimum is included and the maximum isn't: with a **Maximum** of £100, the rule applies to orders up to £99.99. Amounts exclude tax.

### Which sub-total conditions use

**Order sub-total** is checked against the net sub-total after your normal [discounts](https://docs.sparklayer.io/help/pricing/discounts.md) and before any payment rule discount. This is the same for every rule, whatever its outcome.

For example, a group has a 10% payment rule discount and a surcharge for orders of at least £950. On a £1,000 order, the surcharge still applies, because £1,000 meets the minimum. It's then worked out on £900, the sub-total after the discount.

## Outcomes

| Outcome | What happens |
| --- | --- |
| **Apply a discount** | Taken off the net sub-total, after all your other discounts. A **Percentage** or a **Fixed amount** |
| **Apply a surcharge** | Added to the net sub-total after every discount, before shipping and tax. A **Percentage** or a **Fixed amount**. It's taxed at your store's default tax rate, so it adds to the order's tax as well as its total |
| **Hide this payment method** | The method isn't shown while the conditions match. Keep at least one method that no hide rule matches. To hide a method from every order, untick it instead |

Fixed amounts and money conditions are in the group's currency, and aren't converted: 5 means £5 in a GBP cart and €5 in a EUR cart.

### When several rules apply

- **Hide wins.** If a hide rule matches, the method is hidden and its discount and surcharge rules don't apply.
- **Discounts all come off the same amount.** A 10% and a 20% payment rule discount on a £900 sub-total take £90 and £180 off, £270 in all, in any order.
- **Surcharges add up**, and each percentage is worked out on the same amount. A 2% and a 3% surcharge on £855 add £42.75. A fixed surcharge is added as it is.
- **Surcharges count towards shipping.** Shipping is worked out after the surcharge, so a surcharge can move an order into a different shipping rate based on order total, such as free shipping over £1,000.
- **Payment rule discounts aren't limited by compatibility.** They apply alongside any other discount, whatever its **Can be used with** setting.

## What customers see at checkout

On **Review & Pay** in [My Cart](https://docs.sparklayer.io/help/storefront/interfaces/my-cart.md):

- Each payment method shows its discounts and surcharges, such as `-5%` or `+£5.00`, so customers can compare before they choose.
- The totals list each payment rule discount, such as "Card payment discount (5%)", and a **Surcharge** line, excluding tax.
- A hidden method isn't shown. If it was selected, the first method still shown in **Payment methods, in order** is selected instead.

Rules apply from **Review & Pay**, not earlier in the cart. To explain a surcharge or discount to your customers, add a [message for the payment method](https://docs.sparklayer.io/help/ordering/cart-and-checkout.md#add-a-message-for-each-payment-method).

## What the order looks like in Shopify

In Shopify, the order shows:

- **A surcharge** as a line item named **Surcharge**, with a quantity of 1. Its tax is in the order's tax, as at checkout.
- **A payment rule discount** as lower line item prices, the same as other SparkLayer discounts. It's listed in the order's **B2B Discount Data** with its other discounts. See [See discount details on an order](https://docs.sparklayer.io/help/pricing/discounts.md#see-discount-details-on-an-order).

## Change the text customers see

Change these in **Translation overrides**: see [Change checkout text](https://docs.sparklayer.io/help/ordering/cart-and-checkout.md#change-checkout-text). `{amount}` is the rule's amount, such as `5%` or `£10.00`.

| Default text | Key |
| --- | --- |
| Card payment discount (\{amount}) | `cart.checkout.discount.payment-rule.upfrontPayment` |
| Pay on account discount (\{amount}) | `cart.checkout.discount.payment-rule.paymentOnAccount` |
| Invoice payment discount (\{amount}) | `cart.checkout.discount.payment-rule.paymentByInvoice` |
| Surcharge | `global.totals.surcharge` |
| View discounts | `cart.checkout.discount.cta-view-only` |
| Sorry, your order wasn't placed as your total changed. Please check it and try again. | `cart.validation-messages.payment-method-not-calculated` |

**View discounts** opens the list of discounts when a payment rule discount applies and your store has no coupon codes. The amounts shown next to each payment method, and the **Surcharge** line item name in Shopify, can't be changed.

**Core Script code for your developer**

```javascript title="Core Script"
translations: {
  en: {
    "cart.checkout.discount.payment-rule.upfrontPayment": "Card payment discount ({amount})",
    "global.totals.surcharge": "Card fee",
  }
},
```

## Limits

| Limit | Value |
| --- | --- |
| Rules per payment method | 5 |
| Filters in a **Products** condition | 25 |
| Payment methods | **Pay by invoice**, **Payment on account** and **Card at checkout** |
| Plan | Growth or above |
| Core Script | 4.13.0 or later. Check **Version for this store** at **Storefront > Widgets > Core script version** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/configuration/frontend/core)), or **SparkLayer Wholesale > Storefront > Widgets > Core script version** in the Shopify app |
| Price list | The customer group, or a group it inherits from, needs a price list, which sets the currency of its rules |
| Quotes | Rules don't apply to quotes, from the [Quoting Engine](https://docs.sparklayer.io/help/ordering/quoting.md) or the retired Request for Quote |

## FAQs

**Can I charge a fee for card payments?**

Yes. Add a rule to **Card at checkout** with **Apply a surcharge**, as a percentage or a fixed amount. Leave the conditions empty to charge it on every card order. Check the surcharge laws in each country you sell to first: see [How it works](#how-it-works).

**Can I give a discount for paying by card?**

Yes. Add a rule to **Card at checkout** with **Apply a discount**. It comes off after your other discounts, and customers see it next to the method at checkout.

**Why didn't my rule apply?**

Check that the order meets every condition on the rule, and that:

- The maximum isn't included: a **Maximum** of £100 doesn't match a £100 order.
- **Order sub-total** is checked after your normal discounts, and excludes shipping and tax.
- The customer is in the group you added the rule to, or one that inherits its **Payment methods** rule.
- A hide rule on the same method doesn't match, as it stops the method's other rules.
- Your Core Script is 4.13.0 or later.

**Is the surcharge taxed?**

Yes, at your store's default tax rate. Its tax is added to the order's tax at checkout, and the order total includes it.

**Can a surcharge give an order free shipping?**

Yes. Shipping is worked out after the surcharge, so it counts towards shipping rates based on order total. A surcharge can move an order over a free shipping threshold.

**Does a surcharge count towards a customer's credit limit?**

Yes. **Pay on Account** checks the order's total with tax, including its payment rule discounts and surcharges. If that's more than the customer's available credit, they can't use it for the order. See [Credit limits and net terms](https://docs.sparklayer.io/help/ordering/credit-net-terms-and-invoicing.md).

**What happens to the Available credit condition when a customer has no credit limit?**

A customer with no credit limit meets any **Minimum** and never meets a **Maximum**. For example, a rule that hides **Pay on Account** when available credit is under £500 never hides it from them.

**Can I set different amounts for each currency?**

No. Amounts are in the group's currency and aren't converted, so a fixed surcharge of 5 is £5 in a GBP cart and €5 in a EUR cart. A percentage works the same way in every currency.

**Do payment method rules apply to quotes?**

No. Rules don't apply to quotes from the [Quoting Engine](https://docs.sparklayer.io/help/ordering/quoting.md), and you can't add them to the retired Request for Quote method.
