/*
Plugin: Crypto QR Pay (Complete rewrite per user request)
Structure (single-file bundle for easy install):
- crypto-qr-pay.php (this file) contains all code sections separated by comments
Instructions: save this file as wp-content/plugins/crypto-qr-pay/crypto-qr-pay.php and create folders:
- wp-content/plugins/crypto-qr-pay/assets/js/checkout.js (content provided below)
- wp-content/plugins/crypto-qr-pay/assets/css/style.css (content provided below)
Activate plugin in WP admin. Then go to WooCommerce -> Crypto QR Pay to configure ETH wallet (backend wallet), USDT contract, Etherscan API key, store logo/title/description/support url.
------ MAIN PLUGIN (this file defines constants and includes) ------
------ assets/js/checkout.js (place in assets/js/checkout.js) ------
// content for assets/js/checkout.js
jQuery(function($){
// Only run on order-pay page which includes #cryptoqr_checkout
if (!$('#cryptoqr_checkout').length) return;
// get order id from URL
const m = location.href.match(/order-pay\/(\d+)/);
if (!m || !m[1]) return;
const orderId = m[1];
const payUrl = location.href;
// show logo/title/desc from cryptoqr_vars
if (cryptoqr_vars.logo) {
const img = '';
$('#cryptoqr_checkout .cryptoqr-header').remove();
$('#cryptoqr_checkout').prepend('
');
$('#cryptoqr_support').on('click', function(){ window.open(cryptoqr_vars.support_link || '#','_blank'); });
$('#cryptoqr_manual_submit').on('click', function(){
const tx = $('#cryptoqr_manual_tx').val().trim();
if(!tx){ alert('请输入 tx'); return; }
$.post(cryptoqr_vars.ajax_url, { action:'cryptoqr_verify_hash', order_id:orderId, tx_hash:tx }, function(r){
if(!r || !r.success){ alert('提交失败'); return; }
alert('已提交,稍后系统会继续检查');
});
});
}
},5000);
});
});
------ assets/css/style.css (place in assets/css/style.css) ------
.cryptoqr-logo{ max-height:34px; vertical-align:middle; margin-right:8px; }
.cryptoqr-header{ display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.cryptoqr-big-logo{ max-height:64px; margin-right:12px; }
/* minimal layout */
#cryptoqr_qr_area img{ border:1px solid #ddd; padding:6px; background:#fff; }
End of bundle. Follow the installation instructions at top to place files and activate.
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/sbeuxy.top/wp-content/plugins/crypto-qr-pay/crypto-qr-pay.php:253) in /www/wwwroot/sbeuxy.top/wp-includes/pluggable.php on line 1531
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/sbeuxy.top/wp-content/plugins/crypto-qr-pay/crypto-qr-pay.php:253) in /www/wwwroot/sbeuxy.top/wp-includes/pluggable.php on line 1534