Payment approved at the provider. Customer redirected back. Adobe Commerce (Magento 2) shows an empty cart, or the login page, and the order confirmation never appears. Support gets the ticket; finance sees a captured payment with no order.
I first saw it in analytics rather than in a ticket: paid orders with no success-page view, starting right after a browser update. The payments were real. The customers just never made it back to the store.
When the return trip is a cross-site POST, the cause is almost always the browser, not your code: Adobe Commerce 2.4 sets its session cookie, PHPSESSID, to SameSite=Lax, and browsers don't send Lax cookies on a cross-site POST. When the payment page posts the customer back, the store sees no session. Budget about 30 minutes to prove it and fix it.
You’ll need
- A staging store with the payment method in test mode
- Chrome DevTools
- Access to the codebase: a small module for the session plugin, and the payment module's return controller
Reproduce with the network log preserved
Place a test order with DevTools open on the Network tab and "Preserve log" switched on. Find the request that brings the customer back from the payment page. It's usually a POST to a return or callback URL on your store.
Tip: Filter by your store's domain. The provider's own requests will otherwise bury the one you need.
Check which cookies were actually sent
Select the return request and open its Cookies tab. If PHPSESSID is missing from the request cookies, that's your bug. Adobe Commerce 2.4 sets its session cookie to SameSite=Lax explicitly, and browsers don't send Lax cookies on cross-site POSTs. Adobe Commerce sees no session, starts an empty one, and the customer is effectively a stranger. DevTools can list the cookies it held back and why: the quick note shows where.

Option A: set SameSite=None on the session cookie
This is the fast fix, and it's a code change. Adobe Commerce hard-codes Lax in Magento\Framework\Session\Config; there's no env.php setting for it. A small plugin changes the value:
// Plugin/SessionSameSiteNone.php, declared on Magento\Framework\Session\Config in di.xml
public function beforeSetCookieSameSite(\Magento\Framework\Session\Config $subject, string $value = 'Lax'): array
{
return [$subject->getCookieSecure() ? 'None' : $value];
}
None only works on a Secure cookie; Adobe Commerce rejects it otherwise. And Adobe Commerce marks the session cookie Secure only when the secure and unsecure base URLs match and the request came in over HTTPS. So the store needs HTTPS everywhere, staging included.
Tip: This widens when the session cookie travels. Pair it with CSRF protection on every state-changing route, and get your security lead to sign it off rather than slipping it into a hotfix.
Option B: bridge the return through a same-site page
If loosening the session cookie isn't acceptable, don't let the provider post into a session-dependent page at all. Run the payment step in an iframe or popup. The provider returns to a small page that needs no session, and that page sends the result to the parent window with postMessage. The parent already holds the session, so it completes the order.
window.addEventListener('message', (event) => {
if (event.origin !== 'https://pay.example-provider.com') return;
if (event.data && event.data.status === 'approved') {
window.location.assign('/checkout/onepage/success/');
}
});
Tip: Check event.origin on every message. And never create an order on the strength of a browser message alone; confirm the payment server-side through the provider's API or a signed webhook first.
| Compare | Option A: SameSite=None | Option B: same-site bridge |
|---|---|---|
| What changes | A plugin on Magento\Framework\Session\Config | Payment runs in an iframe or popup; a session-free return page uses postMessage |
| Needs | HTTPS everywhere, matching secure and unsecure base URLs | A return page that needs no session |
| Risk to manage | Session cookie now travels cross-site: CSRF protection on every state-changing route, security sign-off | Check event.origin; confirm the payment server-side before creating an order |
| When I'd pick it | The fast fix | When loosening the session cookie isn't acceptable |
Test every browser you claim to support
Safari and Chrome treat third-party contexts differently, and iframes are where they disagree most. Run the full journey in each, in a private window, and once on a real phone. A desktop-only test is how this bug ships twice.
Done!
Customers now come back from payment still signed in. Next: Playwright checks that stop a fix like this from quietly regressing.
