Search
 
SCRIPT & CODE EXAMPLE
 

PHP

ipn listener paypel php

   // example for laravel
	public function listener(Request $request)
    {

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, "cmd=_notify-validate&" . http_build_query($_POST));
        $response = curl_exec($ch);
        curl_close($ch);


        if ($response == "VERIFIED") {

            $this->payerEmail = $_POST['payer_email'];
            $this->name = $_POST['first_name'] . " " . $_POST['last_name'];
            $this->price = $_POST['mc_gross'];
            $this->currency = $_POST['mc_currency'];
            $this->paymentStatus = $_POST['payment_status'];
            $this->amount = $_POST['quantity'];
            $this->purchase_id = $_POST['txn_id']; 
            //$this->other
            //$this->other1
            if ($this->paymentStatus == "Completed") {
						// code if
            } else {
             
                // code else
            }
        }
    }
Comment

PREVIOUS NEXT
Code Example
Php :: php string replace space 
Php :: use wordpress functions in external php file 
Php :: used resoure route how to add another route 
Php :: how convert big text to array that text have br in laravel 
Php :: display rows brought back by query php 
Php :: how to update all row in laravel 
Php :: remove index.php from url htaccess 
Php :: how create new command in laravel 
Php :: get message validator failed laravel 
Php :: laravel cashier overwrite users table name 
Php :: calcul age php datetime 
Php :: laravel tinker factory 
Php :: laravel abort_if 
Php :: php post curl json 
Php :: check if $_files is empty php 
Php :: Morocco 
Php :: php remove class attribute 
Php :: change php version in ubuntu 
Php :: phpspreadsheet applyFromArray wrap 
Php :: php string contains string 
Php :: laravel forelse 
Php :: contact form 7 select disabled option 
Php :: write file in php 
Php :: centos excecutable php 
Php :: php inline if 
Php :: access config variable in codeigniter controller 
Php :: checking php version 
Php :: laravel loop through collection 
Php :: php loop backwards through array 
Php :: prestashop get all products 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =