Amazon Pay Checkout InvalidRequest


#1

Hello,

I want to use amazon pay system on my site and also using amazon pay sdk which is here https://github.com/amzn/amazon-pay-api-sdk-dotnet

I have successfully created amazon pay button and logged after then gives an error.

Something went wrong

Something went wrong

When contacting Amazon Pay customer service, provide the following info:
Session ID: ce8e4883-fc27-42c9-8b41-5127f7c12b63
Error Code: InvalidRequest

My backend codes;

string privateKey = _appEnvironment.WebRootPath + "\\privatekey.pem";

        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.Europe,
            environment: Amazon.Pay.API.Types.Environment.Sandbox,
            publicKeyId: "xxxxx",
            privateKey: privateKey
        );
        var client = new WebStoreClient(payConfiguration);
        var request = new CreateCheckoutSessionRequest
            (
                checkoutReviewReturnUrl: "https://localhost:44341/Home/CompleteCheckout",
                storeId: "amzn1.application-oa2-client.bf7916acd8cb4184816c933247dc7ada"
            );

        request.ChargePermissionType = ChargePermissionType.OneTime;

        // generate the button signature
        var signature = client.GenerateButtonSignature(request);

        var model = new HomeModel()
        {
            Signature = signature,
            Payload = request.ToJson()
        };

        return View(model);

My fronted codes;

    <div id="AmazonPayButton"></div>
    <script src="https://static-eu.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            merchantId: 'yyyyyyyyyy',
            ledgerCurrency: 'EUR',
            publicKeyId: 'xxxxxx',
            sandbox: true,
            checkoutLanguage: 'en_GB',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            createCheckoutSessionConfig: {
                payloadJSON: '@Html.Raw(Model.Payload)',
                signature: '@Html.Raw(Model.Signature)'
            }
        });
    </script>

#2

Hi,
You can check against parameters on the link below, not forgetting to change tabs to EU/UK first.

https://developer.amazon.com/docs/amazon-pay-checkout/amazon-pay-script.html?


#3

Hello,
I already changed tab to EU. My included script is
<script src=“https://static-eu.payments-amazon.com/checkout.js”></script>


closed #4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.