# Credit limits and net terms

URL: https://docs.sparklayer.io/help/ordering/credit-net-terms-and-invoicing

Give B2B customers credit limits, account balances and net terms such as Net 30 using SparkLayer metafields, and choose how to send or attach their invoices.

> **Quick summary**
>
> - Give each B2B customer a [credit limit](https://docs.sparklayer.io/help/glossary.md#credit-limit), an account balance and [net terms](https://docs.sparklayer.io/help/glossary.md#net-terms) (7 to 90 days). Enter them on the customer's record in your store admin, in the [metafield](https://docs.sparklayer.io/help/glossary.md#metafields) **Credit Limit and Account Balance** (`sparklayer.payment_on_account`).
> - Customers see them in the **Financials** section of [My Account](https://docs.sparklayer.io/help/storefront/interfaces/my-account.md). By default, **Pay on Account** is turned off for an order over the credit limit.
> - Net terms are how many days a customer has to pay an order they didn't pay for at checkout, with **Pay on Account** or **Pay by Invoice**. Credit limits only apply to **Pay on Account**. On Shopify, Pay on Account orders arrive as draft orders with Shopify's payment terms filled in.
> - Credit limits, balances and net terms are on every plan. Send invoices with [SparkLayer Invoices](https://docs.sparklayer.io/help/ordering/invoices.md) (automatic PDF invoices, payment reminders and your own invoice template, on Growth and above), your store, an attached invoice file, or an app such as Sufio.

## How it works

How credit and net terms work, from setup to payment:

1. **Set terms on the customer**: Credit limit, balance and net terms in the customer metafield
2. **Customer sees them**: In the Financials section of My Account
3. **Customer pays on account**: At checkout, within their credit limit
4. **Order arrives with terms**: On Shopify, a draft order with payment terms and a due date
5. **You invoice and collect**: Through SparkLayer Invoices, your store, your own files or an app

**Shopify only:**

To compare Pay on Account with the other payment methods, step by step, see the interactive guide [How payments work](https://docs.sparklayer.io/help/guides/how-payments-work.md).

Before you start:

- **Pay on Account or Pay by Invoice is turned on** for the customer's group. Credit limits only apply to Pay on Account; net terms apply to both. See [Payment methods](https://docs.sparklayer.io/help/ordering/payment-methods.md#choose-which-payment-methods-a-customer-group-can-use). 
- **The payment on account metafield exists** in your store. You set it up once: see [The payment on account metafield](#the-payment-on-account-metafield).

### The payment on account metafield

A metafield is an extra field on a record in your store admin. Credit limits, balances and net terms all live in one customer metafield.

**Shopify only:**

On Shopify, SparkLayer can add it for you: go to **Integrations > Platform** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/configuration/integrations/platform)), or **SparkLayer Wholesale > Integrations > Platform** in the Shopify app and, in the **Metafields** card, click **Configure** next to **SparkLayer metafields**. See [Shopify metafields and data mapping](https://docs.sparklayer.io/help/platforms/shopify/metafields.md).

For other platforms, see the [developer docs](https://docs.sparklayer.io/developers.md).

**Metafield details, for adding it by hand**

| Item | Value |
| --- | --- |
| **Custom data type** | Customers. On Shopify, see [customer metafields](https://admin.shopify.com/settings/custom_data/customer/metafields). |
| **Metafield type** | `JSON` |
| **Namespace** | `sparklayer` |
| **Key** | `payment_on_account` |
| **Value** | Set on each customer record, for example `{"credit_limit":1000,"balance":250,"net_terms":"30_days"}`. Include only the properties you use. |

The value is a short piece of text in a set format (JSON), with these properties:

| Property | What it does | Example |
| --- | --- | --- |
| `credit_limit` | The most the customer can owe you. | `1000` |
| `balance` | What the customer owes you now. | `250` |
| `currency_code` | The currency to show the limit and balance in, if you sell in more than one. | `usd` |
| `net_terms` | The customer's payment terms. See [supported values](#set-net-payment-terms). | `30_days` |
| `balance_date` | The date of an opening balance, for the real-time account balance. See [Payment methods](https://docs.sparklayer.io/help/ordering/payment-methods.md#payments---account-balance). | `2025-01-01T18:00:00+08:00` |

### What to enter

Fill in the form and copy the value it writes. Leave out anything you don't use, and enter amounts without a currency symbol.

Add a **Balance date** only for an [opening balance](https://docs.sparklayer.io/help/ordering/payment-methods.md#set-an-opening-balance) on Shopify: the date the **Balance** was owed from, which SparkLayer tracks new orders and payments from. Pick it in the form and it's written in the format SparkLayer needs: the date, the time and your time zone's offset from UTC, such as `2025-01-01T00:00:00+00:00` for midnight on 1 January 2025 in the UK. A date needs a balance with it.

These are the common values, if you'd rather copy one:

| To give the customer | Enter |
| --- | --- |
| A credit limit of 1,000 | `{"credit_limit":1000}` |
| A credit limit of 1,000 and a balance of 250 | `{"credit_limit":1000,"balance":250}` |
| Net 30 payment terms only | `{"net_terms":"30_days"}` |
| A credit limit, a balance and Net 30 terms | `{"credit_limit":1000,"balance":250,"net_terms":"30_days"}` |
| A credit limit and balance in US dollars, if you sell in several currencies | `{"credit_limit":1000,"currency_code":"usd","balance":250}` |
| A credit limit and an opening balance of 250 owed on 1 January 2025 (UK time), for the real-time account balance on Shopify | `{"credit_limit":1000,"balance":250,"balance_date":"2025-01-01T00:00:00+00:00"}` |

## Set a credit limit and account balance

1. Open the customer's record in your store admin. On Shopify, go to **Customers** ([open in the Shopify admin](https://admin.shopify.com/customers)) and open the customer.
2. In the **Credit Limit and Account Balance** metafield, paste the value from the [form](#what-to-enter), for example `{"credit_limit":1000,"balance":250}`. 
3. If you sell in several currencies (see [Shopify Markets and currencies](https://docs.sparklayer.io/help/platforms/shopify/markets-and-currencies.md)), add the customer's currency, for example `{"credit_limit":1000,"currency_code":"usd","balance":250}`.
4. Save the customer.

**Lots of customers? Fill them in one table (Shopify):** in your Shopify admin, go to **Customers**, tick the customers and click **Edit customers**. Click **Columns**, tick **Credit Limit and Account Balance** under **Metafields**, type the values and click **Save**. See [Shopify's guide](https://help.shopify.com/en/manual/custom-data/metafields/bulk-edit-metafields).

The balance updates automatically with each successful order, and you can change it by hand at any time. For a balance that also tracks payments, turn on **Payments visibility**: see [Show a real-time account balance](https://docs.sparklayer.io/help/ordering/payment-methods.md#payments---account-balance).

| Where | What the customer sees |
| --- | --- |
| **My Account** | In **Financials**, for example, "Your account balance is £250.00 with a credit limit of £1,000.00", then "Payments may take some time to be updated. Please contact us to discuss payments or credit." |
| **Checkout** | If the cart would exceed their available credit, "Your order currently exceeds your available credit limit".  By default, **Pay on Account** is turned off and they must choose another method, such as **Pay Online by Card**. |

**Check a customer's credit details in SparkLayer**

Open the customer at **Customers** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/customers/list)), or **SparkLayer Wholesale > Customers** in the Shopify app. Under **Financial details**, **Payment on account** shows their **Balance**, **Credit limit**, **Net terms** and **Currency**. These come from the metafield, so change them on the customer's record in your store admin.

### Worked example

Available credit is the customer's `credit_limit` minus their `balance`. The balance is what they owe you, not what they have left to spend.

| What happens | Metafield value | Available credit |
| --- | --- | --- |
| You give a new customer $250 to spend | `{"credit_limit":250,"balance":0}` | $250.00 |
| They place a $77.80 order with **Pay on Account** | SparkLayer updates the balance to `77.80` | $172.20 |
| They try to pay on account for a $200.00 order | No change | $172.20, so checkout is blocked for **Pay on Account** |

Don't set `balance` to 250 to give them $250 to spend. `{"credit_limit":250,"balance":250}` means they already owe you $250, so they've used all their credit.

Checkout blocks the order, rather than warning the customer, because of the customer group's **Prevent placing an order if exceeding credit limit** setting, shown on the group as **Checkout blocked if limit exceeded**. See [Block orders over the credit limit](https://docs.sparklayer.io/help/customers/customer-groups.md#block-orders-over-the-credit-limit).

### Let customers order over their credit limit

By default, a customer can't pay on account for an order over their credit limit. To allow it, change the customer group's **Credit settings** 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. For every group, click **Edit** on the base customer group.
2. Under **Inherited rules**, click **+ Override** next to **Credit settings** (on the base group, **+ Customize**), then **Configure**.
3. Turn off **Prevent placing an order if exceeding credit limit**, then click **Save**.

Customers can then pay on account over their limit, with a message that the order may be delayed and subject to approval. See [Block orders over the credit limit](https://docs.sparklayer.io/help/customers/customer-groups.md#block-orders-over-the-credit-limit).

There's also a store-wide setting at **Settings > Configurations** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/configuration/settings/general)), or **SparkLayer Wholesale > Settings > Configurations** in the Shopify app that lets customers use Pay on Account when an order takes them over their limit.

### Change the credit messages

Change this text without code at **Storefront > Options > Translation overrides** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/storefront/options)), or **SparkLayer Wholesale > Storefront > Options > Translation overrides** in the Shopify app (see [Change checkout text](https://docs.sparklayer.io/help/ordering/cart-and-checkout.md#change-checkout-text)). `{balance}`, `{creditLimit}` and `{type}` are replaced with the customer's own values.

| Key | Default text |
| --- | --- |
| `account.main.my-details.payment-on-account.detail` | Your account balance is `{balance}` with a credit limit of `{creditLimit}`. |
| `account.main.my-details.payment-on-account.detail-without-limit` | Your account balance is `{balance}`. |
| `account.main.my-details.payment-on-account.net-terms` | Your payment terms are `{type}`. |
| `account.main.my-details.payment-on-account.sub-text` | Payments may take some time to be updated. Please contact us to discuss payments or credit. |
| `cart.checkout.payment-method.credit-unavailable.title` | Your cart currently exceeds your available credit limit |
| `cart.checkout.payment-method.credit-unavailable.message` | Please choose an alternative payment method to complete your order. If you'd like to discuss your payment terms, please contact us. |
| `cart.checkout.payment-method.credit-limit-hit.title` | Your cart currently exceeds your available credit limit |
| `cart.checkout.payment-method.credit-limit-hit.message` | You can place an order but it may be delayed and subject to approval. If you'd like to discuss your payment terms, please contact us. |

`credit-unavailable` messages show when Pay on Account is turned off for an order over the limit. `credit-limit-hit` messages show when you let customers order over it.

**Core Script code for your developer**

A developer can set the same text in your [Core Script](https://docs.sparklayer.io/help/storefront/storefront-options.md#add-a-core-script-setting):

```javascript title="Core Script"
translations: {
  en: {
    "account.main.my-details.payment-on-account.detail": "Your account balance is {balance} with a credit limit of {creditLimit}.",
    "account.main.my-details.payment-on-account.detail-without-limit": "Your account balance is {balance}.",
    "account.main.my-details.payment-on-account.net-terms": "Your payment terms are {type}.",
    "account.main.my-details.payment-on-account.sub-text": "Payments may take some time to be updated. Please contact us to discuss payments or credit.",

    "cart.checkout.payment-method.credit-unavailable.title": "Your cart currently exceeds your available credit limit",
    "cart.checkout.payment-method.credit-unavailable.message": "Please choose an alternative payment method to complete your order. If you'd like to discuss your payment terms, please contact us.",
    "cart.checkout.payment-method.credit-limit-hit.title": "Your cart currently exceeds your available credit limit",        
    "cart.checkout.payment-method.credit-limit-hit.message": "You can place an order but it may be delayed and subject to approval. If you'd like to discuss your payment terms, please contact us.",
  }
},
```

## Set net payment terms

Net terms tell the customer how many days they have to pay an order they didn't pay for at checkout, such as Net 30. They show as **Payment terms** (for example, "45 days") in **Financials** in My Account.

1. Open the customer's group at **Customers > Groups** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/customers/groups)), or **SparkLayer Wholesale > Customers > Customer groups** in the Shopify app and tick **Payment on account** (or **Pay by invoice**) in its **Payment methods** rule. See [Payment methods](https://docs.sparklayer.io/help/ordering/payment-methods.md#choose-which-payment-methods-a-customer-group-can-use).
2. On the customer's record, add the terms to the payment on account metafield, for example `{"net_terms":"30_days"}`. Use the [form](#what-to-enter) to combine them with a credit limit: it writes `{"credit_limit":1000,"balance":250,"net_terms":"30_days"}` for you.

The customer uses their terms by choosing **Pay on Account** (or **Pay by Invoice**) at checkout. Supported values:

| Net terms | Value |
| --- | --- |
| 7 days | `7_days` |
| 15 days | `15_days` |
| 30 days | `30_days` |
| 45 days | `45_days` |
| 60 days | `60_days` |
| 90 days | `90_days` |

**Shopify:**

Pay on Account orders arrive in Shopify as **draft orders**. SparkLayer ticks **Payment due later** and fills in **Payment terms** (such as "Within 30 days") and **Issue date**, so Shopify shows the due date, such as "Payment due on 19 June 2023 (Net 30)".

To complete these drafts automatically and collect payment later (for example, through your accounting system), turn on **Auto-complete draft orders** at **Integrations > Platform > Shopify order actions** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/configuration/integrations/platform)), or **SparkLayer Wholesale > Integrations > Platform > Shopify order actions** in the Shopify app.

To mark net terms orders as paid automatically, and automate more of the process, use our [ready-made Shopify Flows](https://docs.sparklayer.io/help/platforms/shopify/customisations/flow.md).

**Other platforms:**

For how net terms orders are created on your platform, see the [developer docs](https://docs.sparklayer.io/developers.md).

## Choose how to send invoices

| Method | How it works | Best when |
| --- | --- | --- |
| **SparkLayer Invoices** (Growth and above) | A PDF invoice is created for each order, and customers view and download it from My Account. | Your needs are fairly simple and you don't want another app. See [Invoices](https://docs.sparklayer.io/help/ordering/invoices.md). |
| **Send invoices from your store** | You send invoices from your eCommerce platform's admin. | Your needs are basic, or you're testing a B2B invoicing process. See [Send invoices from your store](#send-invoices-from-your-store). |
| **Attach your own invoice** | A metafield links an invoice file to the order, added by hand or automatically. | Another system, such as your ERP or accounting software, already creates invoice files such as PDFs. See [Attach your own invoice](#attach-your-own-invoice-to-an-order). |
| **Third-party app** | Apps such as Sufio integrate with SparkLayer. | You also invoice retail customers, or want more design control. See [Use a third-party invoicing app](#use-a-third-party-invoicing-app). |

**Shopify only:**

To see how each way of invoicing works with **Auto-complete draft orders**, and with Xero or QuickBooks Online, try the interactive guide [How payments work](https://docs.sparklayer.io/help/guides/how-payments-work.md).

### Send invoices from your store

**Shopify:**

Orders with an offline [payment method](https://docs.sparklayer.io/help/ordering/payment-methods.md), such as Pay by Invoice, can arrive in Shopify as draft orders. Shopify's **Send invoice** emails the customer a message and a link to the Shopify checkout.

1. In the Shopify admin, open the draft order.
2. Send the invoice. The customer gets an email with a **Complete your purchase** button and an order summary.
3. When the customer pays, the order is marked as paid and moves to your Shopify **Orders**.

Until then, the order stays a draft. If the customer hasn't paid, open the draft and click **Resend invoice**. If you're taking payment another way, use **Collect payment** to mark it as paid.

To change the email, edit the **Draft order invoice** template at **Settings > Notifications** ([open in the Shopify admin](https://admin.shopify.com/settings/notifications)). See Shopify's guide to [sharing a checkout link with customers](https://help.shopify.com/en/manual/orders/create-orders#share-checkout-link-with-customers).

**Other platforms:**

See the [developer docs](https://docs.sparklayer.io/developers.md).

### Attach your own invoice to an order

Link an invoice file to an order, and customers see **View & Download Invoice** on that order in [My Account](https://docs.sparklayer.io/help/storefront/interfaces/my-account.md). Put a [UUID](https://www.uuidgenerator.net/) in the file name or URL so no one can guess it.

**Shopify:**

1. Add an order metafield in Shopify (see [Shopify metafields and data mapping](https://docs.sparklayer.io/help/platforms/shopify/metafields.md)):

   | Item                 | Value                                                                     |
   | -------------------- | ------------------------------------------------------------------------- |
   | **Custom data type** | [Orders](https://admin.shopify.com/settings/custom_data/order/metafields) |
   | **Metafield type**   | `URL` or `File`. One value or a list of values are both supported.        |
   | **Namespace**        | `sparklayer`                                                              |
   | **Key**              | `invoice_url`                                                             |

2. If your invoice isn't hosted anywhere yet, upload it to [Shopify Files](https://admin.shopify.com/content/files?selectedView=all) and click the **Copy link** icon next to it.

3. Open the order in Shopify. In **Metafields**, paste the link into the invoice URL field (for example, **B2B Invoice URL**) and save.

As this is a Shopify metafield, you can attach invoices in bulk, or automatically from a backend system such as an ERP or CRM.

**Other platforms:**

| Item | Value |
| --- | --- |
| **Custom data type** | Orders |
| **Metafield type** | A text string. Use secure, unguessable file names, for example with a [UUID generator](https://www.uuidgenerator.net/). |
| **Namespace** | `sparklayer` |
| **Key** | `invoice_url` |
| **Value** | N/A |

For more information, see the [developer docs](https://docs.sparklayer.io/developers.md).

### Use a third-party invoicing app

For more invoicing features, consider an app such as [Sufio Invoicing](https://docs.sparklayer.io/help/integrations/customer-experience/sufio.md).

## Troubleshooting

**Diagnose: Credit limit or Pay on Account not working?** Check the customer’s credit metafield and group settings.

1. **What’s happening?** Pick the closest match.
   - “Your cart exceeds your available credit limit”: go to question 2
   - Pay on Account doesn’t show at checkout: go to question 3
   - They want to pay part by credit and part by card: go to fix A (One payment method per order)
   - Gift cards don’t work: go to fix B (Gift cards only work at Shopify’s card checkout)
2. **In the customer’s credit metafield, is `balance` what they already owe you?** `balance` is the amount owed, not the credit they have left. Available credit is `credit_limit` minus `balance`. Where to look: Customers > select the customer > Metafields (Shopify admin).
   - Yes: go to question 4
   - No, it’s what they can spend: go to fix C (Set `balance` to what they owe)
3. **Is Pay on Account turned on for the customer’s group?** Payment methods are chosen per customer group. Where to look: Customers > Groups (SparkLayer).
   - Yes: go to fix D (Check the customer’s group)
   - No: go to fix E (Turn on Pay on Account for the group)
4. **Would this order take them over their limit?** For example, with a limit of 250 and a balance of 200, only 50 is available.
   - Yes: go to fix F (The group blocks orders over the limit)
   - No: go to fix G (Everything checks out)

**Fixes**

- **A. One payment method per order** An order can’t be split between Pay on Account and card. The customer can pay the whole order one way.
- **B. Gift cards only work at Shopify’s card checkout** The gift card field is Shopify’s, so it only appears when paying by card. It doesn’t work with Pay on Account, and SparkLayer isn’t a store-credit system.
- **C. Set `balance` to what they owe** To give a customer 250 to spend, use `{"credit_limit":250,"balance":0}`. After a 77.80 order their balance is 77.80, leaving 172.20 available. A balance of 250 means they’ve used it all. Where: Customers > select the customer > Metafields (Shopify admin). See [Credit and net terms](https://docs.sparklayer.io/help/ordering/credit-net-terms-and-invoicing.md).
- **D. Check the customer’s group** If the group has Pay on Account but this customer doesn’t see it, check they’re in that group. Next: Wrong prices, payment methods or shipping for a customer?
- **E. Turn on Pay on Account for the group** Add Pay on Account to the group’s payment methods and save. Then set the customer’s credit limit and terms. Where: Customers > Groups (SparkLayer). See [Payment methods](https://docs.sparklayer.io/help/ordering/payment-methods.md).
- **F. The group blocks orders over the limit** The customer group is set to block checkout when an order would exceed the limit. Raise the customer’s `credit_limit`, record a payment by lowering their `balance`, or change the group’s credit setting to allow it. Where: Customers > Groups (SparkLayer). See [Block orders over the credit limit](https://docs.sparklayer.io/help/customers/customer-groups.md#block-orders-over-the-credit-limit).
- **G. Everything checks out** Your setup looks right, so we'll take it from here. Send us your answers with the customer’s email and their credit metafield value.

## FAQs

**What happens when a customer goes over their credit limit?**

By default, **Pay on Account** is turned off for that order, and a message asks them to choose another method. To let them order over their limit, see [Let customers order over their credit limit](#let-customers-order-over-their-credit-limit).

**I gave a customer credit, so why can't they pay on account?**

Check the metafield's `balance`. It's what the customer owes you, so a balance equal to the credit limit leaves them nothing to spend. To give them $250 to spend, enter `{"credit_limit":250,"balance":0}`. See [Worked example](#worked-example).

**Why is checkout blocked instead of showing a warning?**

The customer group's **Prevent placing an order if exceeding credit limit** setting is on, which is the default. Turn it off to let customers place the order with a warning instead. See [Let customers order over their credit limit](#let-customers-order-over-their-credit-limit).

**How do I collect payment for a Pay on Account order?**

**Shopify only:**

Pay on Account orders arrive in Shopify as draft orders with payment due later. SparkLayer doesn't take the payment. Collect it your usual way, such as by bank transfer, then mark the order as paid in Shopify. See [Complete a draft order by hand](https://docs.sparklayer.io/help/ordering/automation-and-workflows.md#complete-a-draft-order-by-hand).

**Can a customer pay for one order partly on account and partly by card?**

No. Each order has one payment method, so a customer can't split an order between their credit and a card.

**Can customers use Shopify gift cards or store credit?**

**Shopify only:**

Shopify gift cards only work in Shopify's own checkout, when the customer chooses **Pay Online by Card**. They can't be used with **Pay on Account**. SparkLayer isn't a store credit system: the credit limit is how much a customer can owe you, not a balance they've paid in advance. See [Which payment methods work with the SparkLayer checkout?](https://docs.sparklayer.io/help/ordering/payment-methods.md#which-payment-methods-work-with-the-sparklayer-checkout)

**Can I automatically mark net terms orders as paid?**

Not in SparkLayer: net terms orders arrive with Shopify's payment terms and a due date, and stay unpaid until you collect payment. Use Shopify Flow instead. See [Set net payment terms](#set-net-payment-terms).

**Can customers see payments as well as orders in their balance?**

Yes, with **Payments visibility** (Shopify only). See [Show a real-time account balance](https://docs.sparklayer.io/help/ordering/payment-methods.md#payments---account-balance).
