#Implement Paypal Chained Payment in PHP
Refer to the tutorial to install the PHP class library for Paypal.
Open the below file.
/path/to/config.php
Define whether it is sandbox or live in the $sandbox variable and update your URL in the $domain variable.
$host_split = explode('.',$_SERVER['HTTP_HOST']);
$sandbox = $host_split[0] == 'sandbox' && $host_split[1] == 'domain' ? TRUE : FALSE;
$sandbox = TRUE; //BOOLEAN
$domain = $sandbox ? 'SANDBOX_URL' : 'LIVE_URL';
Update the paypal credentials below.
$application_id = $sandbox ? 'SANDBOX_APP_ID' : 'LIVE_APP_ID';
$developer_account_email =
$sandbox ? 'SANDBOX_DEVELOPER_EMAIL' : 'LIVE_DEVELOPER_EMAIL';
$api_username = $sandbox ? 'SANDBOX_API_USERNAME' : 'LIVE_API_USERNAME';
$api_password = $sandbox ? 'SANDBOX_API_PASSWORD' : 'LIVE_API_PASSWORD';
$api_signature = $sandbox ? 'SANDBOX_API_SIGNATURE' : 'LIVE_API_SIGNATURE';
$rest_client_id = $sandbox ? 'SANDBOX_CLIENT_ID' : 'LIVE_CLIENT_ID';
$rest_client_secret = $sandbox ? 'SANDBOX_SECRET_ID' : 'LIVE_SECRET_ID';