#stratopedarx - terminal + ios

1 messages · Page 1 of 1 (latest)

gleaming knot
#

This can be useful if, for example, your customer decides to use a different payment method or pay with cash after the payment has been processed. In your application’s UI, consider allowing the user to cancel after processing the payment, before finalizing the payment and notifying your backend to capture.

craggy mural
#

Great. Thanks.

gleaming knot
#

Just to make finding the other question easier from a single thread adding a link here: #dev-help message

#

In this case you're trying to switch to a different connected account?

Are those steps you're following from our docs? Can you share a link if so?

gleaming knot
#

At it looks like you might be referring to https://support.stripe.com/questions/switch-a-terminal-card-reader-to-another-stripe-account
is that right? If so, this is about switching a reader to a new account outside of a typical integration flow. eg, if you were using a separate stripe account for development vs your real account. This is different than changing accounts in the Connect context.

Can you clarify what exactly you're trying to accomplish in this scenario?

queen brook
#

hello, catching up here one sec

#

what was your question @craggy mural , it wasn't clear, can you let me know what is blocking you?

#

ah your second question is that other thread

#

pasting it here for my own sake:

Second question. 🙂

I can't clear the credentials. Could you show me how to do this correctly? I am doing this according to your documentation.
My algorithm for example:

let tokenProvider = APIClient.shared // this is the class that implements ConnectionTokenProvider

if !Terminal.hasTokenProvider () { // false
// when we start the application we get here
Terminal.setTokenProvider (tokenProvider) // Sets the token provider for the shared (singleton) SCPTerminal instance.
}

// ... work with Terminal
// ... then I would like to change tokenProvider

print (Terminal.hasTokenProvider ()) // true

// 1) In order to switch accounts in your app:
// - if a reader is connected, call disconnectReader:
Terminal.shared.disconnectReader

// 2) - configure the tokenProvider object to return connection tokens for the new account. The tokenProvider is implemented by your code, and you can do // this however you want.
// What does it mean? Could you show an example? I've tried many different options and nothing worked.

// 3) - call clearCachedCredentials
Terminal.shared.clearCachedCredentials()

// After that, I cannot assign a new provider. Because it has not cleared itself. What could be the problem?
print (Terminal.hasTokenProvider ()) // true

Please show me how to perform the second step specifically in code.
Thank you very much🙏

craggy mural
#

Yes, we are talking about this question

#

I am going to use this scenario for switching between different accounts (test and dev), and for testing. when running integration tests, so that I can completely clear Credentials and re-configure tokenProvider.

All in all, could you show how to perform all these steps correctly in code?

#

I haven't been able to do this yet. I don’t understand how to take the second step. thanks for your help.

queen brook
#

yeah so I think you might be going about it a different way, I haven't used hasTokenProvider before but I think you're expecting the tokenProvider property on Terminal to be null but I don't think that is how it would work.
So you should just set a new TokenProvider after clearCachedCredentials()

craggy mural
#

I got this: An integration error was detected in your app. You can only call setTokenProvider before requesting the shared Terminal instance for the first time. We recommend calling setTokenProvider in your AppDelegate's application:didFinishLaunchingWithOptions: method.

queen brook
#

ah gotcha so

craggy mural
#

I got this error on the second line with Terminal.setTokenProvider(self.configProvider)

queen brook
#

why are you setting setTokenProvider() again?

craggy mural
#

This example just for test

#

I just would like to change token provider