Development Mode (Sandbox) Guide

🛠️ Development Mode (Sandbox) Guide

Easy Form Builder by WhiteStudio – Dev Mode Configuration

Version 4.0.0

1. What Is Development Mode?

Development Mode (also called Sandbox Mode) is a setting in Easy Form Builder that switches the plugin
from production servers to sandbox/demo servers. This allows you to test payment integrations (like PayPal), addon installations,
and other server-dependent features without affecting real transactions or live data.

At a Glance

Mode Server PayPal API Use Case
Production whitestudio.team api-m.paypal.com Live website, real payments
Sandbox demo.whitestudio.team api-m.sandbox.paypal.com Testing, development, staging
Admin toggles Dev Mode

Save settings

Deactivate & Reactivate plugin

Mode takes effect

2. How to Enable / Disable

The Development Mode toggle is located inside the Easy Form Builder Panel page. Open the Settings section from the top menu bar, then go to the General tab.

📍 Step-by-Step: Enable Development Mode

  • Log in to your WordPress Admin Dashboard
  • In the left sidebar, click on Easy Form BuilderPanel
  • In the Panel page, click Settings from the top menu bar
  • Make sure you are on the General tab (it is the first tab and selected by default)
  • Scroll down until you see the Development Mode (Sandbox) section with a toggle button and the </> code icon
  • Click the toggle button to switch it ON (the toggle turns active/highlighted)
  • Click the Save button at the bottom of the Settings page to save your changes
  • Navigate to Plugins in the WordPress sidebar
  • Find Easy Form Builder in the plugin list, click Deactivate, then click Activate again
⚠️ Important: After changing the Development Mode (Sandbox) option, you must save the settings, then deactivate and reactivate the Easy Form Builder plugin from the Plugins page for the changes to take effect. The EMSFB_DEV_MODE constant is defined once during plugin initialization, so a plugin reload is required.

🔒 Step-by-Step: Disable Development Mode

Follow the same steps above, but toggle the switch to OFF. Then save, deactivate, and reactivate the plugin.

Warning: Never leave Development Mode enabled on a production/live website. This will route all payment transactions through PayPal Sandbox (no real money) and addon downloads through the demo server.

3. What Changes in Dev Mode

When Development Mode is enabled, the following components of Easy Form Builder change their behavior:

Component Production (OFF) Sandbox (ON)
Server URL https://whitestudio.team https://demo.whitestudio.team
PayPal API https://api-m.paypal.com/ https://api-m.sandbox.paypal.com/
Addon Downloads https://whitestudio.team/ https://demo.whitestudio.team/
Payment Processing Real transactions Test/sandbox transactions only
💡 Note: Development Mode affects multiple subsystems at once. It is a global switch — you cannot selectively sandbox only PayPal while keeping addons on production, or vice versa.

4. PayPal Sandbox

One of the most important effects of Development Mode is switching PayPal to Sandbox mode.
This means all payment API calls go to api-m.sandbox.paypal.com instead of the live PayPal endpoint.

Key Points

  • You must use PayPal Sandbox credentials (Client ID & Secret Key from PayPal Developer Dashboard) when Dev Mode is ON
  • If you use Production credentials with Dev Mode ON (or vice versa), authentication will fail
  • Sandbox transactions use test accounts — no real money is charged
  • Admin users see detailed error messages including mode mismatch warnings
  • Non-admin users see a generic friendly message if payment fails

Common Credential Mismatch Scenario

Dev Mode Credentials Used Result
Sandbox ON Sandbox keys ✅ Works correctly
Production OFF Production keys ✅ Works correctly
Sandbox ON Production keys ❌ Authentication error
Production OFF Sandbox keys ❌ Authentication error
⚠️ Remember: When switching between Sandbox and Production, always update your PayPal Client ID and Secret Key in Easy Form Builder > Settings to match the mode.

5. Addon Server

When you install or update addons (Telegram, PayPal, SMS, etc.), Easy Form Builder downloads them from the WhiteStudio server.
Development Mode changes which server is used:

Mode Server
Production https://whitestudio.team/
Sandbox https://demo.whitestudio.team/
💡 Tip: If addon installation fails while in Sandbox mode, try disabling Dev Mode and switching to the production server. The demo server may not always have the latest addon packages.

6. Database Option Reference

The Development Mode state is stored in the WordPress wp_options table:

Option Name Value Meaning
emsfb_dev_mode '0' Production mode (default)
emsfb_dev_mode '1' Sandbox / Development mode
emsfb_dev_mode '2' First-run state (auto-resets to '0')

PHP Constant

The option is read once during plugin boot and stored as a PHP constant:

// Defined in emsfb.php during plugin initialization
define(“EMSFB_DEV_MODE”, true); // Sandbox
define(“EMSFB_DEV_MODE”, false); // Production
💡 Why deactivate/reactivate? Because EMSFB_DEV_MODE is defined as a PHP constant when the plugin loads. Constants cannot be changed at runtime. The only way to apply a new value is to reload the plugin, which happens when you deactivate and then reactivate it.

7. Technical Details

How the Value Flows

Settings UI toggle

AJAX saves to wp_options

Plugin reload reads option

EMSFB_DEV_MODE constant set

Affected Files

File How It Uses Dev Mode
emsfb.php Reads emsfb_dev_mode option, defines the EMSFB_DEV_MODE constant, and sets EMSFB_SERVER_URL
class-Emsfb-admin.php Saves the devMode toggle value to emsfb_dev_mode option via AJAX, and resolves addon download domain
class-Emsfb-panel.php Passes current devMode state to JavaScript as a localized variable
class-Emsfb-addon.php Selects production or demo domain for addon JS and download URLs
functions.php Selects production or demo domain for addon installation API calls
class-Emsfb-paypal-handler.php Switches PayPal API between api-m.paypal.com and api-m.sandbox.paypal.com
class-Emsfb-paypal-payment.php Uses the constant to determine which PayPal server to query for payment operations
list_form-efb.js Renders the Development Mode toggle button in Panel > Settings > General tab

Server URL Constant

In addition to setting EMSFB_DEV_MODE, the plugin also defines EMSFB_SERVER_URL:

// emsfb.php
if (EMSFB_DEV_MODE) {
define(“EMSFB_SERVER_URL”, “https://demo.whitestudio.team”);
} else {
define(“EMSFB_SERVER_URL”, “https://whitestudio.team”);
}

8. Troubleshooting

❌ Problem: Dev Mode Not Taking Effect

  • Make sure you saved the settings after toggling Dev Mode
  • Go to Plugins page, click Deactivate on Easy Form Builder, then click Activate again
  • Clear any server-side cache (object cache, page cache) if you use a caching plugin
  • Verify the database value by checking wp_options:

    — Run in phpMyAdmin or MySQL CLI
    SELECT option_value FROM wp_options WHERE option_name = ’emsfb_dev_mode’;
    — Result: ‘1’ = Sandbox ON, ‘0’ = Production

❌ Problem: PayPal Returns 401 Unauthorized

  • Check if Dev Mode is ON but you are using Production PayPal credentials (or vice versa)
  • Go to Easy Form Builder > Panel > Settings and update the PayPal Client ID and Secret Key to match the current mode
  • Sandbox credentials are created at developer.paypal.com
  • Production credentials are created at developer.paypal.com (Live)

❌ Problem: Addon Installation Fails in Sandbox

  • The demo server may not have all addon packages available
  • Switch Dev Mode OFF, save settings, deactivate/reactivate the plugin, and try installing the addon again
  • Ensure your server can reach demo.whitestudio.team (check firewall or DNS)

❌ Problem: Option Value Is ‘2’

  • Value '2' is the first-run state — the plugin auto-resets it to '0' on next load
  • Simply deactivate and reactivate the plugin to trigger the reset
  • After that, the value will be '0' (Production mode)

🐛 Enable Debug Logging

PayPal operations log detailed information when WP_DEBUG is enabled:

// Add to wp-config.php
define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, true);

Then check wp-content/debug.log. PayPal logs are prefixed with [EFB][PayPal][HANDLER] and include the current EMSFB_DEV_MODE state, server URL, and credential lengths.