Skip to content

Instantly share code, notes, and snippets.

@sidharrell
Last active December 26, 2015 03:39
Show Gist options
  • Save sidharrell/7087307 to your computer and use it in GitHub Desktop.
Save sidharrell/7087307 to your computer and use it in GitHub Desktop.
for laggy paypal ipn messaging, set attendee payment status to "Pending"
// replaces line 24 of gateways/paypal/paypal_ipn.php
if (empty($_POST['ipn_track_id']) && ($_POST['payment_status'] == 'Completed' || $_POST['payment_status'] == 'Pending')) {
$payment_data['txn_details'] = serialize($_POST);
$payment_data['txn_id'] = $_POST['txn_id'];
$payment_data['payment_status'] = 'Pending';
} elseif ($myPaypal->validateIpn()) {
// replaces line 12 on gateways/paypal/init.php, to add the second line in
add_filter('filter_hook_espresso_transactions_get_payment_data', 'espresso_process_paypal');
add_filter('filter_hook_espresso_thank_you_get_payment_data', 'espresso_process_paypal');
//replaces lines 69-78 in gateways/paypal/paypal_vars.php:
$myPaypal->addField('business', $paypal_id);
$return_url = espresso_build_gateway_url('return_url', $payment_data, 'paypal');
$cancel_url = espresso_build_gateway_url('cancel_return', $payment_data, 'paypal');
$notify_url = espresso_build_gateway_url('notify_url', $payment_data, 'paypal', array('event_id' => $event_id));
$myPaypal->addField('charset', "utf-8");
$myPaypal->addField('return', $return_url);
$myPaypal->addField('cancel_return', $cancel_url);
$myPaypal->addField('notify_url', $notify_url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment