# Verify Micro Deposits

**URL:** <https://discuss.dwolla.com/t/verify-micro-deposits/9540>\
**Category:** General\
**Created:** [February 6, 2024, 12:41am UTC](https://discuss.dwolla.com/t/verify-micro-deposits/9540 "2024-02-06T00:41:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Lott](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/kevin_lott/32/4164_2.png) [@Kevin\_Lott](https://discuss.dwolla.com/u/Kevin_Lott)\
**Post date:** [February 6, 2024, 12:41am UTC](https://discuss.dwolla.com/t/verify-micro-deposits/9540/1 "2024-02-06T00:41:06Z")

</div>

We use to get friendly error messages back from Dwolla Swagger when the customer entered the incorrect amounts, in the last few days we are now seeing the following error:

[400] Error connecting to the API ([https://api-sandbox.dwolla.com/funding-sources/7d8a7fd9-bede-4060-84ce-fac9c5b159d5/micro-deposits](https://api-sandbox.dwolla.com/funding-sources/7d8a7fd9-bede-4060-84ce-fac9c5b159d5/micro-deposits))

We do use the try/catch method and this is the message that is received. Any advice on how we can get it to say “Incorrect Amounts” like it used to?

Thanks!

---

<div class="post-metadata">

**Author:** ![shreya](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/shreya/32/2154_2.png) [@shreya](https://discuss.dwolla.com/u/shreya)\
**Post date:** [February 6, 2024, 3:58pm UTC](https://discuss.dwolla.com/t/verify-micro-deposits/9540/2 "2024-02-06T15:58:05Z")

</div>

Hi @Kevin_Lott,

We might be able to provide some pointers – could you share any relevant code from your app related to the microdeposits verification call?

---

<div class="post-metadata">

**Author:** ![Kevin\_Lott](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/kevin_lott/32/4164_2.png) [@Kevin\_Lott](https://discuss.dwolla.com/u/Kevin_Lott)\
**Post date:** [February 6, 2024, 4:18pm UTC](https://discuss.dwolla.com/t/verify-micro-deposits/9540/3 "2024-02-06T16:18:43Z")

</div>

Sure!

public function account\_funding\_source\_verify($id, $deposit\_1, $deposit\_2)  
{  
$fundingSourceUrl = DWOLLA\_API . ‘funding-sources/’ . $id;

```
$fsApi = new DwollaSwagger\FundingsourcesApi($this->apiClient);

$fsApi->microDeposits([
  'amount1' => [
    'value' => $deposit_1,
    'currency' => 'USD'
  ],
  'amount2' => [
    'value' => $deposit_2,
    'currency' => 'USD'
  ]],
  $fundingSourceUrl
);

return $fsApi;

```

}

---

<div class="post-metadata">

**Author:** ![shreya](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/shreya/32/2154_2.png) [@shreya](https://discuss.dwolla.com/u/shreya)\
**Post date:** [February 6, 2024, 7:20pm UTC](https://discuss.dwolla.com/t/verify-micro-deposits/9540/4 "2024-02-06T19:20:12Z")

</div>

Thanks, @Kevin_Lott!

We could catch the error message and return that whenever an exception occurs. Here’s a slightly modified code you could try:

```auto
public function account_funding_source_verify($id, $deposit_1, $deposit_2)
{
    $fundingSourceUrl = DWOLLA_API . 'funding-sources/' . $id;
    
    $fsApi = new DwollaSwagger\FundingsourcesApi($this->apiClient);
    
    try {
        $response = $fsApi->microDeposits([
            'amount1' => [
                'value' => $deposit_1,
                'currency' => 'USD'
            ],
            'amount2' => [
                'value' => $deposit_2,
                'currency' => 'USD'
            ]
        ], $fundingSourceUrl);
        
        return $response;
    } catch (Exception $e) {
        // Handle the exception here
        return $e->getResponseBody();
    }
}

```

In this modified code:

- We wrap the API call inside a try block.
- If an exception occurs during the API call, it will be caught by the catch block.
- Inside the catch block, we return the response body of the exception using the `getResponseBody()` method.
- If no exception occurs, we return the response from the API call as usual.

---

<div class="post-metadata">

**Author:** ![Kevin\_Lott](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/kevin_lott/32/4164_2.png) [@Kevin\_Lott](https://discuss.dwolla.com/u/Kevin_Lott)\
**Post date:** [February 6, 2024, 9:32pm UTC](https://discuss.dwolla.com/t/verify-micro-deposits/9540/5 "2024-02-06T21:32:56Z")

</div>

Thank you for the reply, we do wrap the call with a try catch and have been using $e-\>getMessage() which use to return the Wrong Amounts. the getResponseBody() does contain the nested errors:

{“code”:“ValidationError”,“message”:“Validation error(s) present. See embedded errors list for more details.”,“\_embedded”:{“errors”:[{“code”:“Invalid”,“message”:“Wrong amount(s).”,“path”:“”,“\_links”:{}}]}}

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/dwolla/original/2X/1/1b70808226fb9abeaaf7386224caffb453efb690.png) [@system](https://discuss.dwolla.com/u/system)\
**Post date:** [February 5, 2025, 12:41am UTC](https://discuss.dwolla.com/t/verify-micro-deposits/9540/6 "2025-02-05T00:41:31Z")

</div>

This topic was automatically closed after 365 days. New replies are no longer allowed.
