Proxy Serversanchor

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.

Setupanchor

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 BraintreeConfiguration([
    'environment' => 'sandbox',
    'merchantId' => 'sandbox_merchant_id',
    'publicKey' => 'sandbox_public_key',
    'privateKey' => 'sandbox_private_key',
    'proxyHost' => 'http://your-proxy-domain.com',
    'proxyPort' => '8080'
]);

$gateway = new BraintreeGateway($config);

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

  1. PHP
$config = new BraintreeConfiguration([
    '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 BraintreeGateway($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 BraintreeConfiguration([
    '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 BraintreeGateway($config);