Perl Dwolla: List and Search Transfers for an Account

Back to Index

Shows how to retrieve an Account's list of transfers. Transaction search is supported by passing in optional query string parameters such as: search which represents a term to search on, correlationId, startAmount, endAmount, startDate, endDate, and status.

Documentation: https://docsv2.dwolla.com/#list-and-search-transfers-for-an-account

CURL Command

curl -X GET https://api-sandbox.dwolla.com/accounts/DWOLLA_ACCOUNT_ID/transfers \
-H "Accept: application/vnd.dwolla.v1.hal+json" \
-H "Authorization: Bearer DWOLLA_ACCESS_TOKEN" \
-d "startAmount=1000" \
-d "endAmount=10000" \

Perl Example

use chilkat();

$rest = chilkat::CkRest->new();

#  URL: https://api-sandbox.dwolla.com/accounts/DWOLLA_ACCOUNT_ID/transfers
$bTls = 1;
$port = 443;
$bAutoReconnect = 1;
$success = $rest->Connect("api-sandbox.dwolla.com",$port,$bTls,$bAutoReconnect);
if ($success != 1) {
    print "ConnectFailReason: " . $rest->get_ConnectFailReason() . "\r\n";
    print $rest->lastErrorText() . "\r\n";
    exit;
}

$rest->AddQueryParam("startAmount","1000");
$rest->AddQueryParam("endAmount","10000");

$rest->AddHeader("Authorization","Bearer DWOLLA_ACCESS_TOKEN");
$rest->AddHeader("Accept","application/vnd.dwolla.v1.hal+json");

$strResponseBody = $rest->fullRequestFormUrlEncoded("GET","/accounts/DWOLLA_ACCOUNT_ID/transfers");
if ($rest->get_LastMethodSuccess() != 1) {
    print $rest->lastErrorText() . "\r\n";
    exit;
}

$jsonResponse = chilkat::CkJsonObject->new();
$jsonResponse->Load($strResponseBody);

$v_linksSelfHref = $jsonResponse->stringOf("_links.self.href");
$v_linksSelfType = $jsonResponse->stringOf("_links.self.type");
$v_linksSelfResource_type = $jsonResponse->stringOf("_links.self.resource-type");
$v_linksFirstHref = $jsonResponse->stringOf("_links.first.href");
$v_linksFirstType = $jsonResponse->stringOf("_links.first.type");
$v_linksFirstResource_type = $jsonResponse->stringOf("_links.first.resource-type");
$v_linksLastHref = $jsonResponse->stringOf("_links.last.href");
$v_linksLastType = $jsonResponse->stringOf("_links.last.type");
$v_linksLastResource_type = $jsonResponse->stringOf("_links.last.resource-type");
$total = $jsonResponse->IntOf("total");
$i = 0;
$count_i = $jsonResponse->SizeOfArray("_embedded.transfers");
while ($i < $count_i) {
    $jsonResponse->put_I($i);
    $v_linksSelfHref = $jsonResponse->stringOf("_embedded.transfers[i]._links.self.href");
    $v_linksSelfType = $jsonResponse->stringOf("_embedded.transfers[i]._links.self.type");
    $v_linksSelfResource_type = $jsonResponse->stringOf("_embedded.transfers[i]._links.self.resource-type");
    $v_linksSourceHref = $jsonResponse->stringOf("_embedded.transfers[i]._links.source.href");
    $v_linksSourceType = $jsonResponse->stringOf("_embedded.transfers[i]._links.source.type");
    $v_linksSourceResource_type = $jsonResponse->stringOf("_embedded.transfers[i]._links.source.resource-type");
    $v_linksDestinationHref = $jsonResponse->stringOf("_embedded.transfers[i]._links.destination.href");
    $v_linksDestinationType = $jsonResponse->stringOf("_embedded.transfers[i]._links.destination.type");
    $v_linksDestinationResource_type = $jsonResponse->stringOf("_embedded.transfers[i]._links.destination.resource-type");
    $id = $jsonResponse->stringOf("_embedded.transfers[i].id");
    $status = $jsonResponse->stringOf("_embedded.transfers[i].status");
    $amountValue = $jsonResponse->stringOf("_embedded.transfers[i].amount.value");
    $amountCurrency = $jsonResponse->stringOf("_embedded.transfers[i].amount.currency");
    $created = $jsonResponse->stringOf("_embedded.transfers[i].created");
    $clearingSource = $jsonResponse->stringOf("_embedded.transfers[i].clearing.source");
    $individualAchId = $jsonResponse->stringOf("_embedded.transfers[i].individualAchId");
    $i = $i + 1;
}

Sample JSON Response Body

{
  "_links": {
    "self": {
      "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0/transfers",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "transfer"
    },
    "first": {
      "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0/transfers?&limit=25&offset=0",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "transfer"
    },
    "last": {
      "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0/transfers?&limit=25&offset=0",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "transfer"
    }
  },
  "_embedded": {
    "transfers": [
      {
        "_links": {
          "self": {
            "href": "https://api-sandbox.dwolla.com/transfers/0c2650a7-662c-e811-8105-0a595ef38714",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "transfer"
          },
          "source": {
            "href": "https://api-sandbox.dwolla.com/funding-sources/0c5d1842-9a15-4f9f-9b11-b0e73d22e8c7",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "funding-source"
          },
          "destination": {
            "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "account"
          }
        },
        "id": "0c2650a7-662c-e811-8105-0a595ef38714",
        "status": "processed",
        "amount": {
          "value": "5000.00",
          "currency": "USD"
        },
        "created": "2018-03-20T17:46:48.400Z",
        "clearing": {
          "source": "standard"
        },
        "individualAchId": "IDOVVY5E"
      }
    ]
  },
  "total": 1
}