Calling variable from fetch response

Hello, I have successfully gotten the fetch response. However, when trying to call a variable from it, I get a “Checkout is undefined” error. Ive tried searching solutions but nothing fixed the said error. Help would be greatly appreciated.

$w.onReady(async function (){

const proxyurl = "https://cors-anywhere.herokuapp.com/";
const url = "https://ap-gateway.mastercard.com/checkout/version/57/checkout.js/"; // site that doesn’t send Access-Control-*
fetch(proxyurl + url)
.then(response => response.text())
// .then(response => console.log(response))
.then(contents => console.log(contents))

Checkout.configure({
              session: { 
              id: '111111'
            },
              interaction: {
                    merchant: {
                        name: 'Your merchant name',
                        address: {
                            line1: '200 Sample St',
                            line2: '1234 Example Town' 
                        }    
                    }
               }
            });
})