Get the Transaction ID from paypal plus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.".paypal.com/v1/payments/payment/".$_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);
$payed=$json->transactions[0]->related_resources[0]->sale->state;
$transaction_id = $json->transactions[0]->related_resources[0]->sale->transactionId;
if ($payed != "completed") {
die('Die Zahlung konnte nicht erfolgreich durchgeführt werden');
}
}
- Labels:
-
PayPal HTML Buttons
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Sandbox account not generating IPNs in Sandbox Environment
- Disputes Webhook does not works on Sandbox (23/04/24) in Sandbox Environment
- Customising Paypal Checkout Button in PayPal Payments Standard
- Pending Transaction - CLearly Declined by Merchant in PayPal Payments Standard
- SetExpressCheckout 10003 error with ITEMCATEGORY=Digital in NVP/SOAP APIs