* As such, we need to loop through all the payment info in the response. * * The library helps us do this using the GetExpressCheckoutPaymentInfo() method. We'll * load our $payments_info using that method, and then loop through the results to pull * out our details for the transaction. * * Again, in this case we are you only working with a single payment, but we'll still * loop through the results accordingly. * * Here, we're only pulling out the PayPal transaction ID and fee amount, but you may * refer to the API reference for all the additional parameters you have available at * this point. * * https://developer.paypal.com/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/ */ $payments_info = $PayPal->GetExpressCheckoutPaymentInfo($PayPalResult); foreach ($payments_info as $payment_info) { $_SESSION['paypal_transaction_id'] = isset($payment_info['TRANSACTIONID']) ? $payment_info['TRANSACTIONID'] : ''; $_SESSION['paypal_fee'] = isset($payment_info['FEEAMT']) ? $payment_info['FEEAMT'] : ''; } } else { $_SESSION['paypal_errors'] = $PayPalResult['ERRORS']; header('Location: /demo/error.php'); exit; } /** * Here we're simply generating a very basic result page that * will display a popup message notifying the user whether * the payment was successful or not, and will then close * the payment window, leaving the user right back where they * were prior to starting payment.