const fd = new FormData(f); document.fetElementById('payment_form').querySelector('input') .forEach(inp => fd.append(inp.dataset.cp, inp.value);