php paypal get transaction details from transaction id
//source -> https://developer.paypal.com/docs/archive/express-checkout/gs-transaction/
//other source -> https://stackoverflow.com/questions/37265008/paypal-get-transaction-details-with-php-curl
// you need to create a Business Account, where you will find Username, Pawword and Signature to use in api below.
//https://developer.paypal.com/developer/accounts -> Create Account -> type = Business
$api_request = 'USER=' . urlencode('sb-uv476n7785522_api1.business.example.com')
. '&PWD=' . urlencode('MFY3U3WwSFNC4qA1')
. '&SIGNATURE=' . urlencode('Af9ZQ4Kn6ONkdsjVrxPcuJTPmMGCAr2flOYtOGKgnKZ5f2ea5OSgLPiw')
. '&VERSION=78'
. '&METHOD=GetTransactionDetails'
. '&TransactionID=' . $transaction_id;
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp' ); // For live transactions, change to 'https://api-3t.paypal.com/nvp'
curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
// Uncomment these to turn off server and peer verification
// curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE );
// curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, FALSE );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_POST, 1 );
// Set the API parameters for this transaction
curl_setopt( $ch, CURLOPT_POSTFIELDS, $api_request );
// Request response from PayPal
$response = curl_exec( $ch );