<p>I had the same issue. I solved it by following the developer's guide to create an app with dedicated credentials (<a href="https://github.com/craftcms/commerce-paypal-checkout/blob/develop/README.md#creating-paypal-rest-api-credentials" rel="nofollow noreferrer">https://github.com/craftcms/commerce-paypal-checkout/blob/develop/README.md#creating-paypal-rest-api-credentials</a>) and deactivating &quot;Payouts&quot; on PayPal app and enabling &quot;Log in with PayPal&quot;</p>

CC BY-SA 4.0
2022-10-04T08:59:19.820Z
2022-10-04T08:59:19.820Z
Giammarco Bianchini
<p>I am having big trouble getting the PayPal checkout plugin to work. I am using this code:</p>
<pre><code>        {% namespace cart.gateway.handle|commercePaymentFormNamespace %}
            {{ cart.gateway.getPaymentFormHtml({
                currency: cart.paymentCurrency,
                'buyer-country': cart.billingAddress.countryCode,
                locale: lang == 'de' ? 'de_CH' : 'en_GB',
            })|raw }}
        {% endnamespace %}
</code></pre>
<p>That displays the PayPal form correctly:</p>
<p><a href="https://i.sstatic.net/OxLrv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OxLrv.png" alt="enter image description here" /></a></p>
<p>But as soon as I click on one of the buttons, I get a JS alert saying &quot;<strong>Error: Expected an order id to be passed</strong>&quot;.</p>
<p>I think the Gateway is correctly set up. When I enter wrong data, the buttons don't show up. Here is my setup:</p>
<p><a href="https://i.sstatic.net/w9Db7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/w9Db7.png" alt="enter image description here" /></a></p>
<p>Content of my <code>.env</code>:</p>
<pre><code>PAYPAL_ENABLED=true
PAYPAL_CLIENT_ID=AQxp4QbX2hmlqHtpJ_...
PAYPAL_SECRET=EBPo6JbLQ0bt0-...
PAYPAL_SANDBOX=true
</code></pre>
<p>Any hints and comments welcome!</p>

<craft4><commerce4>
Craft Commerce PayPal Checkout: Error: Expected an order id to be passed
# Craft Commerce PayPal Checkout: Error: Expected an order id to be passed

(Asked by: username_0 on 2022-09-23)

I am having big trouble getting the PayPal checkout plugin to work. I am using this code:
        {% namespace cart.gateway.handle|commercePaymentFormNamespace %}
            {{ cart.gateway.getPaymentFormHtml({
                currency: cart.paymentCurrency,
                'buyer-country': cart.billingAddress.countryCode,
                locale: lang == 'de' ? 'de_CH' : 'en_GB',
            })|raw }}
        {% endnamespace %}

That displays the PayPal form correctly:

But as soon as I click on one of the buttons, I get a JS alert saying "Error: Expected an order id to be passed".
I think the Gateway is correctly set up. When I enter wrong data, the buttons don't show up. Here is my setup:

Content of my .env:
PAYPAL_ENABLED=true
PAYPAL_CLIENT_ID=AQxp4QbX2hmlqHtpJ_...
PAYPAL_SECRET=EBPo6JbLQ0bt0-...
PAYPAL_SANDBOX=true

Any hints and comments welcome!

**Tags:** craft4, commerce4


---

## 1 answers

### Answer by username_1 on 2022-10-04. Score: 1

I had the same issue. I solved it by following the developer's guide to create an app with dedicated credentials (<https://github.com/craftcms/commerce-paypal-checkout/blob/develop/README.md#creating-paypal-rest-api-credentials>) and deactivating "Payouts" on PayPal app and enabling "Log in with PayPal"


---

