Iyzipay\Model\Payment::create() function returns empty
htuzel opened this issue · 2 comments
Hello,
I know there is another issue like that. But it's solution is not working for me.
I am using Laravel/Valet on macOS and I am trying to use Iyzipay\Model\Payment::create() function. But when I debug it, it returns empty.
I configured curl with a valid curl certificate. Also, I checked it with this command:
curl --cacert /Usr/local/etc/php/7.3/cacert.pem https://google.com
it seems it is working properly.
And my php.ini file like that
curl.cainfo = /Usr/local/etc/php/7.3/cacert.pem
But with this configuration, it still returns empty on my code.
Also, I tried
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
but it is not working, too. But I checked my sandbox account and noticed that all payments created successfully. But I need to verify payments on my side programmatically according to Iyzipay\Model\Payment::create()'s response.
I am waiting for your help. Thank you.
Hey,
I'm not a Iyzico developer, but have you checked like this?
$request = Iyzipay\Model\Payment::create(...);
if ($request->getErrorCode() !== null) {
var_dump(
$request->getErrorCode(),
$response->getErrorMessage(),
$request->getJsonObject(),
);
}
If you check the tests, you'll see that if the request has succeeded, the getErrorCode()
and getErrorMessage()
methods return null
, so this may help if the payment didn't succeed for whatever reason. I do checks by checking these methods. Also, try checking the data with getJsonJbject()
method if you need further data.
There are no error, but I didn't notice its data is private :(. I used getStatus() and it is working now.
Thank you @Ardakilic . It helped me to find solution.