rpip / paystack-go

Go library for the Paystack API https://developers.paystack.co/v1.0/reference
MIT License
62 stars 39 forks source link

Error 400 #6

Open darmie opened 4 years ago

darmie commented 4 years ago

Kindly see if there's need for an update to this library.

I am getting an error 400 while trying to create a subaccount.

sa, err := r.Paystack.SubAccount.Create(&paystack.SubAccount{
            BusinessName:        *data.Name,
            SettlementBank:      *data.Bank,
            AccountNumber:       *data.AccountNumber,
            PercentageCharge:    PercentageCharge,
            SettlementSchedule:  SettlementSchedule,
            PrimaryContactEmail: *data.Email,
            Metadata:            metadata,
        })

if err != nil {
    return nil, err
}

{\"code\":400,\"details\":{},\"url\":{\"Scheme\":\"https\",\"Opaque\":\"\",\"User\":null,\"Host\":\"api.paystack.co\",\"Path\":\"/subaccount\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"header\":{\"Access-Control-Allow-Origin\":[\"*\"],\"Cf-Cache-Status\":[\"DYNAMIC\"],\"Cf-Ray\":[\"548097858dd2cdb7-CDG\"],\"Content-Length\":[\"64\"],\"Content-Type\":[\"application/json; charset=utf-8\"],\"Date\":[\"Fri, 20 Dec 2019 09:29:26 GMT\"],\"Etag\":[\"W/\\\"40-IhinKFxsDy9hOhy0AlnrOg\\\"\"],\"Expect-Ct\":[\"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"],\"Server\":[\"cloudflare\"],\"Set-Cookie\":[\"__cfduid=d966225626d511709c7deeaa7f9fc4a0c1576834166; expires=Sun, 19-Jan-20 09:29:26 GMT; path=/; domain=.paystack.co; HttpOnly; SameSite=Lax; Secure\",\"sails.sid=s%3AbLrbTdaDSSzE3xP9RhdNBkJkz68T0hrU.ElX48nd0jxKE%2BTOfOyxbNvv6ILMTTgxlgJcRlPZatdI; Path=/; HttpOnly; Secure\"],\"Strict-Transport-Security\":[\"max-age=15552000; includeSubDomains; preload\"],\"Vary\":[\"X-HTTP-Method-Override, Accept-Encoding\"],\"X-Content-Type-Options\":[\"nosniff\"],\"X-Powered-By\":[\"Sails \\u003csailsjs.org\\u003e\"]}}

darmie commented 4 years ago

Nevermind, I figured that paystack servers may be rejecting my SSL certificate.

ozombo commented 3 years ago

@darmie how did you solve this?

darmie commented 3 years ago

@ozombo i figured that I couldn't handle Paystack golang API from inside a containerized application, due to certificates validation reasons...

This is a very old issue and I don't remember how I worked around it.

ozombo commented 3 years ago

@darmie mine occurred with charge creation and after lots of hair pulling I figured out it was some issues with the card struct. Made a pr for it tho

sendloveboxafrica commented 1 year ago

yet to be reviewed