#ChrisG AtoB

1 messages · Page 1 of 1 (latest)

wary pythonBOT
scenic apex
#

Hey there

#

Can you provide me an example event I can look at?

grizzled jungle
#

Authorization request event id evt_1LpZYZJUU4vq0xoerOg0wcsJ
Authorization created event id
evt_1LpZYaJUU4vq0xoeADxd5nG9

scenic apex
#

Thanks lookoing

#

Okay so you are specifically talking about in the issuing_authorization.created you are seeing request_history.reason: "webhook_timeout",

grizzled jungle
#

Yes

#

But the request itself we responded in around 500ms

scenic apex
#

Gotcha. I would guess this is due to the direct response to the issuing_authorization.request webhook where you approved that. And we are just incorrectly showing a "timeout" here when really this was just a direct response reasoning.

grizzled jungle
#

That's what we're hoping it is... any way to get confirmation? We need to be able to set the amounts for controllable requests and if it's really being considered a timeout on Stripe's end then we lose that control

scenic apex
#

Flagging internally right now

#

I'll circle back

grizzled jungle
#

Thanks!

acoustic plaza
#

Here's a better example where we think our approval response isn't actually being used:

Authorization: iauth_1LpanoJUU4vq0xoeRdRKdYXM

Event 1 - issuing_authorization.request (for $0) evt_1LpanpJUU4vq0xoecNukYXtc
We respond here by approving for $120

Event 2 - issuing_authorization.created (for $150) evt_1LpanqJUU4vq0xoe27eY8K3Y
Stripe auto approves the transaction for $150, even though we had approved $120

scenic apex
#

Thanks

#

We are investigating

scenic apex
#

Okay

#

So looks like you are sending a string here in the response instead of an integer

grizzled jungle
#

In the examples provided they were both strings?

#

We were wondering about that because as far as we can tell they are integers when they leave us but the event's response in Stripe shows them as a String

scenic apex
#

Yes you can see the response in your Dashboard.

#

How are you responding to the webhook exactly?

grizzled jungle
#

it's a http response to original request, if you're referring to if we're doing that or calling Stripe::Authorization.approve

scenic apex
#

Can you provide your actual response code so I can take a peek?

grizzled jungle
#
      {approved: true}
        .merge(amount: @amount_approved.cents) # uses https://github.com/RubyMoney/money
        .merge(approve_metadata.deep_transform_values(&:to_s))
scenic apex
#

Hmm and have you logged out that @amount_approved.cents just before this response is sent?

grizzled jungle
#

Money#cents returns an integer

scenic apex
#

possible that .merge is stringifying it for some reason?

#

Really don't think it should be doing that....

#

🤔

grizzled jungle
#

doubtful... but something I'm looking into is this...

return render json: output.to_json, status: :ok

output here is the result of what I posted before

#
[1] pry(main)> {approved:true, amount: Money.from_cents(12345).cents}
=> {:approved=>true, :amount=>12345}
#
[2] pry(main)> {approved:true, amount: Money.from_cents(12345).cents}.to_json
=> "{\"approved\":true,\"amount\":12345}"
scenic apex
#

Yep

#

output.to_json

#

Hmm wait

grizzled jungle
#

it's still an integer in the json

scenic apex
#

Was the second PRY output.to_json?

grizzled jungle
#

Here's an example if I tell Money to format it as a string

[3] pry(main)> {approved:true, amount: Money.from_cents(12345).format}.to_json
=> "{\"approved\":true,\"amount\":\"$123.45\"}"
#

It was

scenic apex
#

Oh

#

So I'm not positive what is going on, but I would first just test hardcoding an amount integer here in your response to determine whether it is actually the Money library that is the ultimate reason for the String and then go from there.

grizzled jungle
#

When I get back I will try this locally against Stripe test environment. For now we're sticking an additional log in just before we render the response to see what output is

scenic apex
#

Sounds good.