Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The field 'checkoutMode' is invalid for this API. #9

Open
ChrisRadny opened this issue Nov 28, 2020 · 9 comments
Open

The field 'checkoutMode' is invalid for this API. #9

ChrisRadny opened this issue Nov 28, 2020 · 9 comments

Comments

@ChrisRadny
Copy link

Hi.

I am trying to create a new checkout session id at the end of my checkout process as described in:
https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-apb-checkout/add-the-amazon-pay-button.html

It's not working. I get the following reason code: {"reasonCode":"UnrecognizedField","message":"The field 'checkoutMode' is invalid for this API."}.

Please help.

Thanks Chris

@bjguillot
Copy link
Contributor

Can you provide a sample of what your entire JSON request payload looks like?

Note the page you are referencing, ...-apb-..., is a special type of checkout cataloged under the"Additional payment button" use case. I'm not sure if you were intending to use that use case or clicked it by accident. This use-case is intended when you do not wish for your buyer's to use Amazon Pay to obtain the shipping address from their Amazon Address Book, and instead, want the buyer to manually type in their full shipping address. Typically this would be done at the end of a checkout flow, instead of at the beginning. (The beginning is generally preferred, because it saves your buyers a lot of time and can make checkout much quicker with higher conversion rates if they don't need to type in any extra details.)

The standard button flow documentation could be found here:
https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-checkout/add-the-amazon-pay-button.html
(Notice no -apb- is the URL.)

@ChrisRadny
Copy link
Author

I have two types of amazon pay checkouts. The first one is an express checkout (PayAndShip) with getCheckoutSession to retrieve shipping address. The second one is at the end of the checkout. Buyer entered the shipping address in my form.

In the meantime I managed to get my scenario online. I switched the second checkout type to PayOnly without an shipping address, but I am not sure if I don't have any disadvantages (seller protection).

Here is my payload array which was failing when I tried to send addressDetails in PayAndShip context:

		$payload = [
			'webCheckoutDetails' => [
				'checkoutReviewReturnUrl' => '...',
				'checkoutResultReturnUrl' => '...',
				'checkoutMode' => 'ProcessOrder',
			],
			'storeId' => '...',
			'merchantMetadata' => [
				'merchantReferenceId' => '...',
				'merchantStoreName' => '...',
			],
			'paymentDetails' => [
				'paymentIntent' => 'AuthorizeWithCapture',
				'canHandlePendingAuthorization' => false,
				'chargeAmount' => [
					'amount' => '...',
					'currencyCode' => '...',
				],
			],
			'paymentDetails' => [
				'paymentIntent' => 'AuthorizeWithCapture',
				'canHandlePendingAuthorization' => false,
				'chargeAmount' => [
					'amount' => '...',
					'currencyCode' => '...',
				],
			],
			'addressDetails' => [
				'name' => '...',
				'addressLine1' => '...',
				'city' => '...',
				'postalCode' => '...',
				'countryCode' => '...',
				'phoneNumber' => '...',
			],				
		];

@2blane
Copy link

2blane commented Jul 16, 2021

I can second this issue. Whenever I try to use 'checkoutMode' => 'ProcessOrder' and the user clicks the Amazon Pay button, a window appears and says:
Screen Shot 2021-07-16 at 2 14 49 AM
If I remove 'checkoutMode' => 'ProcessOrder' from my payload then the checkout process will work. However, I want the checkout process to be contained in Amazon instead of jumping me back to my app and having to hit Confirm Payment - jump to Amazon - jump back, etc. That was the whole point of 'Process Order', but it doesn't seem to work. It acts like there is an issue with my 'addressDetails', but I have set 'productType' => 'PayOnly' when creating the button so it shouldn't need an address. I also tried adding an address to see if that would fix the issue, but it didn't. Am I missing something? Is there some other setting you have to change to get "checkoutMode" => "ProcessOrder" to work? I haven't had any issues with this library or integration process except for this setting. I don't think it works.

@qaharmdz
Copy link

qaharmdz commented Oct 3, 2022

Get the same issue The field "checkoutMode" is invalid for this API the API 2 on this guide
https://developer.amazon.com/docs/amazon-pay-apb-checkout/add-the-amazon-pay-button.html#2-generate-the-create-checkout-session-payload

@shangamesh
Copy link

Thanks for letting us know. We are checking with our internal engineering team, will keep post about updates or findings

@qaharmdz
Copy link

qaharmdz commented Oct 6, 2022

I'm misunderstanding the docs, just need the payload string, doesn't need to create the checkout session. Thanks.

@JLanky
Copy link

JLanky commented Jan 12, 2023

Hey guys! After two weeks of communication with those support, I know this problem. If you use checkoutMode you must not specify checkoutReviewReturnUrl.
Answer from support:

Since merchant is using checkoutMode parameter with "ProcessOrder" value. In this mode buyer will complete checkout on the Amazon Pay hosted page immediately after clicking on the Amazon Pay button hence tell them to pass only "checkoutResultReturnUrl": not "checkoutReviewReturnUrl" in payload

@JLanky
Copy link

JLanky commented Jan 13, 2023

I can second this issue. Whenever I try to use 'checkoutMode' => 'ProcessOrder' and the user clicks the Amazon Pay button, a window appears and says: Screen Shot 2021-07-16 at 2 14 49 AM If I remove 'checkoutMode' => 'ProcessOrder' from my payload then the checkout process will work. However, I want the checkout process to be contained in Amazon instead of jumping me back to my app and having to hit Confirm Payment - jump to Amazon - jump back, etc. That was the whole point of 'Process Order', but it doesn't seem to work. It acts like there is an issue with my 'addressDetails', but I have set 'productType' => 'PayOnly' when creating the button so it shouldn't need an address. I also tried adding an address to see if that would fix the issue, but it didn't. Am I missing something? Is there some other setting you have to change to get "checkoutMode" => "ProcessOrder" to work? I haven't had any issues with this library or integration process except for this setting. I don't think it works.

Hi! Check my previous comment

@stephenreay
Copy link

Has anyone had any luck getting this to work?

With checkoutMode set to ProcessOrder (and no checkoutReviewReturnUrl set) I'm getting this exact same error.

@shangamesh ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants