Klarna Issue
Preconditions and environment
Version 2.4.5
Steps to reproduce
After comple the payment in klarna website when its returns to our site we get error 500 in this url /checkout/klarna/updateSession/
Expected result
Order placed successfully
Actual result
No redirect to the success page. It's returns to checkout page and the order not placed
Additional information
No response
Release note
No response
Triage and priority
- [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @dvakerlis. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
-
@magento give me 2.4-develop instance- upcoming 2.4.x release - For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
-
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
-
- Verify that issue has a meaningful description and provides enough information to reproduce the issue.
-
- Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to.
- Add
-
- Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
- Verify that the issue is reproducible on
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Reproduced on 2.4.5
@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://af74b0228fb299619bbf7ba85720f9b9.instances-prod.magento-community.engineering Admin access: https://af74b0228fb299619bbf7ba85720f9b9.instances-prod.magento-community.engineering/admin_01b0 Login: 7e5491e0 Password: b67c29ac9555
@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://af74b0228fb299619bbf7ba85720f9b9.instances-prod.magento-community.engineering Admin access: https://af74b0228fb299619bbf7ba85720f9b9.instances-prod.magento-community.engineering/admin_a002 Login: 1e643a79 Password: da5887d3aaa1
Issue: vendor/klarna/module-payments/Controller/Klarna/QuoteStatus.php Local and CI work as expected as is_active is always '1' due to the fact it technically errors on the try/catch which allows orders to go through. On live checkout/klarna/authorize callback happens which means that the klarnaQuote is set and does not error.
It then moves out of the try/catch and goes to set is_active again. $result['is_active'] = $magentoQuote->getIsActive() && $klarnaQuote->isAuthCallbackFailedOrNotStarted(); It sets this to true.
However, the JS vendor/klarna/module-payments/view/frontend/web/js/view/payments/kp.js check to decide if it should call checkout/klarna/authorizationTokenUpdate and then call context.placeOrder(); checks - if (result['is_active'] === '1') { but since the above has set it to true this will not run and a order will never be placed.
Therefore, the stack trace below will happen.
Stack trace:
#0 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Sales\Model\OrderRepository->get()
#1 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Sales\Model\OrderRepository\Interceptor->___callParent()
#2 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Sales\Model\OrderRepository\Interceptor->Magento\Framework\Interception{closure}()
#3 /var/www/website/releases/20240509084859/generated/code/Magento/Sales/Model/OrderRepository/Interceptor.php(23): Magento\Sales\Model\OrderRepository\Interceptor->___callPlugins()
#4 /var/www/website/releases/20240509084859/vendor/klarna/module-payments/Controller/Klarna/UpdateSession.php(103): Magento\Sales\Model\OrderRepository\Interceptor->get()
#5 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(58): Klarna\Kp\Controller\Klarna\UpdateSession->execute()
#6 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(138): Klarna\Kp\Controller\Klarna\UpdateSession\Interceptor->___callParent()
#7 /var/www/website/releases/20240509084859/vendor/magento/framework/Interception/Interceptor.php(153): Klarna\Kp\Controller\Klarna\UpdateSession\Interceptor->Magento\Framework\Interception{closure}()
#8 /var/www/website/releases/20240509084859/generated/code/Klarna/Kp/Controller/Klarna/UpdateSession/Interceptor.php(23): Klarna\Kp\Controller\Klarna\UpdateSession\Interceptor->___callPlugins()
Apply this patch :)
index 34a6f20..c6349bb 100644
--- a/Controller/Klarna/QuoteStatus.php
+++ b/Controller/Klarna/QuoteStatus.php
@@ -114,7 +114,7 @@ class QuoteStatus extends CsrfAbstract implements HttpPostActionInterface
}
$magentoQuote = $this->magentoQuoteRepository->get($klarnaQuote->getQuoteId());
- $result['is_active'] = $magentoQuote->getIsActive() && $klarnaQuote->isAuthCallbackFailedOrNotStarted();
+ $result['is_active'] = $magentoQuote->getIsActive() && $klarnaQuote->isAuthCallbackFailedOrNotStarted() ? '1' : '0';
return $this->result->getJsonResult(200, $result);
}
This caused me great pain.
Hi @dvakerlis
Thanks for reporting and collaboration.
The team is working on this issue. We are keeping the issue in On Hold status for now.
Thanks.
@engcom-Dash why is this "issue in On Hold status for now" if "the team is working on this issue"?
Hi @fredden
We are getting issues while configuring Klarna. we are waiting to fix the related configuration issue.
We will work on the ticket once we fix the configuration issue with Klarna.
Thanks.
Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
FYI: this issue was fixed in the m2-klarna extension per PPP-1266 in v2.2.2: https://commercemarketplace.adobe.com/klarna-m2-klarna.html#product.info.details.release_notes
Hi @dvakerlis ,
Thanks for your reporting and collaboration. As per https://github.com/magento/magento2/issues/38675#issuecomment-2315183359 issue is fixed in m2-klarna extension per PPP-1266 in v2.2.2 Hence closing the ticket. Please feel to raise a fresh ticket or reopen this ticket if you need more assistance on this.
Thanks.