WPKJ Payment Gateway for FluentCart with Wechat

Plugin Banner

WPKJ Payment Gateway for FluentCart with Wechat

by cmhello

Download
Description

WPKJ Payment Gateway for FluentCart with Wechat is an enterprise-grade payment gateway that seamlessly integrates WeChat Pay with FluentCart. It intelligently detects user environments and automatically selects the optimal payment interface.

Key Features

  • Multi-Platform Payment Support
    – Native Payment for PC desktop with QR codes
    – H5 Payment for mobile browsers
    – JSAPI Payment for WeChat in-app browsers [Not yet completed]
    – Intelligent client detection

  • Subscription Management
    – Manual renewal mode for subscription payments
    – Trial period support (0-365 days)
    – Flexible billing intervals (daily, weekly, monthly, yearly)
    – Subscription cancellation sync with orders (configurable)
    – Automatic status tracking

  • Comprehensive Refund System
    – Automatic refunds when orders are cancelled
    – Manual refund processing from admin [Not yet completed]
    – Full and partial refund support [Not yet completed]
    – Requires SSL certificates
    – Detailed activity logging

  • Enterprise Security
    – Dual signature support (MD5 and HMAC-SHA256)
    – Signature verification for all requests
    – SSL/HTTPS required
    – Webhook validation
    – Amount verification
    – Secure API communication

  • Developer Friendly
    – Clean PSR-4 autoloading architecture
    – Comprehensive hooks and filters
    – Debug logging support
    – Payment status polling
    – Extensive documentation

Important Notes

WeChat Pay does NOT provide a public sandbox environment. Testing must be done in production with small amounts (e.g., ¥0.01).

WeChat Pay does NOT support automatic recurring payments. Each subscription renewal requires manual customer payment.

Supported Payment Methods

  • Native Payment (PC QR Code)
  • H5 Payment (Mobile)
  • JSAPI Payment (WeChat Browser) [Not yet completed]

Requirements

  • FluentCart 1.2.0 or higher
  • WordPress 6.5 or higher
  • PHP 8.2 or higher
  • SSL Certificate (HTTPS) required
  • WeChat Pay merchant account

Architecture

Built on the proven architecture of WPKJ FluentCart Alipay Payment plugin with 65%+ code reusability, ensuring reliability and maintainability.

Support and Documentation

For comprehensive documentation, tutorials, and support:

Privacy and Data

This plugin does NOT:
– Collect any user data
– Send data to third parties (except WeChat Pay for payment processing)
– Track users
– Store sensitive payment information

Payment data is transmitted securely via HTTPS directly to WeChat Pay’s servers. The plugin only stores transaction IDs and order metadata necessary for order fulfillment.

External Services

This plugin relies on external services for payment processing. Below is documentation for each external service:

Wechat Payment Gateway

Service: Wechat Payment Gateway API
What it is: Official payment processing service operated by Wechat Pay, a third-party payment service from China.
What it’s used for: Process online payments from customers using Wechat accounts
Data sent: Order ID, order amount, customer email, payment description/subject, currency, and timeout configuration
When it’s sent: When a customer initiates a payment and selects Wechat as the payment method
Data sent to: Wechat Pay servers (https://api.mch.weixin.qq.com)
WeChat Pay Service Terms: https://pay.weixin.qq.com/static/protocol/protocol_normal_v3.shtml
WeChat Pay Privacy Policy: https://pay.weixin.qq.com/static/protocol/protocol_normal_v3.shtml
Additional Info: Communication is RSA2 2048-bit encrypted. Wechat Pay returns trade status, transaction ID, and buyer information.

User Consent

Users are informed about Wechat payment processing when they select Wechat as their payment method. They accept data transmission to Wechat’s services as part of the payment process. The Wechat Pay terms and privacy policy are accessible via links above.

Credits

  • Developed by: WPDAXUE.COM
  • Framework: FluentCart Payment Gateway API
  • Contributors: WordPress community
  • Special Thanks: FluentCart team for excellent payment framework, and Wechat Pay for their robust payment solution

Automatic Installation

  1. Log in to your WordPress admin panel
  2. Navigate to Plugins > Add New
  3. Search for “WPKJ Payment Gateway for FluentCart with Wechat”
  4. Click “Install Now” and then “Activate”
  5. Go to FluentCart > Settings > Payment Methods
  6. Configure your WeChat Pay credentials

Manual Installation

  1. Download the plugin ZIP file
  2. Upload to /wp-content/plugins/wpkj-payment-gateway-for-fluentcart-with-wechat/
  3. Activate through the ‘Plugins’ menu in WordPress
  4. Navigate to FluentCart > Settings > Payment Methods
  5. Configure WeChat Pay gateway settings
  6. Enable the payment method

Configuration Steps

  1. Obtain Credentials from WeChat Pay:
    – Register at WeChat Pay Merchant Platform
    – Complete merchant verification
    – Get App ID (starts with “wx”)
    – Get Merchant ID (10 digits)
    – Generate 32-character API Key
    – Optional: Get App Secret (for JSAPI)

  2. Download SSL Certificates (For Refunds):
    – Login to WeChat Pay merchant platform
    – Download SSL certificates
    – Upload apiclient_cert.pem and apiclient_key.pem to server
    – Enter file paths in plugin settings

  3. Configure Plugin Settings:
    – Enter App ID, Merchant ID, and API Key
    – Optional: Enter App Secret for JSAPI
    – Select signature type (HMAC-SHA256 recommended)
    – Configure SSL certificate paths for refunds
    – Enable/disable auto-refund
    – Enable/disable JSAPI payment

  4. Configure Webhook:
    – Copy Notify URL from plugin settings
    – Add to WeChat Pay merchant dashboard
    – Save configuration

  5. Test Your Setup:
    – Use production environment with ¥0.01
    – Make a test purchase
    – Verify webhook notifications
    – Test refund functionality

  1. WPKJ WeChat Pay Gateway in FluentCart payment list

    WPKJ WeChat Pay Gateway in FluentCart payment list

  2. WeChat Pay payment gateway settings page

    WeChat Pay payment gateway settings page

  3. Payment method selection during checkout

    Payment method selection during checkout

  4. Native payment QR code page for desktop

    Native payment QR code page for desktop

  5. Payment receipt

    Payment receipt

Where do I get WeChat Pay credentials?

Register for a merchant account at WeChat Pay Merchant Platform. After verification, you’ll receive App ID, Merchant ID, and can generate an API Key.

Does this plugin support subscription payments?

Yes! The plugin supports FluentCart subscriptions with manual renewal mode. Each renewal requires the customer to manually complete payment, as WeChat Pay does not support automatic recurring charges.

Can I test before going live?

WeChat Pay does not provide a public sandbox. You must test in production using small amounts (¥0.01 is recommended for testing).

How do refunds work?

Refunds require SSL certificates from WeChat Pay merchant platform. Once configured:
1. Automatic – Enable auto-refund, cancelling orders triggers instant refunds
2. Manual – Process refunds from FluentCart admin panel

Both full and partial refunds are supported.

Is the plugin translation ready?

Yes, the plugin is fully internationalized with a POT file included. Chinese and English translations are built-in.

What happens if webhook notifications fail?

The plugin includes a payment status checker that polls WeChat Pay for payment confirmation if webhooks fail, ensuring reliable payment processing.

How does Native payment work?

On PC desktop, the plugin generates a QR code. Customers scan with their WeChat app to complete payment. The page automatically updates when payment is confirmed.

How does H5 payment work?

On mobile devices, customers are redirected to WeChat Pay’s mobile interface to complete payment, then returned to your site.

What is JSAPI payment?

JSAPI is for payments within the WeChat browser. It provides a native WeChat Pay experience without leaving the app. Requires App Secret configuration.

Do I need SSL certificates?

Yes, SSL/HTTPS is required for all production payments. Additionally, refund functionality requires SSL certificates downloaded from WeChat Pay merchant platform.

1.0.6

Release Date: December 19, 2025

  • Fixed: Resolved “Using $this when not in object context” error in validateSettings() static method
  • Fixed: Replaced undefined Logger::debug() calls with Logger::info() method
  • Fixed: Added phpcs ignore comments for WordPress HTTP API curl configuration (valid usage in http_api_curl hook)
  • Enhancement: Improved PHP 8.0+ compatibility by removing deprecated curl_close() function
  • Enhancement: Replaced direct cURL usage with WordPress HTTP API (wp_remote_post) while maintaining SSL client certificate support
  • Security: Added comprehensive input sanitization for all $_SERVER variables using sanitize_text_field()
  • Security: Removed third-party QR code API dependency, now using local QRCode.js library exclusively
  • Compliance: Fixed file path handling to use absolute paths without ABSPATH concatenation
  • Compliance: Updated all code to meet WordPress.org plugin review standards
  • Tested: Confirmed compatibility with WordPress 6.9
  • Maintenance: Regenerated translation template (POT file) with latest strings

1.0.5

Release Date: December 4, 2025

  • Fixed: Corrected non-standard parameter name in payment status check requests (nonce field renamed to wpkj_wechat_pay_nonce)
  • Fixed: Unified translator comments for ‘SSL certificate file not found’ message to ensure translation consistency
  • Refactor: Renamed plugin directory from ‘wpkj-wechat-pay-gateway-for-fluentcart’ to ‘wpkj-payment-gateway-for-fluentcart-with-wechat’ for better clarity
  • Refactor: Updated text domain from ‘wpkj-wechat-pay-gateway-for-fluentcart’ to ‘wpkj-payment-gateway-for-fluentcart-with-wechat’ across all files
  • Refactor: Renamed main plugin file to ‘wpkj-payment-gateway-for-fluentcart-with-wechat.php’
  • Enhancement: Updated all plugin URIs and documentation links to reflect new naming convention
  • Maintenance: Regenerated POT file with latest translatable strings
  • Note: All functionality remains unchanged; this is primarily a maintenance and standardization release

1.0.4

Release Date: November 24, 2025

  • Fixed: Removed manual load_plugin_textdomain() call as WordPress 4.6+ automatically loads translations from WordPress.org
  • Fixed: Replaced deprecated libxml_disable_entity_loader() with LIBXML_NONET flag for XML parsing security
  • Enhancement: Improved PHP 8.0+ compatibility by removing deprecated functions
  • Compliance: Resolved WordPress.org plugin review issues for better plugin directory standards

1.0.3

Release Date: November 13, 2025

  • Refactor: Renamed plugin to ‘WPKJ WeChat Pay Gateway for FluentCart’ for better brand clarity
  • Refactor: Updated plugin directory from ‘wpkj-fluentcart-wechat-payment’ to ‘wpkj-wechat-pay-gateway-for-fluentcart’
  • Refactor: Updated text domain from ‘wpkj-fluentcart-wechat-payment’ to ‘wpkj-wechat-pay-gateway-for-fluentcart’ across 170+ code references
  • Refactor: Renamed main plugin file from ‘wpkj-fluentcart-wechat-payment.php’ to ‘wpkj-wechat-pay-gateway-for-fluentcart.php’
  • Enhancement: Added comprehensive third-party services section documenting WeChat Pay integration
  • Documentation: Updated all plugin URIs and documentation links to reflect new naming convention
  • Documentation: Improved plugin metadata and header information clarity
  • Maintenance: Synced GitHub repository name to ‘wpkj-wechat-pay-gateway-for-fluentcart’
  • Note: All historical commit records preserved; functionality remains unchanged

1.0.2

Release Date: October 23, 2025

  • New: Added Custom Payment API for external system integration
  • New: REST API endpoints for programmatically creating payment orders
  • New: Support for one-time and subscription payments via API
  • New: Payment status query API endpoint
  • New: Comprehensive API documentation with usage examples
  • Enhancement: Customizable permission checks for API access
  • Enhancement: Detailed logging for custom payment operations
  • Documentation: Added CUSTOM_PAYMENT_USAGE.md with complete API guide
  • Documentation: All documentation moved to docs/ directory for better organization
  • Documentation: README.md retained in root for GitHub, readme.txt for WordPress.org
  • Security: All exception messages properly escaped with phpcs annotations

1.0.1

Release Date: October 23, 2025

  • Added: TransactionHelper utility class for idempotency protection
  • Added: WechatSubscriptions module for subscription lifecycle management
  • Added: Professional subscription status synchronization from WeChat
  • Added: Subscription reactivation support
  • Security: Enhanced duplicate refund prevention mechanism in automatic refund feature
  • Security: Now checks ALL existing refunds instead of just first one to prevent duplicates
  • Security: Added comprehensive logging for refund duplicate prevention
  • Security: Validates original transaction UUID match before blocking duplicate refunds
  • Refactoring: Migrated to FluentCart standard Refund service for all refund operations
  • Refactoring: Added WechatGateway processRefund() method using FluentCart standard interface
  • Refactoring: Simplified RefundProcessor to use FluentCart’s transaction/order management (~70% code reduction)
  • Improved: FluentCart now handles all transaction creation, order updates, and event triggering
  • Improved: Better separation of concerns – Gateway handles payment API, FluentCart handles business logic
  • Improved: Code maintainability with DRY principle – single source of truth for refund logic
  • Improved: Architecture now consistent with Alipay payment plugin
  • Improved: Separation of payment processing and subscription management
  • Improved: Exception message security with esc_html() escaping
  • Improved: Code architecture following single responsibility principle
  • Improved: Automatic refund now includes detailed security check logs
  • Fixed: WordPress coding standards compliance
  • Note: Duplicate refund prevention protects against concurrent order cancellation operations
  • Fixed: Translator comments for all placeholder strings
  • Security: Enhanced XSS protection for all output
  • Performance: Optimized transaction lookup and duplicate detection

1.0.0

Release Date: October 22, 2025

  • Initial release
  • Added: Multi-platform payment support (Native, H5, JSAPI)
  • Added: Automatic client detection
  • Added: Subscription payment support with manual renewal
  • Added: Automatic and manual refund functionality
  • Added: Configurable subscription cancellation sync with orders
  • Added: Dual signature support (MD5 and HMAC-SHA256)
  • Added: SSL certificate integration for secure refunds
  • Added: Payment status polling as webhook fallback
  • Added: Comprehensive webhook handling
  • Added: Full internationalization (i18n) support
  • Added: Complete translation files (POT + Chinese)
  • Added: Detailed logging and debugging capabilities
  • Added: Clean PSR-4 autoloading architecture
  • Added: Extensive hooks and filters for customization
  • Tested: WordPress 6.8.3 compatibility
  • Tested: FluentCart 1.2.0+ compatibility
  • Tested: PHP 8.2+ compatibility
Back to top