Creating a new funding source through dwolla.js returns existing source

Within my dwolla sandbox, a customer account currently has one bank account source attached (as well as several already removed sources). When I create a new source through dwolla.js, it returns the expected link with the new funding source and says the creation was successful, but the link is of the existing funding source, and the new source is not actually created. Any help or suggestions are appreciated. This is using react, but even if you are not familiar you should be able to get the gist of what is going on.

useEffect(() => {
    async function initializeIAV(teamId) {
      const iavToken = await bankAccountContext.getIAVToken(teamId)
        // handle
        //console.log(res.data.iav_token)
        if(iavToken !== undefined){
          const dwolla = window.dwolla
          dwolla.configure('sandbox');
          dwolla.iav.start(iavToken, {
            container: 'iavContainerEdit',
            microDeposits: false,
            fallbackToMicroDeposits: true
          }, (err, res) => {
            console.log(err,res)
            if (err) {
              console.log(err)
              alert("An error occured")
            } else {
              console.log(res._links)
            }
          });
        }
    }
    if (open) {
      initializeIAV(teamId)
    }
  }, [open])

  const closeEdit = () => {
    setConfirmOpen(false)
    setOpen(false)
  }

  return (
        <DialogContent className={classes.content}>
          <div id="iavContainerEdit"></div>
        </DialogContent>
  )

Hi @dalurness,

I think I know what’s happening here. Our Sandbox IAV service only has two bank accounts to test with, one Checking and one Savings. You’re likely adding a checking account again which simply points you to the previously added checking account.

Hope that helps! Let me know if you have any questions!

Interesting, I wish that would throw some sort of warning or error instead of acting like it successfully created a new source. With that in mind, I am currently implementing the ability for customers to replace their existing source with a new one. My thought process was to take the id of the existing source, allow them to add the new source through IAV(so for a small amount of time two sources exist on that customer), and then delete the previous source with the original id. With this limitation in mind, what would be the recommended way to achieve this?

Noted!

As for adding a second bank account using IAV, after you get to the account selection screen, you can choose the Savings account which has a different account number than the Checking account. That way you should be able to add two funding-sources to one Customer account.

Great, so when testing just make sure to use the two types, but then in production it should work the way I am expecting. If that is correct then I should be good to go. Thank you @shreya !

That’s correct! You’re welcome!