1

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....

https://www.site.com/index.php/actions/commerce/payments/completePayment?commerceTransactionId=114&commerceTransactionHash=0ec5451ed35b360311214dfa75aee88f&token=EC-9GX1527947961953D&PayerID=RFN3LXKUP6SVQ

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',
        ),
    ),
);

FORM

{% 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() }}
3

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
);
| improve this answer | |
  • 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. – user1663102 Nov 30 '17 at 19:33
1

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?

| improve this answer | |
  • 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. – user1663102 Nov 28 '17 at 14:03
  • Did you try disabling CSRF as a test? – Brad Bell Nov 28 '17 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?) – Jeremy Daalder Nov 28 '17 at 22:35
  • Hey Jeremy. I replaced my site name with that. – user1663102 Nov 28 '17 at 22:48
  • 1
    Can you post your form code, just for extra checking – Jeremy Daalder Nov 28 '17 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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