Hello,
We are setting up the Company Credit addon on our B2BKing installation and have run into a bug that blocks customers from paying on credit even when they are well within their approved limit. We would appreciate your help identifying the cause.
Setup
- Customer has an individual credit limit of €5,000 (user meta: b2bking_user_credit_limit).
- The customer group's "Group Credit Limit" field is left empty, per your documentation stating it is "optional, is overwritten by individual user limit."
- Customer group has the credit gateway, iDEAL, and Bancontact enabled as payment methods.
- The customer's payment methods override is set to "Use group rules (Default)."
What we tested
We placed five consecutive test orders on the same customer, all using the credit gateway:
1. Order #1729 – €640.13 – succeeded
2. Order #1730 – €1,213.70 – succeeded (cumulative: €1,853.83)
3. Order #1731 – €1,787.28 – FAILED with "You do not have sufficient credit to pay for this order" (cumulative would have been €3,641.11 — still well under the €5,000 limit)
4. Order #1732 – €1,213.70 – FAILED, same error
5. Order #1733 – €125.84 – FAILED, same error
The cumulative total at checkout never exceeded the €5,000 limit, yet orders 3, 4, and 5 were rejected at checkout.
A second, arguably more serious issue
Despite the checkout error, all five orders were still created, and the full amount was deducted from the customer's credit balance in the Company Credit ledger (confirmed via the ledger PDF export from the customer's CRM Hub page — all five show as "Purchased" with the balance decreasing each time). However, orders 3–5 are stuck in "Pending payment" status rather than "Processing," while orders 1–2 (which did not trigger the error) moved to "Processing" normally.
So the checkout-time validation appears to be blocking the order from completing normally, but the order is still created and credit is still consumed — meaning a rejected order can silently eat into a customer's available credit.
Questions
1. How exactly is "used credit" calculated at checkout — is it a live calculation from order data, or a cached/periodically recalculated value? We noticed a user meta field b2bking_grpro_last_periodic_run, which suggests some form of periodic recalculation, and want to rule out that stale cached data is causing the false rejection.
2. Does leaving the "Group Credit Limit" field empty correctly fall back to the individual user limit, or could an empty value be internally read as 0 and therefore create a conflicting, lower ceiling?
3. Why would checkout validation reject an order that is within the credit limit, while still creating the order and deducting the credit amount from the ledger?
4. When an order paid via Company Credit is cancelled, is the credit reliably restored, including after repeated cancel/reorder cycles? We want to confirm this before relying on it in production.
We are preparing to launch this store shortly and would appreciate a prompt response. Happy to provide additional debug output, screenshots, or the ledger PDF export if useful.
Thank you,
Jack