Closed miccav-eventlink closed 3 months ago
Thanks for the issue. Interesting suggestion, what problem do you hope to solve by this? Do you want to change the API request destination in the middle of a request? Or do you want to do error handling?
I also would like this feature.
The ideal case would be that StripeTerminal.Initialize
has an option fetchConnectionToken: () => Promise<string>
where the returning string is the token. Then this token is used to initialize the StripeTerminal package.
This way we can delegate our own http-client layer so we can add headers, data, etc that our backend server endpoint may require.
I see. It is certainly preferable to make the request on the web and pass it as a string, considering the granting of Headers, etc. But If StripeTerminal.Initialize
have that method, it is undesirable because a wrapper Class is required.
Currently considering:
StripeTerminal.addListener(TerminalEventsEnum.RequestedConnectionToken, async () => {
const token = await getToken(); // Users Method
StripeTerminal.setConnectionToken({token});
});
Is your feature request related to a problem? Please describe.
I'd like a way to control how the terminal connection token is fetched. Specifically how the http request and error handling is utilized.
Describe the solution you'd like
Allowing the call back to handle the request as seen below.
Describe alternatives you've considered
There wasn't any alternatives that could be considered since the request is handled in the TokenProvider class without any way for it to be modified.
Additional context
Here's a crude example:
Usage Product
If you adopt this plugin, please let us know which product you are using.
Product Name: Product URL : Using Function: