#tbare_api

1 messages ¡ Page 1 of 1 (latest)

burnt oceanBOT
#

👋 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/1313870474077278229

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

stone latch
#

here's the response from Stripe (I do not have access to this account - it's a customer of my client)

POST /v1/terminal/readers/tmr_FscpoggTgTKssg/process_payment_intent 

400 ERR

View log detail

Error message

"message": "There was a timeout when sending this command to the reader. Please reference the integration guide at https://stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven#handle-errors for details on how to handle this error."

"type": "invalid_request_error"

Request parameters

{

  "payment_intent": "pi_3Q5aQzRt4HfY66th0AqJkYA9",

  "process_config": {

    "enable_customer_cancellation": "True"

  }

}

Response body

{

  "error": {

    "code": "terminal_reader_timeout",

    "doc_url": "https://stripe.com/docs/error-codes/terminal-reader-timeout",

    "message": "There was a timeout when sending this command to the reader. Please reference the integration guide at https://stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven#handle-errors for details on how to handle this error.",

    "request_log_url": "https://dashboard.stripe.com/logs/req_m3YmsV1OHxDBjB?t=1727905814",

    "type": "invalid_request_error"

  }

}```
#

and here's what I'm currently doing to check the status of the reader on a timer

 Dim currentState As ReaderAction = fGetReaderAction(_TerminalID)

        Try

            If currentState.Status = "in_progress" Then

            ElseIf currentState.Status = "failed" Then
                ReaderStatusTimer.Stop()
                Dim FailureCode As String = currentState.FailureCode
                Dim FailureMessage As String = currentState.FailureMessage

                _FailureReason = FailureCode & " -- " & FailureMessage
                'lblError.Text = FailureCode & " -- " & FailureMessage
                'lblError.Visible = True
                TransactionSuccess = False
                sCancelTransaction()
                Me.Close()

            ElseIf currentState.Status = "succeeded" Then
                ReaderStatusTimer.Stop()
                TransactionSuccess = True
                Me.Close()

            End If
        Catch ex As Exception

        End Try```
sinful imp
#

hi! hmm, sounds reasonable. It's just a transient error, you can catch it(I think that's what that code does?) and retry the processPaymentIntent action after a little delay.

stone latch
sinful imp
stone latch
#

is there any way I can emulate / force this behavior to test it?

sinful imp
#

I don't believe so unfortunately

stone latch
#

would that be returning on this try?

  Public Function fProcessPaymentIntent(ByVal TerminalID As String, ByVal PaymentIntendID As String) As Reader
        ' https://docs.stripe.com/terminal/payments/collect-payment?terminal-sdk-platform=server-driven#process-payment
        ' https://docs.stripe.com/terminal/payments/collect-payment?terminal-sdk-platform=server-driven#customer-initiated-cancellation

        Dim rpi_options = New ReaderProcessPaymentIntentOptions With {
            .PaymentIntent = PaymentIntendID,
            .ProcessConfig = New Stripe.Terminal.ReaderProcessConfigOptions With {
                .EnableCustomerCancellation = True
            }
        }

        Dim rpi_service = New ReaderService()

        Try
            Dim rpi_result = rpi_service.ProcessPaymentIntent(TerminalID, rpi_options)

            Return rpi_result
        Catch ex As Exception
            MsgBox(ex.Message)
            lblError.Visible = True
            _FailureReason = "Card Reader appears to be offline." & vbCrLf & vbCrLf & "Please See attendant"
            lblError.Text = _FailureReason
        End Try

    End Function```
#

on my rpi_result try?

#

the only thing I've been able to test is turning off the reader / knocking it offline

sinful imp
#

I don't speak VBNET but I think the answer is yes, in that catch block

stone latch
#

alright just making sure that's where the error would return (on the processpaymentintent)

sinful imp
#

yes, since it's the error returned from that req_xxx earlier, which would be from calling ProcessPaymentIntent, and stripe-dotnet will throw an exception for errored API requests like that

stone latch
#

got it. I'll start there and see what I can come up with.

#

appreciate the help! for what it's worth, if there was a way to force an error like that, it would be beneficial for troubleshooting / testing purposes

sinful imp
#

yep I agree!