PHPackages                             ejosterberg/opensalestax-prestashop - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ejosterberg/opensalestax-prestashop

ActivePrestashop-module[Utility &amp; Helpers](/categories/utility)

ejosterberg/opensalestax-prestashop
===================================

PrestaShop 8.x module — destination-based US sales tax via the self-hosted OpenSalesTax engine

v0.1.0-alpha.3(3w ago)04Apache-2.0 OR GPL-2.0-or-laterPHPPHP &gt;=8.2CI passing

Since May 16Pushed 3w agoCompare

[ Source](https://github.com/ejosterberg/opensalestax-prestashop)[ Packagist](https://packagist.org/packages/ejosterberg/opensalestax-prestashop)[ Docs](https://github.com/ejosterberg/opensalestax-prestashop)[ RSS](/packages/ejosterberg-opensalestax-prestashop/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (6)Versions (4)Used By (0)

OpenSalesTax for PrestaShop
===========================

[](#opensalestax-for-prestashop)

> PrestaShop 8.x module that replaces PrestaShop's built-in tax calculation with a merchant-self-hosted **OpenSalesTax**engine for destination-based US sales tax.

[![CI](https://github.com/ejosterberg/opensalestax-prestashop/actions/workflows/ci.yml/badge.svg)](https://github.com/ejosterberg/opensalestax-prestashop/actions/workflows/ci.yml)[![License](https://camo.githubusercontent.com/ed720b8af292f8fbd2691e43ae8fe3480ef13c19f1352c55557d0d7aaf490d1f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4170616368652d2d322e302532304f5225323047504c2d2d322e302d2d6f722d2d6c617465722d626c75652e737667)](LICENSE)

> **Disclaimer.** Tax calculations are provided as-is for convenience. The merchant is solely responsible for tax-collection accuracy and remittance to the appropriate jurisdictions. Verify against your state Department of Revenue before remitting.

Why
---

[](#why)

PrestaShop ships zone/state-based tax tables. They're a reasonable starting point but they don't reflect the granular city / county / special-district sales tax that US merchants actually collect. This module hands the calculation off to your own OpenSalesTax engine instance, which returns destination- correct rates via the OST PHP SDK.

**This module calculates only.** It does NOT file or remit. The merchant remains responsible for filing and payment.

How it works
------------

[](#how-it-works)

1. Module installs into PrestaShop's standard module loader.
2. Registers the `actionTaxManagerFactory` hook (the chosen extension point — see [`specs/decisions/001-taxmanager-hook.md`](specs/decisions/001-taxmanager-hook.md)).
3. On every cart-tax recalc, the hook builds an OST request from the cart's line totals + ship-to ZIP and asks the engine for tax.
4. Returns a `TaxManagerInterface` implementation that surfaces the engine's result as PrestaShop tax lines.

When the gates fail (non-US ship-to, non-USD currency, unreachable engine in fail-soft mode), the hook returns null and PrestaShop falls back to its built-in `GlobalTaxManager`. Merchants don't need to keep both systems in sync — built-in is the safety net.

Install
-------

[](#install)

### Via Composer (development / dev-installs)

[](#via-composer-development--dev-installs)

```
composer require ejosterberg/opensalestax-prestashop
```

The module ends up in `vendor/ejosterberg/opensalestax-prestashop/`. For PrestaShop's loader to find it, either symlink into `modules/opensalestax/` or use the ZIP build below.

### Via PrestaShop module ZIP (merchants)

[](#via-prestashop-module-zip-merchants)

```
git clone https://github.com/ejosterberg/opensalestax-prestashop.git
cd opensalestax-prestashop
tools/build-zip.sh
# → dist/opensalestax-v0.1.0-alpha.1.zip
```

Then in PrestaShop admin:

**Modules → Module Manager → Upload a module → upload `opensalestax.zip`**

After install: **Modules → Module Manager → search "OpenSalesTax" → Configure**.

The PrestaShop Addons Marketplace path is deferred to v0.2+; see [`specs/handoff.md`](specs/handoff.md).

Configure
---------

[](#configure)

In **Modules → OpenSalesTax → Configure**:

SettingDefaultNotes**Enabled**offTurn ON after the URL + key are set.**Engine base URL**(empty)Fully-qualified `https://...` URL of your OST engine. SSRF-validated; private nets rejected by default.**API key**(empty)Bearer token if your engine requires auth.**Timeout (seconds)**10Engine call timeout.**Verify TLS certificates**onDisable only for self-signed dev engines.**Allow private-network engines**offSet ON to permit `10.x.x.x` / `192.168.x.x` / `lan-engine.local` URLs.**Fail hard on engine errors**offDefault fail-soft falls back to PrestaShop's tax. ON blocks checkout when the engine is unreachable.**Cache TTL (seconds)**3600Per-ZIP / per-cart-shape cache window.**Enable nexus filter**offWhen ON, only ship-to addresses in the allowlist get destination-based tax.**Nexus state allowlist**(empty)Comma-separated 2-letter state codes (`MN, CA, NY`).Behavior
--------

[](#behavior)

### What's calculated, what's not

[](#whats-calculated-whats-not)

Cart shapeBehaviorUS ship-to + USD + ZIP resolved + module enabled + nexus filter passesOST engine call; per-line tax returned.Non-US ship-toYield to PrestaShop.Non-USD currencyYield to PrestaShop.ZIP can't be parsed (not 5 digits)Yield to PrestaShop.Module disabled / base URL emptyYield to PrestaShop.Nexus filter on, ship-to state not in allowlistYield to PrestaShop.Engine call fails (timeout / 5xx / malformed) — fail-softYield to PrestaShop. Logs structured warning.Engine call fails — fail-hardThrow; checkout blocked.### Caching

[](#caching)

Engine responses cache per `(ZIP-5, cart-signature)` for the configured TTL. The cart-signature is a deterministic 16-char hex of the sorted `(category, amount)` tuples — so two carts with the same ZIP but different mixes of products don't share a stale cache entry.

### SSRF defense

[](#ssrf-defense)

The base URL is admin-controlled, which is the dominant attack class for self-hosted-engine integrations. The validator rejects RFC1918, loopback, link-local (incl. cloud metadata), CGNAT, and multicast addresses by default. Merchants on a private LAN opt in via the **Allow private-network engines**toggle.

DNS-rebinding mitigation via cURL `RESOLVE` IP-pinning is on the v0.2 roadmap (see [`specs/handoff.md`](specs/handoff.md) — mirrors the OpenCart sibling's v0.2.0 approach).

Local development
-----------------

[](#local-development)

```
composer install
composer check       # phpunit + phpstan + php-cs-fixer + composer audit
```

Granular runs:

```
composer test           # PHPUnit
composer stan           # PHPStan level max
composer cs             # PHP-CS-Fixer dry-run
composer cs-fix         # PHP-CS-Fixer apply fixes
composer audit          # CVE check
```

To package an installable PrestaShop ZIP:

```
tools/build-zip.sh
# → dist/opensalestax-vX.Y.Z.zip
```

License
-------

[](#license)

Dual-licensed under your choice of:

- **Apache License 2.0** — see [`LICENSE-APACHE.txt`](LICENSE-APACHE.txt)
- **GNU GPL v2 or later** — see [`LICENSE-GPL.txt`](LICENSE-GPL.txt)

SPDX expression: `Apache-2.0 OR GPL-2.0-or-later`. See [`LICENSE`](LICENSE) for the dual-license declaration and [`specs/decisions/002-license-choice.md`](specs/decisions/002-license-choice.md)for the rationale.

PrestaShop core itself is OSL-3.0 + AFL-3.0; both are GPL-compatible, so the combined work distributes cleanly under the GPL-2.0-or-later option.

Contributing
------------

[](#contributing)

See [`CONTRIBUTING.md`](CONTRIBUTING.md). DCO sign-off (`git commit -s`) is required on every commit.

Sibling projects
----------------

[](#sibling-projects)

ConnectorRepoOpenCart 4.x[opensalestax-opencart](https://github.com/ejosterberg/opensalestax-opencart)WooCommerce[opensalestax-for-woocommerce](https://github.com/ejosterberg/opensalestax-for-woocommerce)Magento 2[opensalestax-magento](https://github.com/ejosterberg/opensalestax-magento)Bagisto[opensalestax-bagisto](https://github.com/ejosterberg/opensalestax-bagisto)Vendure[opensalestax-vendure](https://github.com/ejosterberg/opensalestax-vendure)PHP SDK (used by all PHP-tier connectors)[opensalestax](https://github.com/ejosterberg/opensalestax)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance95

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

21d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b647ae9c341fdf92c36cb479ba7535c2eff9ac92f8614965a3b5953f7b543152?d=identicon)[ejosterberg](/maintainers/ejosterberg)

---

Top Contributors

[![ejosterberg](https://avatars.githubusercontent.com/u/6363457?v=4)](https://github.com/ejosterberg "ejosterberg (3 commits)")

---

Tags

taxprestashoptax calculationsales taxopensalestaxus-taxprestashop8

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ejosterberg-opensalestax-prestashop/health.svg)

```
[![Health](https://phpackages.com/badges/ejosterberg-opensalestax-prestashop/health.svg)](https://phpackages.com/packages/ejosterberg-opensalestax-prestashop)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k11](/packages/tempest-framework)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.3M7](/packages/avalara-avataxclient)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

744284.3k34](/packages/civicrm-civicrm-core)[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

68353.9k](/packages/run-as-root-magento2-prometheus-exporter)[verbb/shippy

A framework agnostic, multi-carrier shipping library for PHP.

1611.3k2](/packages/verbb-shippy)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
