const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'My Sub Account',
return_name: 'John Smith',
return_address: '123 Smith Street',
return_address2: 'Apartment 2',
return_city: 'Denver',
return_state: 'CO',
return_postal_code: '12345'
})
};
fetch('https://api.thanks.io/api/v2/sub-accounts/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));