When placing an order as an anonymous user I got this error:

RuntimeException: Failed to start the session because headers have already been sent by "/my-site/vendor/symfony/http-foundation/Response.php" at line 1290. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 145 of /my-site/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).

I noticed that the issue comes with this: https://git.drupalcode.org/project/commerce_paypal/-/commit/67c829c78d83...

I tried to remove the setRefreshState method and everything works fine

CommentFileSizeAuthor
#5 Screenshot 2020-06-26 at 16.46.03.png272.16 KBscalas89

Comments

scalas89 created an issue. See original summary.

jsacksick’s picture

I've had issues caused by the order refresh causing a potential order total mismatch... Which one is causing issues? The one from onCreate? Or onApprove?

Are you using smart payment buttons? From where are you initiating the payment? (The buttons from the cart page?)

scalas89’s picture

The onApprove one is causing the issue.

In a clean installation I've just enabled the modules (commerce and commerce_paypal), created a Payment Gateway (PayPal Commerce Platform (Preferred)) without smart payment buttons and tried a standard checkout process with a guest checkout.

jsacksick’s picture

So the "PayPal Commerce Platform features" is configured to "Accept credit cards", you enter the CC details in checkout, and when do you get that error? Because I just tried and I couldn't reproduce the error...

scalas89’s picture

StatusFileSize
new272.16 KB

This is my configuration

jsacksick’s picture

The relevant setting isn't present in the screenshot.

Are you entering CC details in checkout? Or are you placing your purchase using the buttons?

There's a setting called "PayPal Commerce Platform features", does it say "Accept credit cards"?

scalas89’s picture

Sorry, mea culpa! :)
The options is set on "Accept PayPal with Smart Payment Buttons".

I'm not entering any CC at checkout, just clicking on the "Paypal" button and login with paypal credentials.

  • jsacksick committed 67431bc on 8.x-1.x authored by scalas89
    Issue #3155104 by scalas89, jsacksick: Fix an error when placing an...
jsacksick’s picture

Status: Active » Fixed

Good catch... I actually have no idea why, but I managed to reproduce the error and confirmed refreshing the order did the trick... So I'll probably tag a new release right away since this is an important bug.

scalas89’s picture

Cool, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.