yabacon / paystack-php

A PHP Wrapper for Paystack API - https://www.paystack.com
MIT License
109 stars 70 forks source link

ApiException on live server #7

Open kingstuffy opened 7 years ago

kingstuffy commented 7 years ago

I got the following error when using the library on a live server even though it works locally on my system. All resource method returns the same error.

`Yabacon\Paystack\Exception\ApiException

Paystack Request failed with response: '

400 Bad Request

400 Bad Request


cloudflare-nginx

`

ibrahimlawal commented 7 years ago

@kingstuffy what version of the library are you using?

kingstuffy commented 7 years ago

@ibrahimlawal v2.1, installed via composer

ibrahimlawal commented 7 years ago

@kingstuffy this was because the originating server didn't send valid data to our API. We built in a file_get_contents fallback which is really non-standard and will only work on some servers. Future versions might remove this fallback

gofaniyi commented 7 years ago

@ibrahimlawal faced with this problem, (action: trying to verify transaction using ref_no). Running PHP 5.5.12, OpenSSL 1.0.2, Curl 7.36.0

image

ibrahimlawal commented 7 years ago

I'm pushing an update that allows you disable the file_get_contents fallback. Please do that like so:

Yabacon\Paystack::disableFileGetContentsFallback()

And let me know what the error message is.

gofaniyi commented 7 years ago

@ibrahimlawal Trying the Library v2.1.16. See error message.

"Curl failed with response: 'SSL certificate problem: unable to get local issuer certificate'."

ibrahimlawal commented 7 years ago

Great, this should help: https://github.com/unicodeveloper/laravel-paystack/issues/14#issuecomment-281752633

ibrahimlawal commented 7 years ago

@kingstuffy @Kendysond @gofaniyi the fix is wiki-ed here: https://github.com/yabacon/paystack-php/wiki/cURL-error-60:-SSL-certificate-problem:-unable-to-get-local-issuer-certificate-(see-http:--curl.haxx.se-libcurl-c-libcurl-errors.html)

ibrahimlawal commented 7 years ago

@gofaniyi let me know if this works for you.

gofaniyi commented 7 years ago

@ibrahimlawal This (unicodeveloper/laravel-paystack#14 (comment)) resolves the problem at hand. Thanks