Proxy Servers

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.

SetupAnchorIcon

Important

You must be using at least version 5.2.0 of the PHP SDK to set proxy server settings.

Set a proxy host and port in your gateway configuration:

  1. PHP
$config = new Braintree\Configuration([
    'environment' => 'sandbox',
    'merchantId' => 'sandbox_merchant_id',
    'publicKey' => 'sandbox_public_key',
    'privateKey' => 'sandbox_private_key',
    'proxyHost' => 'http://your-proxy-domain.com',
    'proxyPort' => '8080'
]);

$gateway = new Braintree\Gateway($config);

To use an authenticated proxy, you can additionally specify a username and password:

  1. PHP
$config = new Braintree\Configuration([
    'environment' => 'sandbox',
    'merchantId' => 'sandbox_merchant_id',
    'publicKey' => 'sandbox_public_key',
    'privateKey' => 'sandbox_private_key',
    'proxyHost' => 'http://your-proxy-domain.com',
    'proxyPort' => '8080',
    'proxyUser' => 'username',
    '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:

  1. PHP
$config = new Braintree\Configuration([
    'environment' => 'sandbox',
    'merchantId' => 'sandbox_merchant_id',
    'publicKey' => 'sandbox_public_key',
    'privateKey' => 'sandbox_private_key',
    'proxyHost' => 'http://your-proxy-domain.com',
    'proxyPort' => '8080',
    'proxyType' => 'CURLPROXY_SOCKS5_HOSTNAME'
]);

$gateway = new Braintree\Gateway($config);

If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites. Manage cookies and learn more