#bobofthebuilders_api

1 messages ยท Page 1 of 1 (latest)

hybrid yewBOT
#

๐Ÿ‘‹ 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/1390606349947244655

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

fickle merlin
#

Hello ๐Ÿ‘‹

What SDK/framework are you using?

dreamy turret
#

Using php and server-driven flow

fickle merlin
#

Ah, okay. And you are atttempting to simulate when the user cancels via your application or directly through the reader?

#

Since you are using simulated_stripe_s700, the Customer would have both options

dreamy turret
#

Scenario where customer presses "X"

fickle merlin
#

Okay yeah so you want to trigger the terminal.reader.action_failed webhook event that indicates the Customer canceled the payment back to your PHP code, right?

dreamy turret
#

I dont think thats exactly right. When retrieving the reader from the api (GET /terminal/readers/:id), I want to see the customer_canceled failure code. To also handle non-webhook flows

fickle merlin
#

Right, in the action property

dreamy turret
#

Yes

fickle merlin
#

I'm not seeing a test helper method in the SDK to trigger that. Have you tried canceling the related Payment Intent directly via the API?

dreamy turret
#

I've tried cancelling the action, but not the payment intent itself. Will try it now.

#

Seems like that didnt help - payment intent is cancelled, but the reader's action is still in_progress status with no failure code
Cancellation request: req_bOTANjdVowueET
Reader read request: req_TFGYV4XacYgSmX

fickle merlin
#

Yeah I didn't have high hopes (since the reader isn't polling the API for the status of the Intent) but it was worth a shot. I'm reaching out to some colleagues to check for alternatives.

dreamy turret
#

Okay.
Follow up question: Would customer cancellation also cancel the payment intent? As in, we'd have to create a new payment intent to attempt a charge again?

fickle merlin
#

No, it would just fall back to requires_payment_method. The cancellation only stops the reader from collecting a payment method.

dreamy turret
#

Oky

fickle merlin
#

Okay we are not finding any way to accurately simulate this. Unfortunately I think you would need to mock this response

#

So take the response from your process_payment_intent request and swap out the action property values for what we document. This would look like the following:

{
  id: "tmr_GGL7AQvcpJHaNm",
  object: "terminal.reader",
  action: {
    failure_code: "customer_canceled",
    failure_message: "This action could not be completed due to an error on the card reader.",
    process_payment_intent: {
      payment_intent: "pi_xxx",
      process_config: {
        "enable_customer_cancellation": true
      }
    },
    status: "failed",
    type: "process_payment_intent"
  }
  device_sw_version: "",
  device_type: "simulated_stripe_s700",
  ip_address: "0.0.0.0",
  label: "simulated-s700-5d8806e6-7701-4f79-ae12-3129d85ab8df",
  last_seen_at: 1751616166674,
  livemode: false,
  location: "tml_GGL7AAjOGDUNIz",
  metadata: {},
  serial_number: "5d8806e6-7701-4f79-ae12-3129d85ab8df",
  status: "online",
}
dreamy turret
#

Alright, thanks for the information

fickle merlin
#

I will raise this as something we should fix and provide a method for