SSO Endpoint script redirects to empty checkout page.

I am using the sample code from the SSO documentation. I tweaked it a little, but whether or not the user is or is not logged in, the script will redirect them back to the checkout page. The problem is that the checkout page is blank. Am I missing something here?

Note: The API and Foxycart domain fields are populated correctly on my code. I am just excluding them for security purposes. Also, I am integrating Foxycart into an installation of MODx if that helps.

SSO Endpoint Script:

/*

FoxyCart Shared Authentication for FoxyCart v051

Two options:

Option 1: If you have an existing session-based authentication include file, then include it at the top of this file and use this file as your shared authentication end point in the FoxyCart admin. Ideally, your authentication script should ideally know which FoxyCart customer_id is logged in.

Option 2: Include this file in your existing authentication check to create a new, publicly accessible shared authentication endpoint which you'll configure in the FoxyCart admin. Be sure no output has taken place yet, since this file will do a redirect every time.