I am working with Amazon Pay and Adobe Commerce integration. I have Amazon Version 5.14.1. I have integrated this in Headless architecture using GraphQL.
I am able to redirect to Amazon page to enter login details and select the shipping and payment details. After that, I am getting redirected to Checkout page on the Magento with Prefilled Shipping address and Payment method as Amazon selected.
However When I hit the Place order button we are calling "completeCheckoutSession" GraphQL is called and this is where the error happens.
here is the Error that we are getting,
{
"reasonCode": "InvalidCheckoutSessionStatus",
"message": "You tried to call an operation on a Checkout Session that is in a state where that operation is not allowed",
"status": 422
}
completeCheckoutSession is defined in this class "AmazonPayModelCheckoutSessionManagement".
can anybody help me with the resolution of the issue?
I have tried adding the logs and it is giving 422 HTTP status code and hence cancelling the order and throwing an error as per the code.
2
Answers
From the order review page, the Place Order button should actually be invoking a request to UpdateCheckoutSession, then redirecting the customer to the amazonPayRedirectUrl before you’ll be able to make the request to CompleteCheckoutSession.
If when I process the request UpdateCheckoutSession, it return same error, what is the reason.
And the transaction status is open.
Thanks,
Michael