#pbpyrojust
1 messages · Page 1 of 1 (latest)
I believe fetch() in this case needs to point to everything including what would come after http://localhost:4242. So, you would point fetch() to http://localhost:4242/connection_token
That is what I am doing...
Terminal does spit out ReferenceError: Cannot access 'token' before initialization
Could it be this in server.js? app.post('/connection_token', async (req, res) => { const token = // ... Fetch or create the ConnectionToken res.json({secret: token.secret}); });
Does a connection token need to be hard coded?
I thought it is supposed to fetch one from Stripe with the fetchConnectionToken function
You need to create the Connection Token on the server-side. The function fetchConnectionToken only fetches a function from your server-side. You actually have to create the token yourself using this --> https://stripe.com/docs/api/terminal/connection_tokens/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.