/** * Checks all Memberships and creates/updates the payment plan on stripe if * the membership changed since the plan was last changed. * * This function is called when the gateway is activated and after a * membership was saved to database. * * @since 1.0.0 */ public function update_stripe_data() { if (!$this->active) { return false; } $this->_api->set_gateway($this); // 1. Update all playment plans. $memberships = MS_Model_Membership::get_memberships(); foreach ($memberships as $membership) { $this->update_stripe_data_membership($membership); } // 2. Update all coupons (if Add-on is enabled) if (MS_Addon_Coupon::is_active()) { $coupons = MS_Addon_Coupon_Model::get_coupons(); foreach ($coupons as $coupon) { $this->update_stripe_data_coupon($coupon); } } }