=== WCP Blockchain Authenticity Certificates ===
Contributors: woochainpro
Tags: authenticity, certificate, blockchain, provenance, nft
Requires at least: 6.3
Tested up to: 7.0
Requires PHP: 8.0
Requires Plugins: woocommerce
Stable tag: 7.4.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Let customers request a verifiable certificate of authenticity for their order, recorded permanently on a public blockchain.

== Description ==

Customers opt in at checkout, choose a network, connect a wallet, and receive a
certificate of authenticity for their purchase. The certificate is written to a
public blockchain, so it stays verifiable by anyone, forever, and does not
depend on your store — or this plugin — continuing to exist.

**How it works**

1. You connect a wallet and deploy a smart contract for your shop.
2. Customers see an optional certificate box at checkout.
3. When an order reaches the status you choose, a certificate is issued to the
   customer's wallet.

**Opt-in by design.** A customer who ignores the option checks out exactly as
before and is charged nothing extra.

**Permanent seller rights.** When your contract is created you choose whether
your shop may freeze, revoke, or force-transfer certificates. Those choices are
written into the contract permanently and are shown to every customer before
they agree. Most shops should choose none of them.

**Supported networks:** Optimism, Arbitrum, Solana.

= What this plugin sends to an external service =

This plugin is a client for the WooChain Pro platform, a paid third-party
service that performs the blockchain operations. **The plugin cannot work
without it.** You will need an account.

Data sent to the platform, and when:

* **When you connect your shop** — your shop domain, admin email address, and
  the wallet address you connect. You sign a message to prove you control the
  wallet; no private key is ever transmitted, and signing costs no gas.
* **When a customer opts in at checkout** — the wallet address they provide and
  the selected network, so the address can be validated before an order is
  placed.
* **When an order qualifies for a certificate** — the order number, the
  customer's wallet address, product names, SKUs, batch numbers and the product
  image URL. This is the information written into the certificate.
* **Periodically** — your subscription status, balance and contract state, so
  the dashboard and checkout can show whether certificates are currently
  available.

Customer names, billing and shipping addresses, email addresses, phone numbers
and payment details are **not** sent.

Service: WooChain Pro — https://woochainpro.com
Terms of service: https://woochainpro.com/terms
Privacy policy: https://woochainpro.com/privacy

= Costs =

Issuing a certificate costs blockchain network fees, plus a platform
commission. You pre-fund a USDC balance with the service and each certificate
draws from it. Separately, you decide what (if anything) to charge your own
customer at checkout — it can be more than your cost, the same, or zero.

= Third-party libraries =

* qr-scanner 1.4.2 by Nimiq (MIT) — reads a wallet address from a QR code.
  Bundled in `assets/vendor/qr-scanner/` with its original source and licence.
  Upstream: https://github.com/nimiq/qr-scanner
* qrcode-generator 1.4.4 by Kazuhiko Arase (MIT) — renders the payment QR code
  in the shop dashboard. Bundled in `assets/vendor/qrcode-generator/` as
  original unminified source.
  Upstream: https://github.com/kazuhikoarase/qrcode-generator

== Installation ==

1. Upload the plugin and activate it.
2. Go to **WCP → Settings** and enter your platform URL.
3. Go to **WCP → Dashboard** and connect your wallet.
4. Add credit, choose a plan, and deploy a contract.
5. Tick **Offer certificates at checkout** in Settings.

Full setup notes are under **WCP → Setup & Help** inside your admin.

== Frequently Asked Questions ==

= Do customers have to use this? =

No. It is entirely optional at checkout. Customers who skip it pay nothing
extra and check out normally.

= Can I change the seller rights later? =

No. They are written into the smart contract permanently when it is created —
that is what makes the promise shown to customers meaningful. To change them
you would deploy a new contract, which does not affect certificates already
issued.

= What happens if a customer enters the wrong wallet address? =

On Optimism and Arbitrum, addresses carry a checksum, so most typos are
detected and rejected before the order is placed. Solana addresses have no
checksum: a typo usually produces another valid-looking address, and a
certificate sent there cannot be recovered by anyone. Connecting a wallet is
always safer than pasting.

= Can one order produce two certificates? =

No. This is prevented in four independent places, including the smart contract
itself, so a retry, a network fault or a restored database backup cannot
produce a duplicate.

= What happens if I stop paying, or uninstall the plugin? =

Certificates already issued are unaffected — they live on the blockchain, not
on our servers or in your database. The checkout option simply stops appearing.

= Does this work with the block-based checkout? =

Yes, and with the classic shortcode checkout.

== Screenshots ==

1. The certificate option at checkout, with wallet connection and QR scanning.
2. The shop dashboard: balance, networks and contract status.
3. Choosing seller rights before deploying a contract.
4. Certificate details on a completed order.

== Changelog ==

= 7.4.2 =
* FIXED: the download button threw an error and did nothing.
* FIXED: the flattened source was missing most of its dependencies, so
  block explorers could not compile it.

= 7.4.1 =
* FIXED: the "Download all as .zip" button did nothing.
* FIXED: contracts on a test network were reported as not matching our
  template, and their explorer links pointed at the wrong network.

= 7.4.0 =
* The verification panel now shows the Standard JSON Input and the flattened
  source, each with a copy button, plus a download of the whole package.
* The block explorer link now goes to the test explorer for a contract on a
  test network, where its address actually exists.

= 7.3.0 =
* Renamed to WCP Blockchain Authenticity Certificates.
* The verification package now contains a Standard JSON Input file and a
  flattened source, so your contract can actually be verified on a block
  explorer. The plain source file never could.

= 7.2.1 =
* FIXED: a critical error on every admin page after updating.

= 7.2.0 =
* New guided setup that walks through connecting, verifying, funding and
  deploying, doing each step for you and pausing for your approval.
* The seller rights are still chosen by you: they are permanent, so nothing
  is pre-selected and the setup will not proceed until you decide.

= 7.1.0 =
* Certificates now show a QR code that opens the public verification page,
  so a buyer can check an item without typing a contract address.

= 7.0.1 =
* FIXED: the plugin could not be activated.

= 7.0.0 =
* Renamed to Blockchain Authenticity Certificates. Your settings, wallet
  connection and existing certificates carry over automatically.
* The plugin no longer contacts our servers until you have connected your
  shop. Activating it does nothing on its own.
* All internal names now carry a longer, unique prefix.
* Diagnostic logs moved into the uploads directory.
* The [wcp_badge] shortcode keeps working; new installs should use
  [bacert_badge].

= 6.3.0 =
* Sites that block automated requests — behind a firewall, bot protection or
  a JavaScript-rendered theme — are no longer paused by mistake. WordPress
  now reports when the badge has rendered on your front page.

= 6.2.0 =
* The badge is now recognised wherever your theme places it — a footer
  widget, a block template part, a sidebar. It no longer has to be inside a
  <footer> element.
* The badge carries a stable machine-readable marker, so detection no longer
  depends on theme markup, class names or wording.
* Pages are fetched with cache-busting, so a cached copy from before you
  added the badge cannot cause a false alarm.

= 6.1.0 =
* Your dashboard now tells you clearly if certificates have been paused
  because the badge is missing, with a button to re-check as soon as you
  have added it.

= 6.0.0 =
* First public release.
* "Check this independently" on the badge now opens a page showing the
  contract, its verification status and a link to the block explorer.
* Badge enforcement corrected: once we have confirmed the badge is missing
  from your site, the countdown starts from that moment.
* Removing the plugin now clears every setting, cache and credential it
  created. Certificates and order records are untouched.

= 5.9.2 =
* FIXED: shops that have connected more than one wallet could show a badge
  claiming they held no rights over certificates when they did.

= 5.9.1 =
* FIXED: after deploying a contract, the footer badge could keep showing the
  previous contract's rights.
* A suspended contract is now unsuspended immediately when the badge is
  restored, instead of waiting for the next hourly check.

= 5.9.0 =
* The guided tour now runs on the Dashboard, Settings and Help pages, each
  starting automatically the first time you open it.
* The badge check now detects a badge that is present but hidden or moved
  off-screen, and reports exactly what it found.

= 5.8.1 =
* FIXED: the "Show me around" button did nothing on the Settings page.
* The badge must now be in your footer and actually visible, not merely
  present in the page source.

= 5.8.0 =
* The badge now reports the rights your contract actually holds, read from
  the blockchain rather than from our records.
* The badge must appear on your homepage, not only on a page customers do
  not visit.
* The setup tour starts automatically the first time you open the dashboard
  and the settings page, and now covers status, checks and verification.
* The "Show me around" button is easier to find.

= 5.7.0 =
* FIXED: a critical error when changing the badge placement setting.
* The Settings page now has its own guided tour explaining every option.

= 5.6.1 =
* FIXED: the setup tour did not start, either on install or from the
  "Show me around" button.

= 5.6.0 =
* New guided setup tour for first-time installs, with a "Show me around"
  button to reopen it at any time.
* FIXED: the badge could keep showing old contract rights for up to 30
  minutes after deploying a new contract.
* Switching the badge to manual placement now checks your site straight away
  and tells you if the shortcode is missing.
* Exercising a right on a certificate is limited to once every 12 hours and
  charged at cost, since the platform pays the blockchain fee.

= 5.5.0 =
* Customers using a smart-account wallet are now warned at checkout that it
  cannot receive a certificate, instead of the order failing afterwards.

= 5.4.0 =
* The security badge can now be placed manually with the [bacert_badge] shortcode
  instead of appearing automatically in the footer. Settings has the option.
* Added a full guide to the badge on the Help page.
* Email verification is now separate from website verification, and the
  address must be on your own verified domain.

= 5.3.1 =
* The security badge now displays even when the platform is briefly
  unreachable, and lists the specific rights in the compact style.

= 5.3.0 =
* New security badge showing customers exactly what powers your shop holds
  over the certificates it issues, and confirming your contract matches the
  published template. Displayed in the footer automatically, or place it
  yourself with the [bacert_badge] shortcode.

= 5.2.1 =
* FIXED: a fatal error on the dashboard when the platform could not be
  reached. The page now degrades one section at a time instead of failing
  entirely.

= 5.2.0 =
* The plugin now shows a clear notice if a critical update is required, rather
  than failing with an unexplained error.

= 5.1.0 =
* Every product image on a certificate is now stored permanently rather than
  linked from the shop, so a certificate cannot break because a shop
  reorganised its media library.
* Production release.

= 5.0.1 =
* Certificates for orders with more than one product now list every product
  with its own image and quantity. Previously the whole order was flattened
  into a single entry, so the certificate misdescribed what was bought.

= 5.0.0 =
* Subscriptions can no longer be bought while one is active. Renewing near
  expiry now adds the new period on top of the days you have already paid for
  instead of discarding them.
* Certificate status reflects your balance and subscription rather than a
  fixed monthly count, so a funded shop is never shown as not ready.
* Solana top-ups now work from the browser and from a phone wallet using
  Solana Pay, with Solflare and Phantom detected automatically.
* The QR panel no longer stretches the page on smaller screens.
* Security pass: every endpoint rate limited, output escaping tightened, and
  nosniff headers added to file downloads.

= 4.9.0 =
* Fixed the Additional information list overflowing on the order confirmation
  page. The previous fix targeted tables; that page renders a definition list.
* Deposits made on payment-only networks are now credited automatically. The
  scanner had only ever checked the networks certificates are minted on.

= 4.8.1 =
* Fixed long wallet addresses and the rights notice overflowing the Additional
  information table on the order screen and on small screens.

= 4.8.0 =
* FIXED: Freeze, Unfreeze and Destroy did nothing when clicked. The buttons had
  no handler, so nothing was ever sent and the certificate stayed unchanged
  on-chain while appearing to have been actioned.
* FIXED: Subscribe, Use-this-code, Copy, Send-verification-email and
  Test-connection were also inert after an earlier refactor.
* FIXED: "Pay from a browser wallet" reported no USDC contract for networks
  that were correctly configured.
* Removed the pre-filled payment-link QR code. Several wallets ignored the
  network it specified and opened on Ethereum mainnet, risking funds sent to a
  network we do not watch. The plain-address code, which every wallet reads
  correctly, is now the only one offered.
* Certificate limits on paid plans are now based on your balance rather than a
  fixed monthly count, so a funded shop is never blocked mid-period.
* Fixed the Additional information table overflowing on order pages.

= 4.7.1 =
* Fixed the top-up section showing no payment methods even when all three were
  enabled on the platform.

= 4.7.0 =
* One network selector now drives all three payment methods, populated live
  from the platform. Previously the wallet-payment list showed only the
  networks certificates are minted on, ignoring the ones enabled for payment.
* A wallet that does not recognise a network is now offered the details to add
  it, instead of failing with "Unrecognized chain ID".
* "Check now" and "Verification package" did nothing when clicked — the
  buttons and endpoints existed but the listeners were missing.
* Certificate failures now explain the cause instead of reporting a bare
  reverted transaction.
* Deposit failures name which assumption failed, including the case where the
  money arrived from a token contract we are not configured to accept.

= 4.6.0 =
* Orders where the customer requested a certificate but the order was not
  flagged for minting are now repaired automatically from the checkout fields,
  and issued. Previously they were silently skipped.
* Added a Retry button on the order screen, and a bulk "Retry blockchain
  certificate" action on the orders list.
* Certificate details now appear as a column in the customer's Orders table,
  and the order page shows every identifier in full with explorer links.
* Fixed a case where a certificate flag could be downgraded after it had been
  correctly set, cancelling a certificate the customer had paid for.

= 4.5.0 =
* CRITICAL: orders placed on the block-based checkout were not being minted.
  The certificate details were recorded in the session but never written to the
  order, so the status-change trigger found nothing to send. Orders placed on
  the classic checkout were unaffected.
* Certificate details now appear on the customer's order page, the thank-you
  page and order emails. They were only ever registered in wp-admin.
* Payment QR now shows a plain-address code by default, which every wallet can
  scan, with the pre-filled payment link as a labelled second option.
* Top-up polling backs off instead of hammering the platform, so a confirmation
  no longer stalls behind a rate limit.
* Deposit addresses and copy buttons no longer overflow on desktop.
* Commission shown on the Help page is read live rather than assumed.

= 4.4.0 =
* Payment methods and networks are now controlled by the platform, so the ones
  offered can change without a plugin update.
* Verification email address is editable (the part before the @); instant
  HTTP verification remains the default and needs no mailbox.
* Fixed the QR panel, deposit addresses and copy buttons overflowing the page
  on phones.
* Commission is read live rather than fixed at deploy time.

= 4.3.0 =
* FIXED: ticking the certificate box at checkout could lock up the browser.
  A DOM observer reacted to the plugin's own output and re-entered itself.
* The certificate selection now resets on every fresh load of the checkout
  page, so a returning customer never finds a fee they do not remember adding.
* Pay a top-up by scanning a QR code: choose a network, choose an amount, scan.
  The network, token, destination and amount are all encoded, which removes the
  two mistakes that make a deposit unrecoverable.
* The transaction-hash box now asks which network you sent on, and finds the
  transaction for you if you pick the wrong one.
* Contract source is shown in a copyable box instead of a download link that
  could expire.

= 4.2.0 =
* Renamed for the plugin directory; the service is unchanged.
* Domain verification now works over HTTP instead of email — one click, no
  admin@ mailbox required.
* Contract source download fixed (it required a header a browser link could
  not send).
* Seller rights are now chosen per network rather than locked shop-wide.
* Added a Checkout status panel showing exactly why the option is or is not
  visible to customers.
* Subscription plans, per-plan promotional pricing and coupon redemption.
* Platform announcement banner in the dashboard.
* Setup & Help page with support contact.
* Contract verification package: compiler settings, flattened source and
  ABI-encoded constructor arguments for block explorer verification.
* Choose which contract new orders use when you hold more than one.
* Certificates now record every product in a multi-item order.
* Replaced the CDN-hosted QR library with a locally bundled MIT-licensed one.

= 4.1.0 =
* Server-authoritative checkout state: the certificate fee and the mint flag
  are derived from the same server-side value and cannot disagree.
* Wallet addresses validated by the platform before an order can be placed.
* Three ways to supply a wallet: connect, scan or upload a QR code, or paste.
* Fixed order-status settings not persisting.

= 4.0.0 =
* SECURITY: removed AJAX handlers that allowed logged-out visitors to overwrite
  shop credentials.
* SECURITY: debug logs moved out of the web-readable uploads directory and
  credentials redacted.
* SECURITY: wallet connection now requires a signed challenge.
* Multi-chain support: Optimism, Arbitrum and Solana.

== Upgrade Notice ==

= 4.0.0 =
Security release. Delete wp-content/uploads/wcbm-debug.log and reconnect your
wallet to rotate credentials. See UPGRADING.md.
