예제 #1
0
// email header used for the payment notifications
$em_headers = "From: noreply@mydomain.com <from_email>\n";
$em_headers .= "Reply-To: from_email\n";
$em_headers .= "Return-Path: from_email\n";
$em_headers .= "Organization: Network27\n";
$em_headers .= "X-Priority: 3\n";
$paypal_ipn = new paypal_ipn($_POST);
foreach ($paypal_ipn->paypal_post_vars as $key => $value) {
    if (getType($key) == "string") {
        eval("\${$key}=\$value;");
    }
}
$paypal_ipn->send_response();
$paypal_ipn->error_email = $_SESSION['PAYPAL_NOTIFICATION_EMAIL'];
if (!$paypal_ipn->is_verified()) {
    $paypal_ipn->error_out("Bad order (PayPal says it's invalid)" . $paypal_ipn->paypal_response, $em_headers);
    die;
}
switch ($paypal_ipn->get_payment_status()) {
    case 'Pending':
        $pending_reason = $paypal_ipn->paypal_post_vars['pending_reason'];
        if ($pending_reason != "intl") {
            $paypal_ipn->error_out("Pending Payment - {$pending_reason}", $em_headers);
            break;
        }
    case 'Completed':
        if ($paypal_ipn->paypal_post_vars['txn_type'] == "reversal") {
            $reason_code = $paypal_ipn->paypal_post_vars['reason_code'];
            $paypal_ipn->error_out("PayPal reversed an earlier transaction.", $em_headers);
        } else {
            // Load the product from the DB
예제 #2
0
$txn_id = $_POST['txn_id'];
$payer_email = $_POST['payer_email'];
$payer_id = $_POST['custom'];
// PayPal will send the information through a POST
$paypal_info = $_POST;
$paypal_ipn = new paypal_ipn($paypal_info);
// where to contact us if something goes wrong
$paypal_ipn->error_email = $now["siteemail"];
// We send an identical response back to PayPal for verification
$paypal_ipn->send_response();
// PayPal will tell us whether or not this order is valid.
// This will prevent people from simply running your order script
// manually
if (!$paypal_ipn->is_verified()) {
    // bad order, someone must have tried to run this script manually
    $paypal_ipn->error_out("Bad order (PayPal says it's invalid)");
}
// payment status
switch ($paypal_ipn->get_payment_status()) {
    case 'Completed':
        // order is good
        break;
    case 'Pending':
        // money isn't in yet, just quit.
        // paypal will contact this script again when it's ready
        $paypal_ipn->error_out("Pending Payment");
        break;
    case 'Failed':
        // whoops, not enough money
        $paypal_ipn->error_out("Failed Payment");
        break;
<?php

// ---- PayPal IPN pocessing ------------
include "../include/payment/class.paypal_ipn.php";
include "../include/config.php";
include "../include/function.php";
global $config, $conn;
$paypal_info = $_POST;
$paypal_ipn = new paypal_ipn($paypal_info, "*****@*****.**", "*****@*****.**", 'Hello');
$paypal_ipn->send_response();
if (!isset($receiver_email)) {
    $paypal_ipn->error_out("Fraud attempt was detected. (PayPal's receiver email is not set)");
    exit;
}
$paypal_currency = 'USD';
if ($paypal_currency != $mc_currency) {
    $paypal_ipn->error_out("Fraud attempt was detected. (Payer uses another currency then site)");
    exit;
}
// should be changed:
if (strtolower($receiver_email) != strtolower($config[paypal_receiver_email])) {
    $paypal_ipn->error_out("Fraud attempt was detected. (PayPal's receiver email is not equal to attempting's receiver email: {$receiver_email})");
    exit;
}
if ($paypal_ipn->is_verified()) {
    $uniqueid = explode("|", $custom);
    $userid = $uniqueid[0];
    $pack_id = $uniqueid[1];
    $period = $uniqueid[2];
    $theprice = $uniqueid[3];
    //                mailing("*****@*****.**","Stream it Now","*****@*****.**","$userid, $pack, $period, $mailto","Test email");