Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seatgeek Checkout API Integration #113

Open
svs22121990 opened this issue Jun 1, 2021 · 0 comments
Open

Seatgeek Checkout API Integration #113

svs22121990 opened this issue Jun 1, 2021 · 0 comments

Comments

@svs22121990
Copy link

svs22121990 commented Jun 1, 2021

Hi,

We are fetching the events data using the Seatgeek events API.

We want to integrate Checkout process on our website.

Getting the Information Necessary to Render a Checkout Form
GET /listings/{listing_id}?event_id=123&quantity=1&country=US&state=NY

We are trying the render the checkout page using the above API. Can you guide us how to fetch the listing id for a event ? We cannot get it from the events api.

When we try to authenticate the API using below method
The authentication code can be calculated as such, where client_secret is the SeatGeek API client secret that corresponds to the passed client id:

    hmac_signature = BASE64( HMAC_SHA1( client_secret, UPPERCASE( method ) + "\n" + path + "\n" + body ) )

Our Code
const Checkout = ({ match }) => {
const eventid = match.params.eventid;
const [ events, setEvents ] = useState(null);
const body="";
const hmacDigest = Base64.stringify(hmacSHA1( client_secret,"POST" + "\n/" + match.url + "\n" + body));
console.log(hmacDigest);
useEffect(() => {
const fetchPrismicData = async () => {
try {
const eventsDoc = await fetch("https://api.seatgeek.com/2/listings/123456?event_id="+eventid,{
method: 'POST',
headers: {
'Authorization': 'SG '+client_id+':'+hmacDigest,
'Access-Control-Allow-Origin':'*'
}
})
.then(res => res.json().then(events => setEvents(events)));

		} catch (error) {
			console.error(error);
		}
	}

	fetchPrismicData();
  }, []);

We get an 403 unauthrorized error as a response.

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant