razorpay / razorpay-php

Razorpay PHP Library
MIT License
186 stars 128 forks source link

CURL error : 60 ssl certificate problem #371

Open infohappycoders opened 9 months ago

infohappycoders commented 9 months ago

Steps to reproduce the behavior

I'm getting below error on order create. PHP 7.3 LARAVEL 5.6 Razorpay latest library

Error : CURL error 60: SSL certificate problem: unable to get local issuer certificate

I have already added the whitelisted key .

Expected behavior

Curl failed due to SSL verify issue

Actual behavior

Curl get response when order create image (1)

Code snippets

No response

Php version

7.3

Library version

2.8.4

Additional Information

No response

drkhosla commented 9 months ago

I am also facing same problem.

Fatal error: Uncaught WpOrg\Requests\Exception: cURL error 60: SSL certificate problem: unable to get local issuer certificate in /var/www/html/php-razorpay/vendor/rmccue/requests/src/Transport/Curl.php on line 490

WpOrg\Requests\Exception: cURL error 60: SSL certificate problem: unable to get local issuer certificate in /var/www/html/php-razorpay/vendor/rmccue/requests/src/Transport/Curl.php on line 490

while creating order

razorpay-error

I am struggling with this problem during development from last few days. I try to update all cacert.pem file. But fail to get result. I am using http as well as https for localhost.

infohappycoders commented 9 months ago

This is the issue on Razorpay server side. No response from razorpay team.

infohappycoders commented 9 months ago

Finally found the solution. Follow the below solution to fix the error.

Download the latest certificate from razorpay and add inside your vendor razorpay code https://razorpay.com/docs/security/whitelists/#ssl-certificates

Add the certificate in to the bottom of the file :

vendor/razorpay/razorpay/libs/Requests-2.0.4/certificates/cacert.pem

Path : vendor/razorpay/razorpay/src/request.php

 $options = array(
        'auth' => array(Api::getKey(), Api::getSecret()),
        'hook' => $hooks,
        'timeout' => 60,
    );

Change the code to

 $options = array(
        'auth' => array(Api::getKey(), Api::getSecret()),
        'hook' => $hooks,
        'timeout' => 60,
    'verify' => true
    );

After these two changes it will work. If any one need help let me know TLS Certificate Updates.pdf

ankitaginhotry-1890 commented 9 months ago

@infohappycoders Brother is this any possibility to use sdk function to make call by using Oauth2.0 accessToken ?

infohappycoders commented 9 months ago

@infohappycoders Brother is this any possibility to use sdk function to make call by using Oauth2.0 accessToken ?

Could you please provide more information. We are using api call by razorpay key and secret. Oauth no needed

ankitaginhotry-1890 commented 9 months ago

@infohappycoders Brother i want to use use the sdk with the access token get from the Oauth 2.0 flow.

I just want to init a client of Razorpay php SKD by using Oauth2.0 access token instead of Basic Oauth which uses key and secret..

ankitaginhotry-1890 commented 9 months ago

hope you understand if not then please tell me i will provide more info about it..

amitbk commented 9 months ago

@infohappycoders Thanks for the solution. But I was not able to find vendor/razorpay/razorpay/libs/Requests-2.0.4/certificates/cacert.pem Can you help?

infohappycoders commented 9 months ago

@infohappycoders Thanks for the solution. But I was not able to find vendor/razorpay/razorpay/libs/Requests-2.0.4/certificates/cacert.pem Can you help?

Please download the latest repository version from git. I think you are using very older version. Just download the latest version here and replace razorpay folder. It's need minimum php version 7.3

infohappycoders commented 9 months ago

hope you understand if not then please tell me i will provide more info about it..

Sorry , You need to check with Razorpay support team.

amitbk commented 9 months ago

@infohappycoders Thanks for the solution. But I was not able to find vendor/razorpay/razorpay/libs/Requests-2.0.4/certificates/cacert.pem Can you help?

Please download the latest repository version from git. I think you are using very older version. Just download the latest version here and replace razorpay folder. It's need minimum php version 7.3

Thanks it is working for me now. It was a big issue for me. Tried many solutions and yours is working.

infohappycoders commented 9 months ago

@infohappycoders Thanks for the solution. But I was not able to find vendor/razorpay/razorpay/libs/Requests-2.0.4/certificates/cacert.pem Can you help?

Please download the latest repository version from git. I think you are using very older version. Just download the latest version here and replace razorpay folder. It's need minimum php version 7.3

Thanks it is working for me now. It was a big issue for me. Tried many solutions and yours is working.

Happy to hear 😊

ankitaginhotry-1890 commented 9 months ago

hope you understand if not then please tell me i will provide more info about it..

Sorry , You need to check with Razorpay support team.

Okay thanks for coordinating.

Mainak009 commented 1 month ago

Finally found the solution. Follow the below solution to fix the error.

Download the latest certificate from razorpay and add inside your vendor razorpay code https://razorpay.com/docs/security/whitelists/#ssl-certificates

Add the certificate in to the bottom of the file :

vendor/razorpay/razorpay/libs/Requests-2.0.4/certificates/cacert.pem

Path : vendor/razorpay/razorpay/src/request.php

 $options = array(
        'auth' => array(Api::getKey(), Api::getSecret()),
        'hook' => $hooks,
        'timeout' => 60,
    );

Change the code to

 $options = array(
        'auth' => array(Api::getKey(), Api::getSecret()),
        'hook' => $hooks,
        'timeout' => 60,
    'verify' => true
    );

After these two changes it will work. If any one need help let me know TLS Certificate Updates.pdf

still working with cakePHP too