Can be it possible to use curl in Magento 2 payment module to set up a custom payment?
If possible, how can I do that?
Can be it possible to use curl in Magento 2 payment module to set up a custom payment?
If possible, how can I do that?
Hi @bbbmishucs,
This is here I explored the internet for your queries Payment module in magento 2 you can try this one
https://webkul.com/blog/use-curl-magento-2/
If it's use full for you, then you give kudos and accept as solutions
Hey @bbbmishucs
You can use cUrl in magento like:
protected $curlClient;
in construct you have to add:
public function __construct( \Magento\Framework\HTTP\Client\Curl $curl ) { $this->curlClient = $curl; }
Then you can use cUrl like using this:
$this->curlClient->post($serviceUrl, []);
As we know we have many options for curl so for this you can check
"vendor\magento\framework\HTTP\Client\Curl.php" This file for more functions.Some of them are:
addHeader() setCredentials() addCookie() get() // for get request makeRequest() // for make request setOption() // set curl options
Hope this help if you find this useful accept it as solution and kudos thanks.