#mattiaferrari_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1387356961795739722
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- mattiaferrari_code, 1 day ago, 49 messages
The code that creates the exception is this
public void discoverReaderAndConnectHandoff() {
Terminal instance = Terminal.getInstance();
instance.discoverReaders(
new DiscoveryConfiguration.HandoffDiscoveryConfiguration(),
new CustomDiscoveryListener(reader -> {
instance.connectReader(
reader,
new ConnectionConfiguration.HandoffConnectionConfiguration(
new HandoffReaderListener() {
@Override
public void onDisconnect(@NonNull DisconnectReason reason) {
HandoffReaderListener.super.onDisconnect(reason);
}
}
),
new ReaderCallback() {
@Override
public void onSuccess(@NonNull Reader reader) {
System.out.println("FATTO " + reader.toString());
}
@Override
public void onFailure(@NonNull TerminalException e) {
}
}
);
}),
new com.stripe.stripeterminal.external.callable.Callback() {
@Override
public void onSuccess() {
System.out.println("SUCCESS");
}
@Override
public void onFailure(@NonNull TerminalException e) {
System.out.println(e.getMessage());
}
}
);
}
after that it seems that the connection still goes through successfully
๐ Happy to help!
Hi
What Stripe SDK version are you using ?
4.5.0.
Are you able to reproduce on our official sample ?
https://github.com/stripe/stripe-terminal-android/tree/master/Example
Is there also an example repo with the actual code to implement correclty? I tried this
https://github.com/stripe-samples/terminal-apps-on-devices
https://github.com/stripe/stripe-terminal-android
but they don't use so much that implementation("com.stripe:stripeterminal-handoffclient:4.5.0")
What guide are you following exactly between ?
A bit of both
That's not supposed to work like that, these are two different integration flows...
You can't have both on the same app
Well i'm taking every piece of code that can help.
In majority i followed this
i did the same thing as here from what i can tell https://docs.stripe.com/terminal/features/apps-on-devices/build
First what integration you are trying to follow there:
https://docs.stripe.com/terminal/features/apps-on-devices/overview#supported-integrations
app on device with handoff
Ok sorry
Point-of-sale app on a Stripe smart reader
I'm trying out deploying on the s700 devkit
What was the missing part of your reproduction ?
Sorry I need to understand how exactly you are facing this issue
I called initTerminal with this
public void initTerminal(Context context) {
TerminalListener listener = new TerminalListener() {
@Override
public void onConnectionStatusChange(ConnectionStatus status) {
System.out.printf("onConnectionStatusChange: %s\n", status);
}
@Override
public void onPaymentStatusChange(PaymentStatus status) {
System.out.printf("onPaymentStatusChange: %s\n ", status);
}
};
LogLevel logLevel = LogLevel.VERBOSE;
// Create your token provider.
ConnectionTokenProvider tokenProvider = new ConnectionTokenProvider() {
@Override
public void fetchConnectionToken(@NonNull ConnectionTokenCallback callback) {
try {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("")
.post(RequestBody.create(null, new byte[0])) // Empty body
.build();
// ecc ecc
});
} catch (Exception e) {
callback.onFailure(
new ConnectionTokenException("Failed to fetch connection token", e));
}
}
};
try {
if (!Terminal.isInitialized()) {
Terminal.initTerminal(context, logLevel, tokenProvider, listener);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
Here it uses handoff actually:
well yes but it isn't imported anywhere
Maybe i should pass somewhere an instance HandoffRpcCallbackListener
well yes but it isn't imported anywhere
It is actually:
https://github.com/stripe-samples/terminal-apps-on-devices/blob/main/app/build.gradle.kts#L67
Could you try remove HandoffReaderListener.super.onDisconnect(reason); from your HandoffReaderListener?
Yeah but the thing that i intended was that if i was supposed to use any of this
Could you try remove HandoffReaderListener.super.onDisconnect(reason); from your HandoffReaderListener?
Ok let me try
No you shouldn't, that's used internally by the SDK I think.
Nope still getting the error
Let me try deploying the example app to see if i get the error
Yeah
This is the logcat from the example app
The flow still work but i get this error
Ah wait, so this isn't blocking ? the app doesn't crush ?
Nono i was just wondering
my integration is a bit wacky so im investigating on every error that i see
maybe i was missing something that should be integrated
Well this seems to be just a false alarm...
And you said that you aren't able to reproduce on our official sample ?
https://github.com/stripe-samples/terminal-apps-on-devices
No
Wait
The screenshot above is made using the example app
The error is print out also in the example app
Ok then yeah that could be expected then...