If your server requires HTTP requests to be made through a proxy, you can follow these steps to set up proxies for the server-side SDK.
Setup
Set a proxy host and port in your gateway configuration:
PHP
Copy
Copied
$config = new Braintree\Configuration([
'environment' => 'sandbox',
'merchantId' => 'sandbox_merchant_id',
'publicKey' => 'sandbox_public_key',
'privateKey' => 'sandbox_private_key'
]);
$config->proxyHost('http://your-proxy-domain.com');
$config->proxyPort('8080');
$gateway = new Braintree_Gateway($config);
To use an authenticated proxy, you can additionally specify a username and password:
PHP
Copy
Copied
$config = new Braintree\Configuration([
'environment' => 'sandbox',
'merchantId' => 'sandbox_merchant_id',
'publicKey' => 'sandbox_public_key',
'privateKey' => 'sandbox_private_key'
]);
$config->proxyHost('http://your-proxy-domain.com');
$config->proxyPort('8080');
$config->proxyUser('username');
$config->proxyPassword('password');
$gateway = new Braintree_Gateway($config);
If you want to specify the type of proxy (cURL's CURLOPT_PROXYTYPE
), you can specify it by setting 'proxyType'
. For example, if you're using a SOCKS5 proxy with a hostname, it would be:
PHP
Copy
Copied
$config = new Braintree\Configuration([
'environment' => 'sandbox',
'merchantId' => 'sandbox_merchant_id',
'publicKey' => 'sandbox_public_key',
'privateKey' => 'sandbox_private_key'
]);
$config->proxyType('CURLPROXY_SOCKS5_HOSTNAME');
$gateway = new Braintree_Gateway($config);