Dwolla.post giving me a CORS error

Following the documentation on the dwolla API guide for updating a customer I have implemented the following function for trying to reverify a customer after initially failing verification (customer is in a retry status):

function submitReverification(firstName, lastName, email, address, state, city, postalCode, dob, fullSsn) {
const dwolla = window.dwolla

dwolla.configure(process.env.REACT_APP_DWOLLA_ENV);

const formattedSsn = fullSsn.substr(0,3) + '-' + fullSsn.substr(3, 2) + '-' + fullSsn.substr(5)

let requestBody = {
  firstName: firstName,
  lastName: lastName,
  email: email,
  type: "personal",
  address1: address,
  city: city,
  state: state,
  postalCode: postalCode,
  dateOfBirth: dob,
  ssn: formattedSsn,
};

dwolla.post(customer_url, requestBody).then(async function getData() {
  #Pull more data
})

}

When running this I am getting a 401 with a CORS error. Any ideas on what I could be doing wrong? Looking at the documentation I should have everything that is listed there.

Hi @TranZynergy – calls to the Dwolla API would result in a CORs error if they’re being made from the client-side rather than from the server-side of your application. Calls to the API directly from the browser is not allowed. I would check that your API call is being made from the back-end server which is tasked with securely managing your API credentials and handling other business logic surrounding payments.

That was the fix. Just getting to work with your systems so I wasn’t familiar with the fact that you can’t make calls client-side. Appreciate your help!

1 Like