Error Creating Funding Source

I’m reaching out for assistance with an issue I’m experiencing while using the Dwolla API to create a funding source. I’m using the createFundingSource endpoint to create a new funding source for a customer, but I’m receiving a 400 error with the message “InvalidExchangeToken”

Here is the code snippet that is causing the issue:

const createFundingSource = async (dwollaClient, { customerId, exchangeUrl, name, type }) => {
  const response = await dwollaClient.post(`/customers/${customerId}/funding-sources`, {
    _links: { exchange: { href: exchangeUrl } },
    bankAccountType: type,
    name,
  });
  return response.headers.get('Location');
};

I’ve tried to debug the issue, but I’m unable to resolve it on my own. I would greatly appreciate it if you could assist me in resolving this issue.

Please let me know if you need any additional information from me to troubleshoot the issue.

Hi @Pedro_Rique , I can take a look at our logs to see if there is a more helpful error message. Do you have the customerId by chance?

Hello, Spencer!

Of course, I will share also the mutation that i’m trying to do.

{
  "input": {
    "operationName": "createFundingSource",
    "data": {
      "customerId": "59e6cdb3-71ec-4436-828d-46a880c61b7a",
      "exchangeUrl": "https://api-sandbox.dwolla.com/exchanges/cabfd0ee-85d2-4d62-a1c9-ee94a55e3d58",
      "name": "Checking",
      "type": "checking"
    }
  }
}

Also, checking the cloudwatch in Aws is showing this error

image

Hi @Pedro_Rique!

Thanks for the IDs! We were able to dig into the API logs for creating that exchange and it seems the partnerId you are using on Mastercard/Finicity’s to create the exchange might be incorrect. The correct ID would be this value for both Sandbox and Prod - 2445583946651.

For reference, here’s what we found was used to create an exchange:

{
    "_links": {
        "exchange-partner": {
            "href": "https://api-sandbox.dwolla.com/exchange-partners/9b55a4b3-34ae-4607-b2d1-622f1eed77f9"
        }
    },
    "finicity": {
        "profile": "3",
        "version": "1",
        "receiptId": "cr_37hdz3NkFBzsMNee8URfJIcdKLO8z3",
        "receiptVersion": "1",
        "customerId": "2206168114585292599",
        "partnerId": "2445584323500",
        "products": [
            {
                "product": "moneyTransferDetails",
                "accountId": "915962842373984237",
                "accessPeriod": {
                    "type": "timeframe",
                    "startTime": "2024-05-02T10:21:07.966Z",
                    "endTime": "2024-08-02T10:21:07.966Z"
                }
            }
        ]
    }
}

Hello, Shreya! Good morning.

I’ve tried the id you’ve sent, but with this new id don’t works anything, not event creating the finicity customer.

Can we schedule a call to solve this?

Hi @Pedro_Rique , I’m not seeing in our API request logs that you attempted to recreate the exchange based on the recommendation that @shreya provided above. Would you be able to recreate the exchange (with the updated partnerId) and then attempt to recreate the funding source using that exchange? This sample app can also be used as a reference to how this flow can be done.

I could not get to this part, because it blocked me in the finicity customer creation. Without the finicity customer id, i can’t do anything with dwolla.

One thing that I thought was, that I changed the partner id, but not the partnet secret. What should be this secret and where can I get it?

Hi @Pedro_Rique – I think there might have been a misunderstanding. Did you mean you changed the Partner ID as in your Sandbox account credentials on Mastercard’s Dashboard?

If so, you’d want to keep them same as before (what you have in the Dashboard)

What I meant by partnerId is the Dwolla Partner ID; the value you would send to Dwolla within the finicity object below:

{
    "_links": {
        "exchange-partner": {
            "href": "https://api-sandbox.dwolla.com/exchange-partners/9b55a4b3-34ae-4607-b2d1-622f1eed77f9"
        }
    },
    "finicity": {
        "profile": "3",
        "version": "1",
        "receiptId": "cr_37hdz3NkFBzsMNee8URfJIcdKLO8z3",
        "receiptVersion": "1",
        "customerId": "2206168114585292599",
        "partnerId": "2445583946651",
        "products": [
            {
                "product": "moneyTransferDetails",
                "accountId": "915962842373984237",
                "accessPeriod": {
                    "type": "timeframe",
                    "startTime": "2024-05-02T10:21:07.966Z",
                    "endTime": "2024-08-02T10:21:07.966Z"
                }
            }
        ]
    }
}

Hope this helps clarify things!

Yeah, i was doing this. But i did not mention that we are using the Third Party Access. So now i’ve updated the thirdPartyPartnerId, to the one that you sent, 2445583946651.

These were the results:

This is returning null in funding source creating because there was an error.

Watching the logs in Aws lambda, i got this error message.

{
    "status": 404,
    "headers": {},
    "body": {
        "code": "NotFound",
        "message": "The requested resource was not found."
    }
}

What i’m doing wrong?

@shreya any thoughts on it?

Hi @Pedro_Rique – looking into this, it does appear to be an anomaly, since that error should be returned if the API can’t find the Customer ID, but I do see that it exists and that you’re calling the API correctly.

I’ve shared this with the extended Dev team to help troubleshoot. I’ll keep you updated on what we find!

In the meantime, are you able to add funding-sources via Mastercard Secure Exchange solution for other customers at all?

Hi! No, the error is consistent in every customer.

Thanks for confirming, @Pedro_Rique!

Hi @Pedro_Rique – We were able to recreate the same error when testing in Sandbox. It appears we are getting an error from Mastercard when we attempt to call their API. The error that we’re sending back from our API is obviously not well handled. Apologies for that! This is the first time we’re running into this issue.

We are currently actively investigating and reaching out to our partner Mastercard (Finicity) to figure things out. We’ll keep you posted!

That’s okay! We are waiting for your feedback on solving this issue. good luck!

1 Like

Hi @Pedro_Rique, I wanted to provide an update that the issue is fixed! :pray:

You should be able to test normally going forward! We’re still trying to understand why we ran into this issue so we can avoid it in the future.

Again, thanks for your patience while we worked through this!

Gm, Shreya! Thank you for your response.

Unfortunately, now the error is on the exchange creation (a step before the funding source creation).

That was the api call made.

Hi @Pedro_Rique - I believe this might be due to passing multiple products in the array. We don’t currently have the ability to fetch the balance and the account owner identity via Mastercard (Finicity).

Do you get the same error when you supply just moneyTransferDetails in products array?