ipn listener paypel php

Solutions on MaxInterview for ipn listener paypel php by the best coders in the world

showing results for - "ipn listener paypel php"
Juan Diego
21 Oct 2019
1   // example for laravel
2	public function listener(Request $request)
3    {
4
5        $ch = curl_init();
6        curl_setopt($ch, CURLOPT_URL, 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
7        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
8        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
9        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
10        curl_setopt($ch, CURLOPT_POST, 1);
11        curl_setopt($ch, CURLOPT_POSTFIELDS, "cmd=_notify-validate&" . http_build_query($_POST));
12        $response = curl_exec($ch);
13        curl_close($ch);
14
15
16        if ($response == "VERIFIED") {
17
18            $this->payerEmail = $_POST['payer_email'];
19            $this->name = $_POST['first_name'] . " " . $_POST['last_name'];
20            $this->price = $_POST['mc_gross'];
21            $this->currency = $_POST['mc_currency'];
22            $this->paymentStatus = $_POST['payment_status'];
23            $this->amount = $_POST['quantity'];
24            $this->purchase_id = $_POST['txn_id']; 
25            //$this->other
26            //$this->other1
27            if ($this->paymentStatus == "Completed") {
28						// code if
29            } else {
30             
31                // code else
32            }
33        }
34    }