WP Manifestindependent plugin directory
manifest / ecommerce / wpcalibrate-store-credit

WPCalibrate Store Credit

Enterprise account-based store credit, immutable transaction ledger, and wallet tender system for WooCommerce.

★ 0stars
v1.0.2latest · 1mo ago

Install

Download wpcalibrate-store-credit-1.0.2.zip From the v1.0.2 release on GitHub, Oct 15, 2026

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/zeeshanraza-official/wpcalibrate-store-credit/releases/download/v1.0.2/wpcalibrate-store-credit-1.0.2.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WPCalibrate Store Credit for WooCommerce

WPCalibrate Store Credit is an enterprise-grade, account-based store credit, immutable transaction ledger, and wallet tender system engineered specifically for modern WooCommerce stores.

Designed from the ground up for high-volume merchants, financial accuracy, and strict audit compliance, the plugin eliminates binary floating-point rounding errors through deterministic integer scaling, guarantees double-entry bookkeeping with row-level database locking, and protects store revenue by turning order refunds into lifetime customer value.


📖 About WPCalibrate Store Credit

Traditional coupon-based credit systems in WooCommerce suffer from severe accounting flaws: coupons distort tax calculations, cause fractional cent rounding errors, fail under high-concurrency checkouts, and lack an authoritative financial audit trail.

WPCalibrate Store Credit treats store credit as true payment tender rather than a discount:

  • True Tender Accounting: Applies as a payment method that reduces the customer's payment obligation without altering taxable item subtotals or shipping taxes.
  • Revenue Retention on Returns: When customers return items, merchants can issue store credit instantly with zero merchant gateway fees, keeping 100% of the funds inside the store.
  • Double-Entry Financial Integrity: Every debit, credit, refund, or expiration is permanently recorded in an immutable ledger with cryptographic idempotency keys, guaranteeing that account balances can always be mathematically reconstructed from historical transactions.
  • Zero Binary Float Inaccuracies: All monetary arithmetic operates using fixed integer scaling ($10^4 = 10,000$ scaled units per dollar), preventing floating-point drift across multi-item or multi-currency carts.

✨ Features

🧮 1. Deterministic Money Value Object (10^4 Scaling)

  • Eliminates standard PHP float precision errors (such as 0.1 + 0.2 !== 0.3).
  • Fully supports zero-decimal currencies (JPY), standard 2-decimal currencies (USD, EUR, GBP), and 3-decimal currencies (KWD, BHD).
  • Cross-currency operations are strictly validated and forbidden at the type level.

📜 2. Double-Entry Immutable Ledger & Concurrency-Safe Balance Cache

  • Authoritative Ledger (wp_wpcalibrate_store_credit_transactions): Append-only audit log capturing user_id, type, direction, amount, balance_after, idempotency_key, and user attribution.
  • High-Performance Materialized Cache (wp_wpcalibrate_store_credit_balances): Fast indexed table for instant balance queries.
  • Pessimistic Row-Level Locking: Uses MySQL SELECT ... FOR UPDATE transactions during balance mutations to eliminate race conditions and double-spending during flash sales.
  • Strict Overdraft Protection: System strictly prevents customer balances from dropping below zero under all conditions.

🛒 3. Dual Checkout Tender Support (Classic & Blocks)

  • Classic WooCommerce Checkout: Seamless customer toggle allows applying available wallet credit towards cart subtotals with instant AJAX calculation.
  • WooCommerce Checkout Blocks: Native integration with WooCommerce Checkout Blocks via @woocommerce/blocks-registry.
  • Split Tender: If the customer's wallet balance does not cover the entire cart, the remaining balance is smoothly paid using any other active payment gateway (Stripe, PayPal, etc.).
  • Dedicated Store Credit Gateway: Orders paid 100% by store credit bypass external gateways entirely and transition to processing/completed immediately.

🔄 4. Automated Order Lifecycle Management

  • Automatic Order Cancellation Restoration: If an order containing store credit tender is cancelled or failed, the exact credit amount is refunded to the customer's wallet idempotently.
  • 1-Click Admin Order Refund: Direct "Refund to Store Credit" action on the WooCommerce Edit Order screen (compatible with both HPOS and classic post storage).

⏳ 5. FIFO Credit Expiration Policy

  • First-In, First-Out (FIFO) Consumption: Credits with the earliest expiration dates are automatically spent first during checkouts.
  • Action Scheduler & WP-Cron Support: Automated background job runs daily to safely identify and retire expired balances via expiration_debit audit transactions.

📊 6. Executive SaaS Admin Dashboard

  • Collision-Resistant Parent Hub: Integrates cleanly into the shared WPCalibrate parent admin menu (admin.php?page=wpcalibrate) with crisp authentic branding.
  • Executive Quick-Action Toolbar: 1-click access to adjust customer balances, audit ledger entries, configure checkout options, and view technical documentation.
  • Real-Time KPI Trend Cards: Live metrics for Total Store Liability, Active Customers, and 100% Immutable Invariant status.
  • Interactive Technical Guide: Embedded accordion explaining business purpose, accounting methods, admin step-by-step procedures, and customer workflows.

👤 7. Customer My Account Wallet Hub

  • Dedicated Store Credit endpoint in WooCommerce My Account.
  • High-contrast wallet balance card, available currency indicator, and paginated transaction history table with dates, reference orders, and notes.

🚀 8. Built-in Automated Dashboard Updates

  • Integrated GitHubUpdater engine automatically queries GitHub Releases.
  • Store administrators receive direct update notifications on Dashboard > Updates and can perform 1-click updates from the WordPress admin without touching FTP or Git.

💻 Requirements & Compatibility

Component Minimum Version Tested / Recommended
PHP 8.2 (Strict typing enforced) 8.2, 8.3
WordPress 6.4 6.7.x, 7.1.x
WooCommerce 8.5 9.x, 10.x, 11.2.x
Database MySQL 5.7+ / MariaDB 10.3+ InnoDB (Required for row locking)
Storage Engine WordPress Core & HPOS High-Performance Order Storage (HPOS)

🚀 Installation & Updates

Option 1: WordPress Dashboard (1-Click ZIP Upload)

  1. Download the latest packaged release: wpcalibrate-store-credit-1.0.2.zip.
  2. In your WordPress admin, navigate to Plugins > Add New Plugin > Upload Plugin.
  3. Choose the downloaded ZIP file and click Install Now.
  4. Click Activate Plugin.

Option 2: Automatic In-Place Updates from WordPress Dashboard

Once installed, future releases published on GitHub are automatically detected by your WordPress installation.

  1. When a new release is available, an update notice appears under Dashboard > Updates and on the Plugins screen.
  2. Click Update Now alongside WPCalibrate Store Credit to perform an instant, safe, in-place upgrade.

Option 3: Manual FTP / SFTP Installation

  1. Extract wpcalibrate-store-credit-1.0.2.zip on your computer.
  2. Upload the wpcalibrate-store-credit folder to /wp-content/plugins/ on your web server.
  3. In WordPress admin, go to Plugins > Installed Plugins and click Activate.

Option 4: Git Clone

cd wp-content/plugins/
git clone https://github.com/zeeshanraza-official/wpcalibrate-store-credit.git wpcalibrate-store-credit

📚 Documentation & Operator Guides

1. Manually Adjusting a Customer's Credit

  1. In the WordPress sidebar, go to WPCalibrate > Store Credit.
  2. Click Adjust Balance in the top quick-action toolbar, or switch to the Adjustments tab.
  3. Search for the customer by name, email, or user ID.
  4. Select the Adjustment Type:
    • Add Credit: Increases customer wallet balance.
    • Deduct Credit: Decreases customer wallet balance (overdraft-protected).
  5. Enter the Amount and a mandatory Audit Reason (e.g. "Customer loyalty reward" or "Goodwill gesture for delayed shipping").
  6. Click Apply Adjustment. The transaction is immediately committed to the immutable ledger.

2. Issuing a Refund to Store Credit

  1. Navigate to WooCommerce > Orders and open the target order.
  2. Click the native WooCommerce Refund button below the order items.
  3. Enter the quantities or refund amounts for the selected items.
  4. Check Refund to WPCalibrate Store Credit.
  5. Click Process Refund. The funds are credited to the customer's store wallet instantly, and the order status is updated.

3. Reconciling the Ledger & Monitoring Invariants

  1. Navigate to WPCalibrate > Store Credit > Overview.
  2. Review the Engine Health & Invariants card:
    • Double-Entry Balance Match: Verifies that the sum of all historical ledger transactions mathematically matches the materialized balance cache.
    • Overdraft Violation Count: Confirms that zero customer accounts hold a negative balance.
    • Idempotency Integrity: Confirms that duplicate transaction requests have been successfully suppressed.
  3. If any discrepancy is flagged, run the reconciliation tool under the Ledger tab to recalculate cached balances from authoritative ledger rows.

4. Configuring Expiration Lifespans

  1. Go to WPCalibrate > Store Credit > Settings.
  2. Under Credit Expiration, toggle Enable Expiration.
  3. Set the Expiration Lifespan (Days) (e.g. 365 days).
  4. Save Changes. Any newly issued credit will automatically carry an expiration date. Expired balances are deducted automatically by the daily Action Scheduler cron.

🧩 Developer Reference: Action & Filter Hooks

Action Hooks

Action Hook Parameters Description
wpcalibrate_store_credit_credited int $user_id, Money $amount, string $type, string $idempotency_key Fires immediately after a customer wallet is credited.
wpcalibrate_store_credit_debited int $user_id, Money $amount, string $type, ?int $order_id Fires immediately after a customer wallet is debited.
wpcalibrate_store_credit_order_restored int $order_id, int $user_id, Money $amount Fires when store credit tender is restored upon order cancellation.
wpcalibrate_store_credit_credits_expired int $count, int $total_scaled_units Fires after a batch of expired credits has been processed and deducted.

Filter Hooks

Filter Hook Parameters Description
wpcalibrate_store_credit_allowed_types array $types Filter the permitted transaction types in the ledger.
wpcalibrate_store_credit_max_cart_deduction Money $max_allowed, WC_Cart $cart, int $user_id Filter the maximum store credit amount permitted to be applied to a specific cart.
wpcalibrate_store_credit_is_order_eligible bool $eligible, WC_Order $order Filter whether an order is eligible for store credit payment tender.
wpcalibrate_store_credit_history_per_page int $per_page, int $user_id Filter the pagination limit on My Account transaction history.

🗄️ Database Architecture

To ensure optimal performance and complete financial auditability, WPCalibrate uses two custom database tables:

erDiagram
    WP_USERS ||--o| WP_WPCALIBRATE_STORE_CREDIT_BALANCES : holds
    WP_USERS ||--o{ WP_WPCALIBRATE_STORE_CREDIT_TRANSACTIONS : owns
    WP_WPCALIBRATE_STORE_CREDIT_BALANCES ||--o{ WP_WPCALIBRATE_STORE_CREDIT_TRANSACTIONS : reflects

    WP_WPCALIBRATE_STORE_CREDIT_BALANCES {
        bigint user_id PK
        decimal balance "DECIMAL(18,4)"
        char currency "3-char ISO"
        bigint last_transaction_id FK
        datetime updated_at
    }

    WP_WPCALIBRATE_STORE_CREDIT_TRANSACTIONS {
        bigint id PK
        bigint user_id FK
        varchar type "credit_adjustment | debit_purchase | refund_credit | expiration_debit"
        varchar direction "credit | debit"
        decimal amount "DECIMAL(18,4)"
        char currency "3-char ISO"
        decimal balance_after "DECIMAL(18,4)"
        bigint order_id FK
        bigint parent_transaction_id FK
        varchar idempotency_key UK
        text description
        datetime expires_at
        decimal unspent_amount "DECIMAL(18,4)"
        bigint created_by
        datetime created_at
        longtext metadata
    }

📝 Changelog

[1.0.2] - 2026-10-15

  • Added: Built-in GitHub Automated Dashboard Updater (GitHubUpdater) supporting 1-click updates from WordPress admin.
  • Added: Added Update URI, GitHub Plugin URI, and Primary Branch headers in main plugin file.
  • Fixed: Isolated WordPress admin notices on dashboard to protect layout integrity.
  • Enhanced: Asset versioning with dynamic filemtime() cache-busting.
  • Verified: Clean standalone package build (wpcalibrate-store-credit-1.0.2.zip) with zero development, secret, or AI files.

[1.0.1] - 2026-10-15

  • Fixed: Resolved activation fatal error (Undefined class constant 'TABLE_BALANCES') by defining explicit schema table constants in Schema.php.
  • Fixed: Guarded cron and endpoint registration functions (wp_next_scheduled, add_rewrite_endpoint, flush_rewrite_rules) against premature execution in sandbox.
  • Added: Authentic WPCalibrate branding icon integration across admin sidebar and dashboard header.
  • Added: Executive Quick-Action Toolbar and 2-column SaaS Overview layout.
  • Added: Interactive, collapsible technical guide accordion.

[1.0.0] - 2026-10-15

  • Initial production release.
  • Deterministic 10^4 integer scaling Money value object.
  • Immutable double-entry ledger and row-locked balance cache.
  • Dual checkout tender (Classic shortcode and WooCommerce Checkout Blocks).
  • Dedicated store credit payment gateway.
  • Automated order cancellation restoration and 1-click refund to store credit.
  • FIFO credit expiration scheduler.
  • Customer My Account wallet endpoint and transaction ledger view.

🔒 Security & Financial Integrity

  • Cryptographic Idempotency: All mutations accept an idempotency_key unique index; duplicate requests (e.g. double-clicking checkout buttons) return the original transaction without repeating debits or credits.
  • Concurrency Locks: High-traffic transactions use SELECT ... FOR UPDATE row locks inside database transactions to eliminate race conditions.
  • Overdraft Guard: Hardened checks ensure balances can never become negative.
  • Nonce & Capability Checks: All administrative adjustments and AJAX actions strictly enforce manage_woocommerce capability and verified WordPress nonces.

📄 License & Commercial Support

Releases

1 release. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
v1.0.2 latest
Oct 15, 2026 1mo ago
wpcalibrate-store-credit-1.0.2.zip
0