Closed ja-cast closed 3 years ago
A socket timeout (read timeout) of 3 seconds (3000) is not enough for operations like create payment. Try increasing it to at least 30000 (30 seconds).
I increased the read timeout to 60 seconds, but still got the same timeout error
Do you also get a timeout error if you try calling TestConnection?
Yes, I get the same result:
Since that call should succeed within 60 seconds, the issue may lie somewhere else.
From the same machine, can you try to do a cURL request to the same URL?
curl https://eu.sandbox.api-ingenico.com/v1/1095/services/testconnection
This should return a 403 response, since obviously the authentication part is missing, but if there is an issue in the network this command should fail as well. For reference, if I try it I get a 403 error almost immediately.
Executing the curl, I get the 403 as expected
I tried it locally (using Testconnection), and I got the same result. Printing the configuration showed that the issue lies in the unit of time and the conversion used by time.Duration. Without an explicit unit, the value is considered to be nanoseconds. By specifying 5000 you don't get 5 seconds, but 5 microseconds.
Ideally the solution would be to change the 3000
into 3000ms
or 3s
, which is how you would define it when using time.ParseDuration
. However, toml isn't able to use this. Therefore, the solution is to specify the timeouts in nanoseconds, by appending 000000
(6 zeroes) to the current values.
I will make sure that the documentation at https://epayments.developer-ingenico.com/documentation/sdk/server/go/ will be updated.
Thanks, adding the zeros to the timeouts solved the problem.
You're welcome.
I am trying to post a create payment request using the GO SDK in sandbox environment. I already created my sandbox account, and my merchantID is: 1095. The payment method I'm trying to use is WechatPay, QRCode integration. however I'm getting a timeout when I post the payment request. The exact message I'm getting is:
There was an error in the communication with the Ingenico ePayments platform Post "https://world.preprod.api-ingenico.com/v1/1095/payments": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
I already checked network block, but I don't seem to have any blocking rule on my side.
Here is my code:
`package main
import ( "fmt"
)
func main() {
}
func newBool(value bool) *bool { return &value }
func newInt32(value int32) *int32 { return &value }
func newInt64(value int64) *int64 { return &value }
func newString(value string) *string { return &value } `