#ChrisG AtoB
1 messages · Page 1 of 1 (latest)
Authorization request event id evt_1LpZYZJUU4vq0xoerOg0wcsJ
Authorization created event id
evt_1LpZYaJUU4vq0xoeADxd5nG9
Thanks lookoing
Okay so you are specifically talking about in the issuing_authorization.created you are seeing request_history.reason: "webhook_timeout",
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.
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
Thanks!
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
Okay
So looks like you are sending a string here in the response instead of an integer
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
Yes you can see the response in your Dashboard.
How are you responding to the webhook exactly?
it's a http response to original request, if you're referring to if we're doing that or calling Stripe::Authorization.approve
Can you provide your actual response code so I can take a peek?
{approved: true}
.merge(amount: @amount_approved.cents) # uses https://github.com/RubyMoney/money
.merge(approve_metadata.deep_transform_values(&:to_s))
Hmm and have you logged out that @amount_approved.cents just before this response is sent?
Money#cents returns an integer
possible that .merge is stringifying it for some reason?
Really don't think it should be doing that....
🤔
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}"
it's still an integer in the json
Was the second PRY output.to_json?
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
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.
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
Sounds good.