#Bisha
1 messages · Page 1 of 1 (latest)
Hello! Can you point me to the documentation you're using and provide more details about what specifically is blocking you? Are you seeing an error?
Im following these specific guides:
https://stripe.com/docs/terminal/sdk/js#connection-token
https://github.com/stripe/terminal-js
https://stripe.com/docs/stripe-js/react
The Error is that im attempting to create a StripeTerminal object with a connection token
however it seems im not importing the Stripe SDK for javascript correctly as "StripeTerminal" is undefined
Are you loading https://js.stripe.com/terminal/v1/ on your page?
Can I see your loadStripeTerminal code?
Yep, I have that as a script tag in my <head> within my index.html file
Can you share the code that's causing the error?
Yes, sorry. I need a moment
import React from 'react';
import { useHistory } from 'react-router-dom';
import { useEffect, useState } from 'react';
import {loadStripeTerminal} from '@stripe/terminal-js';
const StripeTerminal = await loadStripeTerminal();
const terminal = StripeTerminal.create({
onFetchConnectionToken: async () => {
fetch('/connection_token')
.then(function(response) {
return response.json();
})
.then(function(data) {
return data.secret;
});
},
unexpectedDisconnect: () => {
console.log("Disconnected from reader")
}
})
This code is inside a component for a basic react app
And when that code runs you get an error that says StripeTerminal is undefined?