Simple Store Credit

How can we help?

Search the documentation or ask the AI agent anything about the plugin.

Data storage and database tables

Updated September 14, 2026

Store credit data lives in four places: user meta for balances, a custom table for the activity log, WooCommerce coupons for vouchers, and a single WordPress option for every setting.

User meta

  • _sscp_balance – the customer’s account balance, in the base currency, rounded to four decimal places.
  • _sscp_cashback_debt – credit that was clawed back but could not be recovered from the balance. Netted off the next credit the customer receives.
  • _sscp_migrated_add_<plugin> – a marker that a customer’s balance was already imported from a given source in add mode.

The activity log table

Every movement is written to {prefix}sscp_log, which is what makes history pagination and reporting efficient. Its columns are:

id             BIGINT   auto increment
user_id        BIGINT
amount         DECIMAL(20,4)   signed: positive credits, negative debits
balance_after  DECIMAL(20,4)
type           VARCHAR(40)     earn, topup, giftcard, refund, admin, spend,
                               voucher_spend, voucher_convert, voucher_create,
                               gift, reverse, expire, migration, reconcile
note           VARCHAR(255)
reference      VARCHAR(100)
order_id       BIGINT
voucher_id     BIGINT
created_at     DATETIME

The PRO credit expiry feature adds a second table, {prefix}sscp_credit_lots, holding each individual credit with its own expiry date. That is what allows the soonest-to-expire credit to be spent first.

Vouchers

Vouchers are shop_coupon posts with a set of identifying meta keys: _sscp_credit_voucher, _sscp_user_id, _sscp_initial_amount, _sscp_currency, _sscp_source, _sscp_note, _sscp_order_id and _sscp_status. The remaining balance is the coupon’s own amount.

Order meta

Orders carry meta recording what credit they used or generated, including _sscp_credit_redeemed, _sscp_voucher_coupons_used, _sscp_credit_earned, _sscp_topup_credited, _sscp_refunded_to_credit and _sscp_paid_with_credit, alongside matching flags that mark an action as already processed. Those flags are what make the capture, reversal and restore paths safe to run more than once.

Options

All settings are held in one option, sscp_options. The plugin also stores sscp_db_version, the generated product IDs for top-ups and gifts, and the payment gateway’s own WooCommerce settings entry.

Concurrency

Balance changes are serialised with named MySQL advisory locks, so two simultaneous requests for the same customer cannot both read the old figure and lose one another’s write. On a host without GET_LOCK support the plugin degrades to unlocked updates rather than failing.

Scheduled work

  • A daily expiry check, for the PRO expiry feature.
  • A per-order credit hold release, which cancels an order that has sat unpaid while holding a customer’s credit – after 7 days by default.
  • Action Scheduler jobs in the sscp group for expiry sweeps and backfills.

What uninstalling removes

Deleting the plugin drops both custom tables, removes the options and transients, deletes the balance and debt user meta, and clears the scheduled events. Vouchers are ordinary coupons and are left in place, as is the order meta. Deactivating the plugin removes nothing – only a full delete runs the cleanup, so take a backup first if the data matters.

Related

Was this article helpful?