amzn / amazon-pay-api-sdk-dotnet

Amazon Pay API SDK (.NET)
Apache License 2.0
18 stars 8 forks source link

Invalid Parameter when using checkout flow #8

Closed larrybud2004 closed 3 years ago

larrybud2004 commented 3 years ago

I don't know if this should be a reported bug in the library or in AmazonPay.

When using this flow type: https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-apb-checkout/additional-payment-button-overview.html

AmazonPay requires that checkOutReviewReturnUrl is NULL, and that CheckoutResultReturnUrl gets set. e.g.

var createRequest = new CreateCheckoutSessionRequest(null, GltSettings.AmazonStoreId); createRequest.WebCheckoutDetails.CheckoutResultReturnUrl = "myreturnurl"; createRequest.WebCheckoutDetails.CheckoutMode = CheckoutMode.ProcessOrder; createRequest.PaymentDetails.PaymentIntent = PaymentIntent.AuthorizeWithCapture;

If you set checkOutReviewReturnUrl, AmazonPay will come back with an obscure message that you have an invalid parameter. Perhaps update your docs with this info.

Also see S.O. report: https://stackoverflow.com/questions/65535379/amazon-pay-sdk-completecheckoutsession-error/65540391?noredirect=1#comment115924981_65540391

lemked commented 3 years ago

Hey Larry,

We've been in touch on SO. We are going to implement a fix for this issue with the next release of the SDK, probably by adding a parameterless constructor for the CreateCheckoutSessionRequest.

For the obscure error message, we will verify the logic on the hosted page that is shown when the checkout is initialized, and implement an improved messaging.

Kind regards, Daniel

lemked commented 3 years ago

We have just released version 2.4.3 of the SDK that introduces a parameterless constructor to mitigate the issue with having to provide a null value for the review URL. A code sample can be found here: https://github.com/amzn/amazon-pay-api-sdk-dotnet#amazon-pay-button-additional-payment-button

Closing issue. Please re-open in case that further assistance is required on the topic.