#Bisha

1 messages · Page 1 of 1 (latest)

lament mulch
#

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?

shut lava
#
GitHub

Loading wrapper for the Terminal JS SDK. Contribute to stripe/terminal-js development by creating an account on GitHub.

#

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

lament mulch
#

Can I see your loadStripeTerminal code?

shut lava
lament mulch
#

Can you share the code that's causing the error?

shut lava
#
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

lament mulch
#

And when that code runs you get an error that says StripeTerminal is undefined?

shut lava
#

Oh I realized my problem. I have a issue with async

#

I think If I fix that I will be good to go

#

Its not related to stripe, thank you for your time.