Invalid API Key

johnkanady
New Contributor

Invalid API Key

I have integrated the following code for Visa Checkout in my project:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <img alt="Visa Checkout" class="v-button" role="button" src="https://sandbox.secure.checkout.visa.com/wallet-services-web/xo/button.png?cardBrands=VISA,MASTERCAR..." />

    <script type="text/javascript">
        function onVisaCheckoutReady() {
            V.init({
                apikey: "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
                settings: {
                    locale: "en_US",
                    countryCode: "US",
                    displayName: "Your Store",
                    payment: {
                        cardBrands: ["VISA", "MASTERCARD"]
                    }
                },
                paymentRequest: {
                    currencyCode: "USD",
                    subtotal: "10.00"
                }
            });

            V.on("payment.success", function(payment) {
                fetch('/visa/process-payment', {
                    method: 'POST',
                    body: JSON.stringify(payment),
                    headers: {
                        'Content-Type': 'application/json',
                    },
                })
                .then(response => response.json())
                .then(data => console.log('Payment processed on server:', data))
                .catch(
                    error => console.error('Error:', error)
                );
            });

            V.on("payment.error", function(payment, error) {
                console.log(error);
            });

            V.on("payment.cancel", function(payment) {
                // Handle payment cancellation
            });
        }
    </script>
</body>
</html>


but i was get invalid api key why ? 

Screenshot 2025-01-10 144712.png

i was use this api key and my api in Sanbox


1 REPLY 1
SyedSa
Community Moderator

Re: Invalid API Key

Hi @johnkanady,  Thank you for reaching out. An agent will get back to you as soon as possible. Until then, if any community member has information that may be helpful, feel free to reply in this thread.