Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save earvinpiamonte/97371ef513fcd53cb5afced014a54592 to your computer and use it in GitHub Desktop.
Save earvinpiamonte/97371ef513fcd53cb5afced014a54592 to your computer and use it in GitHub Desktop.
PayPal: Client Authentication failed fix
<?php
//
// Assuming you already installed paypal/rest-api-sdk-php
// https://github.com/paypal/PayPal-PHP-SDK/wiki/Installation
//
// Autoload SDK package
// if using composer
require __DIR__ . '/vendor/autoload.php';
// else if using direct download
// require __DIR__ . '/PayPal-PHP-SDK/autoload.php';
// PayPal keys
$config['paypal'] = array(
'client_id' => 'your_live_client_id_here',
'secret' => 'your_live_secret_here'
);
// PayPal API context
$api_context = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
$config['paypal']['client_id'],
$config['paypal']['secret']
)
);
// Set mode to LIVE
$api_context->setConfig(
array(
'mode' => 'live'
)
);
//
// you may now create a new payment, etc.
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment