<p>The Craft support helped me to figure this out. The problem was, that the CSRF wasn't properly disabled.</p>

<p>So in my config/general.php I have the following:</p>

<pre><code>if ( !function_exists('isApiRequest') ) {
    function isApiRequest ()
    {
        $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
        $query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);

        $actions = [
            'actions/charge/webhook/callback',
            'actions/commerce/payments/complete-payment',

        ];

        foreach ($actions as $action) {
            if ( strpos($path, $action) || strpos($query, $action) ) {
                return true;
            }
        }

        return false;
    }
}

return [

'*' =&gt; [

    'enableCsrfProtection' =&gt; !isApiRequest(),
    ...
</code></pre>

CC BY-SA 4.0
2019-04-25T10:56:26.910Z
Thank you! Seems 'complete-payment' got renamed from 'completePayment' which is why the code from another post didn't work for me.
portnull
CC BY-SA 4.0
2018-09-10T16:31:06.963Z
2018-09-10T16:31:06.963Z
obs
<p>I try to get PayPal Express running but have quite some difficulties. 
I use the default templates for testing and can get through the whole checkout and payment process, but then PayPal closes and in the console I see the following</p>

<pre><code>http.js:114 PaypalUncaught Error: Request to post http://xxx.local/index.php?p=actions/commerce/payments/complete-payment&amp;commerceTransactionHash=xxx&amp;token=xxx&amp;PayerID=xxx failed with 400 error. 
Correlation id: unknown   
{"error": "Es ist nicht möglich, Ihre Dateneingabe zu prüfen."}
</code></pre>

<p>The error message can be translated to: It's not possible to check your data input.</p>

<p>In my Craft config, I changed the token name, as described here: <a href="https://github.com/craftcms/commerce-paypal" rel="nofollow noreferrer">https://github.com/craftcms/commerce-paypal</a></p>

<p>Any ideas what the reason for this could be?</p>

<plugin-craftcommerce2><payment>
Craft Commerce 2: PayPal Express not working - Correlation id: unknown
# Craft Commerce 2: PayPal Express not working - Correlation id: unknown

(Asked by: username_0 on 2018-08-28)

I try to get PayPal Express running but have quite some difficulties. 
I use the default templates for testing and can get through the whole checkout and payment process, but then PayPal closes and in the console I see the following
http.js:114 PaypalUncaught Error: Request to post http://xxx.local/index.php?p=actions/commerce/payments/complete-payment&commerceTransactionHash=xxx&token=xxx&PayerID=xxx failed with 400 error. 
Correlation id: unknown   
{"error": "Es ist nicht möglich, Ihre Dateneingabe zu prüfen."}

The error message can be translated to: It's not possible to check your data input.
In my Craft config, I changed the token name, as described here: https://github.com/craftcms/commerce-paypal
Any ideas what the reason for this could be?

**Tags:** plugin-craftcommerce2, payment


---

## 1 answers

### Answer by username_0 on 2018-09-10. Score: 2

The Craft support helped me to figure this out. The problem was, that the CSRF wasn't properly disabled.
So in my config/general.php I have the following:
if ( !function_exists('isApiRequest') ) {
    function isApiRequest ()
    {
        $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
        $query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);

        $actions = [
            'actions/charge/webhook/callback',
            'actions/commerce/payments/complete-payment',

        ];

        foreach ($actions as $action) {
            if ( strpos($path, $action) || strpos($query, $action) ) {
                return true;
            }
        }

        return false;
    }
}

return [

'*' => [

    'enableCsrfProtection' => !isApiRequest(),
    ...

> **Comments:**
> **username_1**: Thank you! Seems 'complete-payment' got renamed from 'completePayment' which is why the code from another post didn't work for me.  

---

