<div id="integration-guide">

<div class="ig-section">
<div class="ig-section-header">
<div class="ig-section-icon" style="background:#fef2f2;color:#dc2626;"><i class="fas fa-shield-alt"></i></div>
<h2>Troubleshooting Cloudflare and Firewall Issues</h2>
</div>
<p class="ig-section-desc">When you configure the Teya Payments plugin for WooCommerce, Teya sends a registration webhook to your store. This webhook delivers the credentials the plugin needs so your store can communicate securely with Teya. If this webhook is blocked by Cloudflare or another firewall, the setup cannot complete.</p>

<!-- When this applies -->
<div class="ig-subsection">
<h3>When this guide applies</h3>
<p>Use this guide if:</p>
<ul>
<li>You are trying to connect your WooCommerce store to Teya using the official Teya plugin.</li>
<li>After signing in to Teya and choosing the store you want to connect, you see an error page.</li>
<li>You, your developer, or your hosting provider see a <strong>403 Forbidden</strong> or similar error for the webhook URLs:
<ul>
<li><code>https://yourdomain.com/wc-api/teya_oauth_callback/</code></li>
<li><code>https://yourdomain.com/wc-api/teya_payments/</code></li>
</ul>
</li>
<li>Your site uses <strong>Cloudflare</strong>, another <strong>CDN</strong>, or a <strong>Web Application Firewall (WAF)</strong> such as Sucuri, Wordfence, or a hosting-provider firewall.</li>
</ul>

<p>You do not need to complete every step below. After each main step, test the registration again.</p>
</div>

<!-- Step 1 -->
<div class="ig-subsection">
<h3>Step 1: Allow Teya webhook IPs</h3>
<p><strong>Goal:</strong> Make sure your firewall allows Teya's webhook requests to reach your WooCommerce store.</p>

<p>Teya's webhook notifications currently come from these IP addresses:</p>
<ul>
<li><code>63.35.101.166</code></li>
<li><code>63.34.233.45</code></li>
<li><code>34.252.138.105</code></li>
</ul>

<h4>In Cloudflare</h4>
<ol>
<li>Go to <strong>Security → WAF → Tools</strong> or <strong>IP Access Rules</strong>.</li>
<li>For each IP above, add an <strong>Allow</strong> rule for <strong>HTTPS (port 443)</strong>.</li>
</ol>

<p>If you use additional firewalls (for example, at your hosting provider), add the same IPs to their allowlists as well.</p>
<p>This is the most common fix. Test the plugin configuration again after applying these changes. If the issue persists, continue with the steps below.</p>
</div>

<!-- Step 2 -->
<div class="ig-subsection">
<h3>Step 2: Check that the callback URL is reachable</h3>
<p><strong>Goal:</strong> Confirm that Teya can access the callback URL without being blocked or challenged.</p>

<p>The registration webhook is sent to:</p>
<p><code>https://yourdomain.com/wc-api/teya_oauth_callback/</code></p>

<p>To test this:</p>
<ol>
<li>Open a browser in <strong>incognito / private mode</strong>.</li>
<li>Visit: <code>https://yourdomain.com/wc-api/teya_oauth_callback/</code></li>
</ol>

<p>You should see one of the following:</p>
<ul>
<li>A blank page or a minimal WooCommerce-style response.</li>
<li>An HTTP <strong>200</strong> or <strong>204</strong> OK with no visible content.</li>
</ul>

<p>If you see any of these instead, the webhook is still being blocked:</p>
<ul>
<li>A <strong>403 Forbidden</strong> error.</li>
<li>A Cloudflare challenge page (for example, "Checking your browser before accessing…" or a CAPTCHA).</li>
<li>A branded firewall or security error page from your host.</li>
</ul>

<p>In that case, move on to the next steps to adjust Cloudflare or your firewall rules.</p>
</div>

<!-- Step 3 -->
<div class="ig-subsection">
<h3>Step 3: Check if Cloudflare or your firewall is blocking the webhook</h3>

<h4>Confirm if Cloudflare or a WAF is in use</h4>
<ul>
<li>Ask your developer or hosting provider whether your domain is behind <strong>Cloudflare</strong> or another WAF/security proxy.</li>
<li>If you log in at <code>dash.cloudflare.com</code> to manage DNS or security, you are likely using Cloudflare.</li>
</ul>

<h4>Review Cloudflare Firewall / WAF events</h4>
<p>In Cloudflare:</p>
<ol>
<li>Go to <strong>Security → WAF (Web Application Firewall)</strong> or <strong>Firewall rules</strong>.</li>
<li>Look at recent events for requests to:
<ul>
<li><code>/wc-api/teya_oauth_callback/</code></li>
<li><code>/wc-api/teya_payments/</code></li>
<li><code>/wc-api/*</code></li>
</ul>
</li>
<li>Check for actions such as <strong>Block</strong>, <strong>Challenge</strong>, or <strong>JS Challenge</strong> on these URLs or on the Teya IPs listed earlier.</li>
</ol>
<p>These actions indicate that Cloudflare is treating the webhook as suspicious traffic.</p>

<h4>Check bot and "Under attack" settings</h4>
<p>In Cloudflare:</p>
<ul>
<li>If <strong>Bot Fight Mode</strong> or <strong>Super Bot Fight Mode</strong> is enabled, it may treat Teya's webhook as a bot and block it.</li>
<li>If your site is in <strong>Under Attack</strong> mode, Cloudflare may show a challenge page before allowing access, which blocks automated webhooks.</li>
</ul>
<p>You do not need to turn off protection for your whole site. In the next step you will create rules that relax these checks only for the Teya webhook endpoints.</p>
</div>

<!-- Step 4 -->
<div class="ig-subsection">
<h3>Step 4: Relax security rules for the WooCommerce endpoints</h3>
<p><strong>Goal:</strong> Allow webhook traffic on the WooCommerce endpoints while keeping protection on the rest of your site.</p>

<p>Even if you allowlist the IPs, Cloudflare or another WAF may still <strong>challenge</strong>, <strong>rate-limit</strong>, or <strong>block</strong> the requests.</p>

<p>Focus on these URLs:</p>
<ul>
<li><code>/wc-api/*</code></li>
<li><code>/wc-api/teya_oauth_callback/</code></li>
<li><code>/wc-api/teya_payments/</code></li>
</ul>

<h4>Recommended configuration in Cloudflare (or equivalent in your WAF)</h4>
<ol>
<li>Go to <strong>Security → WAF → Rules</strong>.</li>
<li>Create a rule where <strong>URI path contains</strong> <code>/wc-api/</code> (or use an expression such as <code>starts_with(http.request.uri.path, "/wc-api")</code>).</li>
<li>For this rule, set the action so that Cloudflare:
<ul>
<li><strong>Allows</strong> or <strong>skips</strong> WAF checks.</li>
<li><strong>Skips bot protection</strong> (Bot Fight Mode).</li>
<li><strong>Skips JS challenges</strong>.</li>
<li>Ensures <strong>Rate Limiting</strong> is not blocking repeated calls to these endpoints.</li>
</ul>
</li>
</ol>
<p>This keeps security on the rest of your site, while allowing the plugin's technical callbacks to work. Apply similar exceptions in any other WAF or security plugin by relaxing rules for the same paths.</p>
</div>

<!-- Step 5 -->
<div class="ig-subsection">
<h3>Step 5: Exclude webhook endpoints from caching</h3>
<p><strong>Goal:</strong> Make sure Cloudflare or your CDN always forwards webhook calls to WooCommerce instead of serving a cached response.</p>

<p>Caching can cause stale or unexpected responses for webhook calls.</p>

<p>In Cloudflare (or any CDN):</p>
<ol>
<li>Go to <strong>Rules → Page Rules</strong> or <strong>Cache Rules</strong>.</li>
<li>Add rules to <strong>bypass cache</strong> for:
<ul>
<li><code>/wc-api/*</code></li>
<li><code>/wc-api/teya_payments/</code></li>
<li><code>/wc-api/teya_oauth_callback/</code></li>
</ul>
</li>
<li>Set these rules to:
<ul>
<li><strong>Cache level:</strong> Bypass.</li>
<li><strong>Edge cache TTL:</strong> 0, or disabled for these paths.</li>
</ul>
</li>
</ol>
<p>This ensures Cloudflare always forwards the request to your WooCommerce site and returns the real response.</p>
</div>

<!-- Step 6 -->
<div class="ig-subsection">
<h3>Step 6: Check SSL / HTTPS configuration</h3>
<p><strong>Goal:</strong> Confirm that the connection between Teya and your WooCommerce store is secure and compatible.</p>

<p>The Teya plugin requires a valid HTTPS connection to your WooCommerce store.</p>

<h4>Check your certificate</h4>
<ul>
<li>Open your store URL (for example, <code>https://yourdomain.com</code>) in a modern browser.</li>
<li>Make sure there are <strong>no warnings</strong> about an expired or invalid certificate.</li>
</ul>

<h4>Check Cloudflare SSL/TLS mode</h4>
<ul>
<li>In Cloudflare, open <strong>SSL/TLS</strong>.</li>
<li>Set <strong>SSL/TLS encryption mode</strong> to <strong>Full</strong> or <strong>Full (Strict)</strong>.</li>
<li>Avoid <strong>Flexible</strong> mode, as it can cause inconsistent behaviour for APIs and webhooks.</li>
</ul>
</div>

<!-- Step 7 -->
<div class="ig-subsection">
<h3>Step 7: Retest the plugin configuration</h3>
<p>After adjusting your firewall, caching, and SSL settings, test the plugin again.</p>

<p>In your WooCommerce admin:</p>
<ol>
<li>Go to <strong>WooCommerce → Settings → Payments</strong>.</li>
<li>Find <strong>Teya Payments</strong> in the list.</li>
<li>Click <strong>Complete setup</strong> to run the configuration again.</li>
<li>Sign in with your Teya ID and select the correct store, if prompted.</li>
</ol>

<p>When the configuration succeeds, you should see:</p>
<ul>
<li>The plugin marked as <strong>enabled</strong>.</li>
<li>A confirmation banner such as <strong>"Successfully connected to Teya"</strong> in the plugin settings.</li>
</ul>
</div>

<!-- Quick checklist -->
<div class="ig-subsection">
<h3>Quick checklist</h3>
<p>Most merchants resolve webhook and Cloudflare issues by:</p>
<ul>
<li>Allowing the Teya webhook IP addresses in Cloudflare and any server firewall.</li>
<li>Disabling or bypassing <strong>strict bot protection</strong> (for example, Bot Fight Mode, "Under attack" mode) for <code>/wc-api/*</code> paths.</li>
<li>Ensuring WAF rules and <strong>Rate Limiting</strong> are not blocking or throttling webhook or API calls to those paths.</li>
<li>Bypassing cache for the same webhook endpoints so that requests always reach WooCommerce.</li>
<li>Using a valid SSL certificate and Cloudflare SSL mode set to <strong>Full</strong> or <strong>Full (Strict)</strong>, not Flexible.</li>
<li>Keeping <strong>WooCommerce</strong> and the <strong>Teya plugin</strong> up to date, as outdated plugins can sometimes reject API or webhook calls.</li>
</ul>
</div>

<!-- Contact support -->
<div class="ig-subsection">
<h3>If it still does not work - contact Teya Support</h3>
<p>If you have followed all the steps above and still cannot complete the plugin configuration, Teya Support can help investigate further.</p>

<h4>Collect useful information before you reach out</h4>
<p>Having the details below ready will help resolve your issue faster:</p>
<ul>
<li>Your <strong>Teya merchant ID</strong> or <strong>store ID</strong> (from your Teya App or Business Portal).</li>
<li>Your <strong>WooCommerce store URL</strong> (for example, <code>https://yourdomain.com</code>).</li>
<li>Confirmation of whether you use <strong>Cloudflare</strong> or any other WAF or security plugin (for example, Sucuri, Wordfence, hosting firewall).</li>
<li>A short description of what happens when you try to complete plugin setup, including any error messages.</li>
<li>Screenshots of:
<ul>
<li>The error in WooCommerce or the Teya configuration screen.</li>
<li>Any relevant events in your Cloudflare or firewall logs showing blocked or challenged requests to <code>/wc-api/teya_oauth_callback/</code> or <code>/wc-api/teya_payments/</code>.</li>
</ul>
</li>
<li>The approximate <strong>date, time, and time zone</strong> of your last failed attempt, so we can check logs on our side.</li>
</ul>
</div>

<!-- Related -->
<div class="ig-subsection">
<h3>Related</h3>
<ul>
<li><a href="/online-payments/plugins/woocommerce/get-started">Get Started</a> - Install and connect the WooCommerce plugin</li>
<li><a href="/online-payments/plugins/woocommerce/customize">Customize</a> - Configure payment options and checkout behaviour</li>
<li><a href="/online-payments/troubleshooting">General Troubleshooting</a> - Common issues and best practices</li>
</ul>
</div>

</div>
</div>
