payment_types($array['id']); $payment_methods = []; foreach ($default_payment_accounts as $key => $value) { if (isset($all_payment_methods[$key]) && $value['is_enabled'] == 1) { $payment_methods[] = [ 'name' => $key, 'label' => $all_payment_methods[$key], 'account_id' => isset($value['account']) ? $value['account'] : null, ]; } } unset($array['default_payment_accounts']); $array['payment_methods'] = $payment_methods; return $array; } }