Exemple #1
0
	//assign posted variables to local variables
	$txn_type = pmpro_getParam("txn_type", "POST");
	$subscr_id = pmpro_getParam("subscr_id", "POST");
	$txn_id = pmpro_getParam("txn_id", "POST");
	$item_name = pmpro_getParam("item_name", "POST");
	$item_number = pmpro_getParam("item_number", "POST");
	$payment_status = pmpro_getParam("payment_status", "POST");
	$payment_amount = pmpro_getParam("payment_amount", "POST");
	$payment_currency = pmpro_getParam("payment_currency", "POST");
	$txn_id = pmpro_getParam("txn_id", "POST");
	$receiver_email = pmpro_getParam("receiver_email", "POST");
	$payer_email = pmpro_getParam("payer_email", "POST");			
	
	//check the receiver_email
	if(!pmpro_ipnCheckReceiverEmail($receiver_email))
	{
		//not our request
		pmpro_ipnExit();
	}
	
	/*
		PayPal Standard
		- we will get txn_type subscr_signup and subscr_payment (or subscr_eot or subscr_failed)
		- subscr_signup (if amount1 = 0, then we need to update membership, else ignore and wait for payment. create invoice for $0 with just subscr_id)
		- subscr_payment (check if we should update membership, add invoice for amount with subscr_id and payment_id)
		- web_accept for 1-time payment only
		
		PayPal Express
		- we will get txn_type express_checkout, or recurring_payment_profile_created, or recurring_payment (or recurring_payment_expired, or recurring_payment_skipped)
		
$subscr_id = pmpro_getParam("subscr_id", "POST");
$txn_id = pmpro_getParam("txn_id", "POST");
$item_name = pmpro_getParam("item_name", "POST");
$item_number = pmpro_getParam("item_number", "POST");
$payment_status = pmpro_getParam("payment_status", "POST");
$payment_amount = pmpro_getParam("payment_amount", "POST");
$payment_currency = pmpro_getParam("payment_currency", "POST");
$receiver_email = pmpro_getParam("receiver_email", "POST");
$business_email = pmpro_getParam("business", "POST");
$payer_email = pmpro_getParam("payer_email", "POST");
$recurring_payment_id = pmpro_getParam("recurring_payment_id", "POST");
if (empty($subscr_id)) {
    $subscr_id = $recurring_payment_id;
}
//check the receiver_email
if (!pmpro_ipnCheckReceiverEmail(array(strtolower($receiver_email), strtolower($business_email)))) {
    //not our request
    pmpro_ipnExit();
}
/*
		PayPal Standard
		- we will get txn_type subscr_signup and subscr_payment (or subscr_eot or subscr_failed)
		- subscr_signup (if amount1 = 0, then we need to update membership, else ignore and wait for payment. create invoice for $0 with just subscr_id)
		- subscr_payment (check if we should update membership, add invoice for amount with subscr_id and payment_id)
		- web_accept for 1-time payment only
	PayPal Express
		- we will get txn_type express_checkout, or recurring_payment_profile_created, or recurring_payment (or recurring_payment_expired, or recurring_payment_skipped)
*/
//PayPal Standard Sign Up
if ($txn_type == "subscr_signup") {
    //if there is no amount1, this membership has a trial, and we need to update membership/etc
}
//assign posted variables to local variables
$txn_type = pmpro_getParam("txn_type", "POST");
$subscr_id = pmpro_getParam("subscr_id", "POST");
$txn_id = pmpro_getParam("txn_id", "POST");
$item_name = pmpro_getParam("item_name", "POST");
$item_number = pmpro_getParam("item_number", "POST");
$payment_status = pmpro_getParam("payment_status", "POST");
$payment_amount = pmpro_getParam("payment_amount", "POST");
$payment_currency = pmpro_getParam("payment_currency", "POST");
$txn_id = pmpro_getParam("txn_id", "POST");
$receiver_email = pmpro_getParam("receiver_email", "POST");
$business_email = pmpro_getParam("business", "POST");
$payer_email = pmpro_getParam("payer_email", "POST");
//check the receiver_email
if (!pmpro_ipnCheckReceiverEmail(array($receiver_email, $business_email))) {
    //not our request
    pmpro_ipnExit();
}
/*
		PayPal Standard
		- we will get txn_type subscr_signup and subscr_payment (or subscr_eot or subscr_failed)
		- subscr_signup (if amount1 = 0, then we need to update membership, else ignore and wait for payment. create invoice for $0 with just subscr_id)
		- subscr_payment (check if we should update membership, add invoice for amount with subscr_id and payment_id)
		- web_accept for 1-time payment only
	PayPal Express
		- we will get txn_type express_checkout, or recurring_payment_profile_created, or recurring_payment (or recurring_payment_expired, or recurring_payment_skipped)
*/
//PayPal Standard Sign Up
if ($txn_type == "subscr_signup") {
    //if there is no amount1, this membership has a trial, and we need to update membership/etc