Case study · Industrial distribution

Software subscriptions that renew, each on a P21 account

Who this is for For a distributor that sells software or service subscriptions next to its equipment, bills the renewals from its store, and needs every subscriber tied to a customer account in the ERP.

The distributor sold software subscriptions from its Magento store: monthly, yearly and on demand. Some renewals failed every cycle, subscriptions were charged for shipping, and a buyer could check out without an account in Epicor P21. We fixed the renewals, required an account, held checkout until the buyer's P21 customer code was set, and kept renewals billing on one small server after the main site moved.

  • Industrial distribution
  • Survey and construction equipment
  • Magento Open Source
  • Epicor P21

Home / Case studies / Software subscriptions that renew, each on a P21 account

The situation

  • A survey and construction equipment distributor that also sold software subscriptions for the equipment it carries: monthly, yearly and on demand, picked on one page with their accessories.
  • The store billed each renewal to the card on file, and every order went on to Epicor P21.
  • Some renewals failed every cycle with a database error. Subscriptions were charged for shipping, and a buyer could check out without an account in P21.

What we connected

  1. 1Subscribers to Our account check: a plan and accessories in the cart
  2. 2Our account check to Magento Open Source: checkout only on a P21 account
  3. 3Magento Open Source to Epicor P21: each order under the customer's code
  4. 4Magento Open Source to Card gateway: every renewal charged

What changed

  • Failed renewalsRenewals that failed every cycle billing again: the payment module had been saving each stored card a second time
  • A P21 account behind every subscriptionCheckout holds a subscription until the buyer's P21 customer code is set, and tells them who to call
  • Accounts requiredAn account required before checkout for any product flagged for it, subscriptions first
  • Shipping on softwareNo shipping charged on subscriptions or other virtual products
  • The plan pageBuyers set how many of each accessory they want, not one of each
  • After the main site movedRenewals kept billing from the old store, on one server in place of a full cloud stack
How we built it

Finding the failed renewals

Nothing in the logs explained the failures at first, and the gateway's test account would not work on our servers. Once we had a working sandbox, we reproduced it on a copy of the live database: on every renewal the payment module tried to save the customer's stored card again, and the database refused the duplicate. We added a check for a card already on file, and the paused subscriptions were restarted.

Software is not shipped

Subscriptions and other virtual products were picking up a shipping charge. We found why and set them to ship free, always.

An account, then the right account

First we added a product flag, account required, so a subscription could not be bought as a guest. Then a check at checkout: the buyer's P21 customer code has to be set, and it cannot be the shared account used for walk-in sales. When it is missing, checkout stops and shows the number to call to get it set.

The plan page

Buyers picked a plan and its accessories on one page. We added plus and minus buttons for each accessory, so one order could carry several.

Renewals after the move

When the company's main site moved, the old store still held live subscriptions. We moved it to a subdomain and out of search, then moved its sessions, cache, search and database onto one server, removed the load balancer and the rest of the cloud stack, and kept the scheduled jobs that bill renewals running.

The whole story

Subscriptions in a store built for equipment

Most of the store sold equipment and supplies. One page sold software subscriptions for that equipment, on demand, by the month or by the year, with accessories picked alongside. The store charged each renewal to the card on file, and every order went to Epicor P21 like any other.

Renewals that failed

In our first months, a few renewals failed every cycle with the same database error, and others went through. The team paused the failing ones by hand. We traced it to the payment module saving the stored card again on each renewal. With a check in place for a card already on file, the paused subscriptions restarted and billed.

Every subscriber on an account

A subscription is a relationship, so the team needed every subscriber tied to a customer in P21. We made an account required for subscription products. Later we added a check at checkout: no P21 customer code, or the shared walk-in code, and checkout stops and tells the buyer who to call.

After the move

Around the turn of 2025 the company's main site moved elsewhere, and the old store still billed live renewals. We moved it to a subdomain, out of search, and in March 2025 cut its hosting down to a single server so the renewals kept running.