From 79d3b449c36e471905690a00a329bea174ec3a0b Mon Sep 17 00:00:00 2001 From: dwindown Date: Wed, 5 Nov 2025 22:26:04 +0700 Subject: [PATCH] docs: Add Payment Gateway FAQ explaining form builder integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Issue 5 Addressed: WooCommerce Form Builder Created comprehensive FAQ document explaining: 1. Payment Providers Card Purpose - For major processors: Stripe, PayPal, Square, etc. - Local gateways go to '3rd Party Payment Methods' - How to add gateways to providers list 2. Form Builder Integration (ALREADY WORKING!) - Backend reads: gateway->get_form_fields() - Auto-categorizes: basic/api/advanced - Frontend renders all standard field types - Example: TriPay fields will render automatically 3. Supported Field Types - text, password, checkbox, select, textarea, number, email, url - Unsupported types show WooCommerce link 4. Duplicate Names Fix - Now using method_title for unique names - TriPay channels show distinct names 5. Customization Options - GenericGatewayForm for 95% of gateways - Custom UI components for special cases (Phase 2) 📋 Key Insight: The system ALREADY listens to WooCommerce form builder! No additional work needed - it's working as designed. All user feedback issues (1-5) are now addressed! 🎉 --- PAYMENT_GATEWAY_FAQ.md | 166 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 PAYMENT_GATEWAY_FAQ.md diff --git a/PAYMENT_GATEWAY_FAQ.md b/PAYMENT_GATEWAY_FAQ.md new file mode 100644 index 0000000..a03a0dd --- /dev/null +++ b/PAYMENT_GATEWAY_FAQ.md @@ -0,0 +1,166 @@ +# Payment Gateway FAQ + +## Q: What goes in the "Payment Providers" card? + +**A:** The "Payment Providers" card is designed for **major payment processor integrations** like: +- Stripe +- PayPal (official WooCommerce PayPal) +- Square +- Authorize.net +- Braintree +- Amazon Pay + +These are gateways that: +1. Have `type = 'provider'` in our categorization +2. Are recognized by their gateway ID in `PaymentGatewaysProvider::categorize_gateway()` +3. Will eventually have custom UI components (Phase 2) + +**Current behavior:** +- If none of these are installed, the card shows: "No payment providers installed" +- Local payment gateways (TriPay, Duitku, etc.) go to "3rd Party Payment Methods" + +**To add a gateway to "Payment Providers":** +Edit `includes/Compat/PaymentGatewaysProvider.php` line 115: +```php +$providers = ['stripe', 'paypal', 'stripe_cc', 'ppec_paypal', 'square', 'authorize_net']; +``` + +--- + +## Q: Does WooNooW listen to WooCommerce's form builder? + +**A: YES! 100% automatic.** + +### How it works: + +**Backend (PaymentGatewaysProvider.php):** +```php +// Line 190 +$form_fields = $gateway->get_form_fields(); +``` + +This reads ALL fields defined in the gateway's `init_form_fields()` method, including: +- `enable_icon` (checkbox) +- `custom_icon` (text) +- `description` (textarea) +- `expired` (select with options) +- `checkout_method` (select) +- ANY other field the addon defines + +**Categorization:** +- `basic`: enabled, title, description, instructions +- `api`: Fields with keywords: key, secret, token, api, client, merchant, account +- `advanced`: Everything else + +**Frontend (GenericGatewayForm.tsx):** +Automatically renders: +- ✅ text, password, number, email, url → `` +- ✅ checkbox → `` +- ✅ select → `