build-docx.py
330 lines
| 1 | #!/usr/bin/env python3 |
| 2 | """Build payment-gateway-field.docx from documentation content.""" |
| 3 | from docx import Document |
| 4 | from docx.enum.text import WD_ALIGN_PARAGRAPH |
| 5 | from pathlib import Path |
| 6 | |
| 7 | OUT = Path(__file__).parent / "payment-gateway-field.docx" |
| 8 | |
| 9 | doc = Document() |
| 10 | |
| 11 | doc.add_heading("Payment Gateway Field", 0) |
| 12 | |
| 13 | meta = doc.add_paragraph() |
| 14 | meta.add_run("Category: Payment Gateways\n").italic = True |
| 15 | meta.add_run("Plugin: Everest Forms Pro\n").italic = True |
| 16 | meta.add_run("Since: 1.9.15\n").italic = True |
| 17 | meta.add_run("Publish URL: https://docs.everestforms.net/docs/payment-gateway-field/\n").italic = True |
| 18 | |
| 19 | doc.add_paragraph( |
| 20 | "The Payment Gateway field lets visitors choose how they pay on a single form—Stripe, PayPal, Square, " |
| 21 | "Authorize.Net, Mollie, or Razorpay—without building separate forms or wiring Conditional Logic between " |
| 22 | "payment methods." |
| 23 | ) |
| 24 | doc.add_paragraph( |
| 25 | "This replaces the older workflow where you added a Multiple Choice field and used Conditional Logic on the " |
| 26 | "Payments tab and Credit Card field. With the Payment Gateway field, one drag-and-drop field handles gateway " |
| 27 | "selection, card UI, and redirect messaging." |
| 28 | ) |
| 29 | |
| 30 | doc.add_heading("Prerequisites", level=2) |
| 31 | for item in [ |
| 32 | "Everest Forms Pro", |
| 33 | "At least one payment gateway add-on installed and activated", |
| 34 | "Global credentials configured for each gateway you want to offer", |
| 35 | "SSL (HTTPS) recommended for card-based gateways (Stripe, Square, Authorize.Net)", |
| 36 | ]: |
| 37 | doc.add_paragraph(item, style="List Bullet") |
| 38 | |
| 39 | doc.add_heading("What's New in Recent Versions?", level=2) |
| 40 | doc.add_paragraph( |
| 41 | "With Everest Forms Pro 1.9.15+, the Payment Gateway field is available under Payment Fields in the form builder." |
| 42 | ) |
| 43 | t = doc.add_table(rows=5, cols=2) |
| 44 | t.style = "Table Grid" |
| 45 | t.rows[0].cells[0].text = "Before (legacy)" |
| 46 | t.rows[0].cells[1].text = "With Payment Gateway field" |
| 47 | for i, (a, b) in enumerate( |
| 48 | [ |
| 49 | ("Multiple Choice for PayPal / Stripe", "Dedicated Payment Gateway field with branded cards"), |
| 50 | ( |
| 51 | "Enable each gateway on the Payments tab", |
| 52 | "Gateways appear when the add-on is active and credentials are saved", |
| 53 | ), |
| 54 | ( |
| 55 | "Conditional Logic on Payments tab + Credit Card field", |
| 56 | "Card fields show/hide automatically when the user picks a gateway", |
| 57 | ), |
| 58 | ( |
| 59 | "One Credit Card field per Stripe form", |
| 60 | "Stripe, Square, and Authorize.Net card UI mounts inside the selector when needed", |
| 61 | ), |
| 62 | ], |
| 63 | 1, |
| 64 | ): |
| 65 | t.rows[i].cells[0].text = a |
| 66 | t.rows[i].cells[1].text = b |
| 67 | doc.add_paragraph( |
| 68 | "One field per form: Only one Payment Gateway field can be added to a form. After you add it, legacy Credit " |
| 69 | "Card, Square Payment, and Authorize.Net fields are hidden from the field list to avoid duplicate payment UIs." |
| 70 | ) |
| 71 | |
| 72 | doc.add_heading("Supported Payment Gateways", level=2) |
| 73 | t2 = doc.add_table(rows=7, cols=3) |
| 74 | t2.style = "Table Grid" |
| 75 | t2.rows[0].cells[0].text = "Gateway" |
| 76 | t2.rows[0].cells[1].text = "Add-on" |
| 77 | t2.rows[0].cells[2].text = "Checkout type" |
| 78 | for i, row in enumerate( |
| 79 | [ |
| 80 | ("Stripe", "Everest Forms Stripe", "On-page card (Stripe Elements)"), |
| 81 | ("PayPal Standard", "Everest Forms PayPal Standard", "Redirect to PayPal"), |
| 82 | ("Square", "Everest Forms Square (Pro)", "On-page card (Square Web Payments SDK)"), |
| 83 | ("Authorize.Net", "Everest Forms Authorize.Net", "On-page card (Accept.js)"), |
| 84 | ("Mollie", "Everest Forms Mollie (Pro)", "Redirect to Mollie"), |
| 85 | ("Razorpay", "Everest Forms Razorpay", "Redirect / Razorpay checkout"), |
| 86 | ], |
| 87 | 1, |
| 88 | ): |
| 89 | for j, val in enumerate(row): |
| 90 | t2.rows[i].cells[j].text = val |
| 91 | doc.add_paragraph("A gateway is selectable on the frontend only when:") |
| 92 | for item in [ |
| 93 | "Its add-on is active", |
| 94 | "Global credentials are configured (PayPal can also use per-form email when global settings are disabled)", |
| 95 | "The gateway is enabled in the Payment Gateway field Gateways list", |
| 96 | ]: |
| 97 | doc.add_paragraph(item, style="List Number") |
| 98 | |
| 99 | doc.add_heading("Installation", level=2) |
| 100 | for i, step in enumerate( |
| 101 | [ |
| 102 | "Purchase Everest Forms Pro from WPEverest.", |
| 103 | "Install and activate Everest Forms Pro from your WordPress dashboard.", |
| 104 | "Install and activate payment add-ons from Everest Forms → Add-ons.", |
| 105 | "Configure each gateway under Everest Forms → Settings → Payments.", |
| 106 | ], |
| 107 | 1, |
| 108 | ): |
| 109 | doc.add_paragraph(f"{i}. {step}", style="List Number") |
| 110 | note = doc.add_paragraph() |
| 111 | note.add_run( |
| 112 | "For a detailed guide, read our documentation on how to install and activate Everest Forms Pro." |
| 113 | ).italic = True |
| 114 | |
| 115 | doc.add_heading("Configure Global Payment Credentials", level=2) |
| 116 | doc.add_paragraph( |
| 117 | "The Payment Gateway field does not replace global payment settings. Each add-on still needs API keys, " |
| 118 | "merchant email, or tokens saved once site-wide." |
| 119 | ) |
| 120 | doc.add_paragraph("Navigate to Everest Forms → Settings → Payments and configure:") |
| 121 | t3 = doc.add_table(rows=7, cols=2) |
| 122 | t3.style = "Table Grid" |
| 123 | t3.rows[0].cells[0].text = "Gateway" |
| 124 | t3.rows[0].cells[1].text = "Settings to complete" |
| 125 | for i, (a, b) in enumerate( |
| 126 | [ |
| 127 | ("Stripe", "Publishable key and Secret key (Live/Test)"), |
| 128 | ("PayPal Standard", "PayPal email, Mode (Sandbox/Production), Payment type"), |
| 129 | ("Square", "Application ID, Access token, Location ID"), |
| 130 | ("Authorize.Net", "API Login ID and Transaction Key"), |
| 131 | ("Mollie", "API key"), |
| 132 | ("Razorpay", "Key ID and Secret"), |
| 133 | ], |
| 134 | 1, |
| 135 | ): |
| 136 | t3.rows[i].cells[0].text = a |
| 137 | t3.rows[i].cells[1].text = b |
| 138 | doc.add_paragraph("Also set Currency under the General payments section.") |
| 139 | doc.add_paragraph("Gateway guides: docs.everestforms.net/docs/paypal-standard/, /stripe/, /square/, /authorize-net/, /mollie/, /razorpay/") |
| 140 | |
| 141 | doc.add_heading("Add the Payment Gateway Field to Your Form", level=2) |
| 142 | for i, step in enumerate( |
| 143 | [ |
| 144 | "Open Everest Forms → All Forms and edit your form (or create a new one).", |
| 145 | "In the builder, open Fields → Payment Fields.", |
| 146 | "Drag Payment Gateway into the form.", |
| 147 | "Add payment line items (Single Item, Multiple Choice, Total, etc.).", |
| 148 | "Click Save.", |
| 149 | ], |
| 150 | 1, |
| 151 | ): |
| 152 | doc.add_paragraph(f"{i}. {step}", style="List Number") |
| 153 | doc.add_paragraph("The field is required by default so visitors must pick a payment method before submitting.") |
| 154 | |
| 155 | doc.add_heading("Choose Which Gateways Appear on the Form", level=2) |
| 156 | for i, step in enumerate( |
| 157 | [ |
| 158 | "Click the Payment Gateway field in the builder.", |
| 159 | "In Field Options on the left, open Gateways.", |
| 160 | "Use the toggle to include or exclude each gateway; drag to reorder.", |
| 161 | "Expand a gateway row (chevron) for per-gateway settings.", |
| 162 | ], |
| 163 | 1, |
| 164 | ): |
| 165 | doc.add_paragraph(f"{i}. {step}", style="List Number") |
| 166 | doc.add_paragraph("Notes:", style="List Bullet") |
| 167 | for note in [ |
| 168 | "Gateways without credentials show as disabled until connected globally.", |
| 169 | "PayPal is unchecked by default if no global PayPal email is saved.", |
| 170 | "If every toggle is off, the form prompts you to enable at least one gateway.", |
| 171 | ]: |
| 172 | doc.add_paragraph(note, style="List Bullet") |
| 173 | |
| 174 | doc.add_heading("Per-Gateway Settings in the Form Builder", level=2) |
| 175 | t4 = doc.add_table(rows=6, cols=2) |
| 176 | t4.style = "Table Grid" |
| 177 | t4.rows[0].cells[0].text = "Gateway" |
| 178 | t4.rows[0].cells[1].text = "Typical accordion options" |
| 179 | for i, (a, b) in enumerate( |
| 180 | [ |
| 181 | ("PayPal", "Use global settings, email, Sandbox/Production, Cancel URL"), |
| 182 | ("Stripe", "Recurring toggle, iDEAL, map customer fields"), |
| 183 | ("Authorize.Net", "Map Customer Email (required for subscriptions)"), |
| 184 | ("Square", "Subscription options with Subscription Plan field"), |
| 185 | ("Mollie", "Subscription description and recurring defaults"), |
| 186 | ], |
| 187 | 1, |
| 188 | ): |
| 189 | t4.rows[i].cells[0].text = a |
| 190 | t4.rows[i].cells[1].text = b |
| 191 | doc.add_paragraph( |
| 192 | "You do not need Enable PayPal / Enable Stripe on the legacy Payments tab when using the Payment Gateway field." |
| 193 | ) |
| 194 | |
| 195 | doc.add_heading("More on Setup and Configuration", level=2) |
| 196 | |
| 197 | doc.add_heading("Payment Fields", level=3) |
| 198 | doc.add_paragraph("Single Item item types:") |
| 199 | for item in [ |
| 200 | "Pre-Defined: fixed price on the frontend", |
| 201 | "User Defined: visitor enters amount (donations)", |
| 202 | "Hidden: price not shown; configured price is charged", |
| 203 | ]: |
| 204 | doc.add_paragraph(item, style="List Bullet") |
| 205 | doc.add_paragraph( |
| 206 | "Use Multiple Choice, Checkbox, Quantity, and Total to build multi-item carts." |
| 207 | ) |
| 208 | |
| 209 | doc.add_heading("Build a One-Time Payment Form", level=3) |
| 210 | for i, step in enumerate( |
| 211 | [ |
| 212 | "Add Payment Gateway; enable Stripe, PayPal, or others.", |
| 213 | "Add Single Item with your price.", |
| 214 | "Optionally add Total and contact fields.", |
| 215 | "Save and embed via shortcode or block.", |
| 216 | ], |
| 217 | 1, |
| 218 | ): |
| 219 | doc.add_paragraph(f"{i}. {step}", style="List Number") |
| 220 | doc.add_paragraph("Stripe / Square / Authorize.Net: card fields appear on selection.") |
| 221 | doc.add_paragraph("PayPal / Mollie / Razorpay: redirect message; user pays on provider site.") |
| 222 | |
| 223 | doc.add_heading("Subscription Plan on Form", level=3) |
| 224 | for i, step in enumerate( |
| 225 | [ |
| 226 | "Add Payment Gateway; enable subscription-capable gateways.", |
| 227 | "Add Subscription Plan; configure price, period, trial, expiry.", |
| 228 | "Map gateway-specific options (e.g. Authorize.Net Customer Email).", |
| 229 | "Save the form.", |
| 230 | ], |
| 231 | 1, |
| 232 | ): |
| 233 | doc.add_paragraph(f"{i}. {step}", style="List Number") |
| 234 | doc.add_paragraph( |
| 235 | "With Payment Gateway + Subscription Plan, subscription mode runs without the legacy Payments tab recurring toggle." |
| 236 | ) |
| 237 | |
| 238 | doc.add_heading("Frontend View", level=2) |
| 239 | for item in [ |
| 240 | "Card grid of payment logos on the live form.", |
| 241 | "One gateway required unless only one is enabled (auto-selected).", |
| 242 | "Card gateways reveal inline card UI; redirect gateways show a secure redirect message.", |
| 243 | "Works with shortcode, Gutenberg block, and AJAX submission.", |
| 244 | ]: |
| 245 | doc.add_paragraph(item, style="List Bullet") |
| 246 | |
| 247 | doc.add_heading("Legacy Payments Tab vs Payment Gateway Field", level=2) |
| 248 | t5 = doc.add_table(rows=5, cols=2) |
| 249 | t5.style = "Table Grid" |
| 250 | t5.rows[0].cells[0].text = "Scenario" |
| 251 | t5.rows[0].cells[1].text = "Recommended approach" |
| 252 | for i, (a, b) in enumerate( |
| 253 | [ |
| 254 | ("One gateway only, simple form", "Legacy Payments tab"), |
| 255 | ("Visitor chooses PayPal or Stripe (or more)", "Payment Gateway field"), |
| 256 | ("Subscriptions with plan choices", "Subscription Plan + Payment Gateway"), |
| 257 | ("Old forms with Conditional Logic", "Keep working; migrate when convenient"), |
| 258 | ], |
| 259 | 1, |
| 260 | ): |
| 261 | t5.rows[i].cells[0].text = a |
| 262 | t5.rows[i].cells[1].text = b |
| 263 | doc.add_paragraph( |
| 264 | "Do not mix Payment Gateway with standalone Credit Card, Square Payment, or Authorize.Net fields." |
| 265 | ) |
| 266 | |
| 267 | doc.add_heading("How to add Stripe as a payment option with PayPal? (legacy)", level=3) |
| 268 | doc.add_paragraph( |
| 269 | "Older forms used Multiple Choice + Conditional Logic. New forms should use the Payment Gateway field. " |
| 270 | "See PayPal Standard and Stripe documentation on docs.everestforms.net for legacy steps." |
| 271 | ) |
| 272 | |
| 273 | doc.add_heading("Troubleshooting", level=2) |
| 274 | issues = [ |
| 275 | ( |
| 276 | "No payment methods appear on the form", |
| 277 | [ |
| 278 | "Activate the payment add-on under Everest Forms → Add-ons.", |
| 279 | "Save global credentials under Settings → Payments.", |
| 280 | "Enable at least one gateway toggle in field options.", |
| 281 | "For PayPal, set global email or per-form email in accordion.", |
| 282 | ], |
| 283 | ), |
| 284 | ( |
| 285 | "Please choose a valid payment method on submit", |
| 286 | [ |
| 287 | "Selected gateway must be in allowlist and connected.", |
| 288 | "User must select a valid gateway radio option.", |
| 289 | ], |
| 290 | ), |
| 291 | ( |
| 292 | "PayPal shows Things don't appear to be working", |
| 293 | [ |
| 294 | "Match Sandbox mode to sandbox business email.", |
| 295 | "Ensure form total is greater than zero.", |
| 296 | "Check Everest Forms → Tools → Payment Log.", |
| 297 | ], |
| 298 | ), |
| 299 | ( |
| 300 | "Stripe, Square, or Authorize.Net card form does not show", |
| 301 | [ |
| 302 | "Use HTTPS on the form page.", |
| 303 | "Confirm gateway toggle is on.", |
| 304 | "Check browser console for JS/cache conflicts.", |
| 305 | ], |
| 306 | ), |
| 307 | ( |
| 308 | "Authorize.Net subscriptions fail", |
| 309 | [ |
| 310 | "Map Customer Email (Subscriptions) in Authorize.Net accordion to form Email field.", |
| 311 | ], |
| 312 | ), |
| 313 | ] |
| 314 | for title, bullets in issues: |
| 315 | p = doc.add_paragraph() |
| 316 | p.add_run(title).bold = True |
| 317 | for b in bullets: |
| 318 | doc.add_paragraph(b, style="List Bullet") |
| 319 | |
| 320 | doc.add_heading("Finishing up", level=2) |
| 321 | doc.add_paragraph("Click Save in the form builder.") |
| 322 | doc.add_paragraph("Embed using the shortcode or Everest Forms block.") |
| 323 | doc.add_paragraph("Payment entries appear under Everest Forms → Entries.") |
| 324 | |
| 325 | footer = doc.add_paragraph() |
| 326 | footer.add_run("Category: Payment Gateways · Last updated: June 2026").italic = True |
| 327 | |
| 328 | doc.save(OUT) |
| 329 | print(f"Created: {OUT}") |
| 330 |