Skip to content
Snippets Groups Projects

WIP: Issue #3321915: Allow to store live and sandbox credentials for easy switching

Files
2
@@ -113,8 +113,11 @@ class PayPalCheckoutClient {
protected function acquireAccessToken() {
$ch = curl_init();
static::setDefaultCurlOptions($ch);
$client_id = $this->config['server'] === 'sandbox' ? $this->config['sandbox_client_id'] : $this->config['client_id'];
$secret = $this->config['server'] === 'sandbox' ? $this->config['sandbox_secret'] : $this->config['secret'];
$headers = array(
'Authorization' => 'Basic ' . base64_encode($this->config['client_id'] . ':' . $this->config['secret']),
'Authorization' => 'Basic ' . base64_encode($client_id . ':' . $secret),
'Content-Type' => 'application/x-www-form-urlencoded',
) + $this->headers;
$url = $this->baseUrl() . '/v1/oauth2/token';
Loading