getOrderFromInvoiceEvent

The Paid Memberships Pro getOrderFromInvoiceEvent function.

Description

getOrderFromInvoiceEvent( $pmpro_stripe_event ); 

Parameters (1)

0. $pmpro_stripe_event
The pmpro stripe event.

Usage

  1. if ( !function_exists( 'getOrderFromInvoiceEvent' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/services/stripe-webhook.php'; 
  3.  
  4. // The pmpro stripe event. 
  5. $pmpro_stripe_event = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = getOrderFromInvoiceEvent($pmpro_stripe_event); 
  9.  

Defined (1)

The function is defined in the following location(s).

/services/stripe-webhook.php  
  1. function getOrderFromInvoiceEvent($pmpro_stripe_event) 
  2. //pause here to give PMPro a chance to finish checkout 
  3.  
  4. $invoice_id = $pmpro_stripe_event->data->object->id; 
  5.  
  6. //getorderbyinvoiceid 
  7. $order = new MemberOrder(); 
  8. $order->getMemberOrderByPaymentTransactionID($invoice_id);  
  9.  
  10. if(!empty($order->id)) 
  11. return $order; 
  12. else 
  13. return false;