Showing results for 
Search instead for 
Did you mean: 

Get the Transaction ID from paypal plus

New Community Member
Posted on

Following Code works fine to close the order. But I need the transaktion id. I have no idea how to manage this. Can anybody help?


if (isset($_GET['paymentId']) && isset($_GET['PayerID'])) {

$mode= ".sandbox";

$ch = curl_init();
$headers=array('Content-Type:application/json','Authorization:Bearer '.$access_token);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, "https://api".$mode."".$_GET['paymentId']."/execute");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$jsons='{ "payer_id" : "'.$_GET['PayerID'].'" }';
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsons);
$result = curl_exec($ch);
$json = json_decode($result);

$transaction_id = $json->transactions[0]->related_resources[0]->sale->transactionId;


if ($payed != "completed") {

die('Die Zahlung konnte nicht erfolgreich durchgeführt werden');



Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.