Created
September 1, 2019 04:56
-
-
Save earvinpiamonte/97371ef513fcd53cb5afced014a54592 to your computer and use it in GitHub Desktop.
PayPal: Client Authentication failed fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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