unset($user_updates[$key]);
                     //only process the first next payment update
                     break;
                 }
             }
             //save updates in case we removed some
             update_user_meta($user_id, "pmpro_stripe_updates", $user_updates);
         }
         pmpro_stripeWebhookExit();
     } else {
         $logstr .= "We've already processed this order with ID #" . $order->id . ". Event ID #" . $event->id . ".";
         pmpro_stripeWebhookExit();
     }
 } elseif ($event->type == "charge.failed") {
     //last order for this subscription
     $old_order = getOldOrderFromInvoiceEvent($event);
     $user_id = $old_order->user_id;
     $user = get_userdata($user_id);
     if (!empty($old_order->id)) {
         do_action("pmpro_subscription_payment_failed", $old_order);
         //prep this order for the failure emails
         $morder = new MemberOrder();
         $morder->user_id = $user_id;
         $morder->billing->name = $old_order->billing->name;
         $morder->billing->street = $old_order->billing->street;
         $morder->billing->city = $old_order->billing->city;
         $morder->billing->state = $old_order->billing->state;
         $morder->billing->zip = $old_order->billing->zip;
         $morder->billing->country = $old_order->billing->country;
         $morder->billing->phone = $old_order->billing->phone;
         //get CC info that is on file
                     unset($user_updates[$key]);
                     //only process the first next payment update
                     break;
                 }
             }
             //save updates in case we removed some
             update_user_meta($user_id, "pmpro_stripe_updates", $user_updates);
         }
         pmpro_stripeWebhookExit();
     } else {
         $logstr .= "We've already processed this order with ID #" . $order->id . ". Event ID #" . $pmpro_stripe_event->id . ".";
         pmpro_stripeWebhookExit();
     }
 } elseif ($pmpro_stripe_event->type == "charge.failed") {
     //last order for this subscription
     $old_order = getOldOrderFromInvoiceEvent($pmpro_stripe_event);
     $user_id = $old_order->user_id;
     $user = get_userdata($user_id);
     if (!empty($old_order->id)) {
         do_action("pmpro_subscription_payment_failed", $old_order);
         //prep this order for the failure emails
         $morder = new MemberOrder();
         $morder->user_id = $user_id;
         $morder->billing->name = $old_order->billing->name;
         $morder->billing->street = $old_order->billing->street;
         $morder->billing->city = $old_order->billing->city;
         $morder->billing->state = $old_order->billing->state;
         $morder->billing->zip = $old_order->billing->zip;
         $morder->billing->country = $old_order->billing->country;
         $morder->billing->phone = $old_order->billing->phone;
         //get CC info that is on file