外掛標籤
開發者團隊
原文外掛簡介
VoucherCart is the voucher and gift card sales engine for your business. This plugin connects your WooCommerce store to your VoucherCart account, so vouchers sold through VoucherCart can be redeemed directly at your WooCommerce checkout.
Features
Vouchers issued by VoucherCart are created automatically as WooCommerce coupons in your store.
Coupon codes, expiry dates and redemption status stay in sync with VoucherCart.
Redemptions at your WooCommerce checkout are reported back to VoucherCart, including partial redemptions and refunds when orders change.
Simple connection management from the Plugins screen — copy your site URL and API secret into VoucherCart and you’re done.
Requirements
WordPress 6.5 or newer, and WooCommerce (declared as a required plugin dependency).
PHP 8.1 or newer.
A VoucherCart account.
How it works
Communication between VoucherCart and your store happens over the WordPress REST API. Every request is authenticated with an HMAC-SHA256 signature using the API secret generated for your site, so only VoucherCart can create or modify vouchers in your store.
Source code
This plugin is not compiled except for one admin stylesheet and one admin script. Everything else runs exactly as it is written.
The PHP under app/ is the plugin itself. It has no third-party runtime dependencies, so there is no bundled library and no vendor directory.
The minified admin assets in dist/assets/ are built from the human-readable TypeScript and CSS in src/admin/, which is included in this plugin package. Each built file also carries a comment pointing back here.
Build tools
The build is a stock Vite setup; the whole configuration is in vite.config.ts, shipped with the plugin. To reproduce dist/ from src/, run the following in the plugin directory:
bun install && bun run build
npm install && npm run build works identically if you prefer npm. Both read `package.json` and `tsconfig.json`, which are also included in this package. The build output is content-hashed, so filenames in `dist/assets/` change whenever the source changes.
External services
This plugin connects your store to VoucherCart, the voucher and gift card platform at vouchercart.com. The integration is the entire purpose of the plugin: without a VoucherCart account it does nothing. Traffic flows in both directions, and in both directions every request is signed with an HMAC-SHA256 signature derived from the API secret that this plugin generates for your site.
What this plugin sends to VoucherCart
The plugin contacts https://api.vouchercart.com/ in exactly two situations, and never on a page view by one of your visitors:
When a VoucherCart coupon is applied to an order, or an order carrying one is placed or completed, the plugin reports the redemption. It transmits the VoucherCart reference of the voucher and the discount amount that the order actually took.
When that coupon is removed from the order, or the order is cancelled, the plugin cancels the redemption it previously reported. It transmits the identifier VoucherCart returned for that redemption.
Both requests also carry the client identifier VoucherCart issued to your site, a timestamp and the signature. No customer details, no order contents, and no other store data leave your site.
What VoucherCart sends to this plugin
VoucherCart calls your site’s REST API under /wp-json/vouchercart/v1/ to keep the store side in step: creating a WooCommerce coupon for a voucher it has issued, changing that coupon’s code, expiry date or remaining value, deleting it, or removing it from orders that already used it. These requests are only accepted when they carry a valid signature.
You choose when this starts: nothing is transmitted until you copy your site URL and API secret into your VoucherCart account, and deactivating the plugin ends it.
Your use of the service is governed by VoucherCart’s privacy policy and by the terms of the VoucherCart account agreement you enter into when you register.
