/** * Get Member's Stripe Customer Object. * * @since 1.0.0 * @internal * * @param MS_Model_Member $member The member. */ public function find_customer($member) { $customer_id = $member->get_gateway_profile(self::ID, 'customer_id'); $customer = null; if (!empty($customer_id)) { $customer = M2_Stripe_Customer::retrieve($customer_id); // Seems like the customer was manually deleted on Stripe website. if (isset($customer->deleted) && $customer->deleted) { $customer = null; $member->set_gateway_profile(self::ID, 'customer_id', ''); } } return apply_filters('ms_gateway_stripe_find_customer', $customer, $member, $this); }