I have entered API Username, Password and Signature from PayPal and added 'tokenParam' => 'craftToken' in Craft config and yet when I try to make a payment using PayPal Express I get the following....


With the following error: The requested URL was not found on this server.

Any suggestions on what I have missed.

Here is my craft/config/general.php file.

$domain = 'www.site.com';

if($_SERVER["HTTPS"] != "on")
    header("Location: https://" . $domain . $_SERVER["REQUEST_URI"]); exit(); 

define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) ) ? "https://" : "http://" );
define('SITE_URL',    URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');
define('BASEPATH',    realpath(CRAFT_BASE_PATH . '/../') . '/');

return array(
    '*' => array(
            'siteUrl' => SITE_URL,
            'environmentVariables' => array(
            'siteUrl'  => SITE_URL,
            'basePath' => BASEPATH,
            'defaultImageQuality' => 60,
            'omitScriptNameInUrls' => true,
            'tokenParam' => 't',


{% if cart.paymentMethodId %}

    <form method="POST" class="form-horizontal" id="paymentForm">

        <input type="hidden" name="action" value="commerce/payments/pay"/>
        <input type="hidden" name="redirect" value="/shop/customer/order?number={number}"/>
        <input type="hidden" name="cancelUrl" value="/shop/checkout/payment"/>

        {{ getCsrfInput() }}

2 Answers 2


What's the output in your templates of:

{{ craft.config.tokenParam }}

If it isn't t suspect your config is not setting the tokenParam for some reason.

Can you test with a stripped out general.php with only hard-coded values (No multi-environment config, or if($_SERVER ... checks)

return array(
    'tokenParam' => 'myCraftToken'
    // ..other hard coded settings
  • Bingo. Thank you Luke. Using {{ craft.config.tokenParam }} we were able to narrow it down. Server security issue on our end. Commerce worked perfectly. Awesome product. Commented Nov 30, 2017 at 19:33

Things I can think of to check:

Are you using test mode, or is this live (and have you got that set correctly in Commerce's settings?). If live, test mode needs to be false.

Also, do you have the appropriate action, redirect for complete payments and cancelled ones set in your form?

 <input type="hidden" name="action" value="commerce/payments/pay">
 <input type="hidden" name="redirect" value="/cart/complete?number={{ cart.number }}">
 <input type="hidden" name="cancelUrl" value="/cart/payment">

Also, try disabling CSRF on your site for your testing - does that make a difference?

When do you get that url/error - is that when it's re-directing to Paypal, or when it is coming back?

  • Hello Jeremy, I am not in test mode. I checked that as well as the actions in the form. It is giving me the error when it is coming back from PayPal. Commented Nov 28, 2017 at 14:03
  • Did you try disabling CSRF as a test?
    – Brad Bell
    Commented Nov 28, 2017 at 19:08
  • Also where you say https://www.site.com - you've manually changed that here, right? That's not the actual url you're getting back (in which case it would be your site url being wrong I guess?) Commented Nov 28, 2017 at 22:35
  • Hey Jeremy. I replaced my site name with that. Commented Nov 28, 2017 at 22:48
  • 1
    Can you post your form code, just for extra checking Commented Nov 28, 2017 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.