PHP Classes

File: paypal_ipn.php

Recommend this page to a friend!
  Classes of Md Emran Hasan   Payment Gateway Library   paypal_ipn.php   Download  
File: paypal_ipn.php
Role: Example script
Content type: text/plain
Description: Paypal IPN
Class: Payment Gateway Library
Accept payments with Paypal, Authorize.net and 2CO
Author: By
Last change:
Date: 15 years ago
Size: 542 bytes
 

Contents

Class file image Download
<?php

// Include the paypal library
include_once ('Paypal.php');

// Create an instance of the paypal library
$myPaypal = new Paypal();

// Log the IPN results
$myPaypal->ipnLog = TRUE;

// Enable test mode if needed
$myPaypal->enableTestMode();

// Check validity and write down it
if ($myPaypal->validateIpn())
{
    if (
$myPaypal->ipnData['payment_status'] == 'Completed')
    {
        
file_put_contents('paypal.txt', 'SUCCESS');
    }
    else
    {
        
file_put_contents('paypal.txt', "FAILURE\n\n" . $myPaypal->ipnData);
    }
}