@Ditch_The_Space, I’ll start from the beginning with how to: create both Customers involved in the transaction, add funding sources (bank accounts) to both Customers, initiate the transaction, and simulate bank transfer processing.
###Step 1: Create a Verified Customer for the sending user (Customer A)
Request:
POST /customers HTTP/1.1
Host: api-sandbox.dwolla.com
Accept: application/vnd.dwolla.v1.hal+json
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"firstName": "Customer",
"lastName": "A",
"email": "customerA@email.com",
"type": "personal",
"address1": "99-99 33rd St",
"city": "Some City",
"state": "NY",
"postalCode": "11101",
"dateOfBirth": "1980-01-01",
"ssn": "1234"
}
Response:
HTTP/1.1 201 Created
Location: https://api-sandbox.dwolla.com/customers/b281413b-1d88-408b-a2b9-5fe5b6f16e63
Once the user has successfully completed the IAV flow we should trigger a callback with a link to the associated Customer’s attached funding source. This link should look something like this:
https://api-sandbox.dwolla.com/transfers/6154634c-fd29-e711-80f1-0aa34a9b2388
Step 3: Create a Verified Customer for receiving user (Customer B)
Request:
POST /customers HTTP/1.1
Host: api-sandbox.dwolla.com
Accept: application/vnd.dwolla.v1.hal+json
Content-Type: application/json
Authorization: Bearer {accessToken}
{
"firstName": "Customer",
"lastName": "B",
"email": "customerB@email.com",
"type": "business",
"address1": "99-99 33rd St",
"city": "Some City",
"state": "NY",
"postalCode": "11101",
"dateOfBirth": "1980-01-01",
"ssn": "1234",
"businessClassification": "9ed46bb6-7d6f-11e3-b9b2-5404a6144203",
"businessType": "llc",
"businessName":"Customer B Business",
"ein":"00-0000000"
}
Response:
HTTP/1.1 201 Created
Location: https://api-sandbox.dwolla.com/customers/479ce4c8-385f-4cfa-9693-262c0c3b6408
Step 4: Attach a bank to the receiving Customer
In this step, we’ll call the API to create a funding source for the Customer which will add it as unverified within Dwolla. Unverified funding sources can receive funds but cannot send.
Request:
POST /customers/479ce4c8-385f-4cfa-9693-262c0c3b6408/funding-sources HTTP/1.1
Host: api-sandbox.dwolla.com
Content-Type: application/json
Accept: application/vnd.dwolla.v1.hal+json
Authorization: Bearer {accessToken}
{
"routingNumber": "222222226",
"accountNumber": "123456781",
"type": "checking",
"name": "Customer B - Checking"
}
Response:
HTTP/1.1 201 Created
Location: https://api-sandbox.dwolla.com/funding-sources/9bfe6bfa-39db-4ac2-904a-5881689005d3
Step 5: Update the funding source belonging to the Customer you wish to test the ACH return on
In this particular bank to bank transaction scenario we’re going to test an ACH return that is triggered on the receiving Customer’s funding source (Customer B). As mentioned in our developer documentation, In the Sandbox environment “Dwolla allows you to pass in a few different sentinel values that are used to test different bank transfer failure scenarios.” A somewhat common bank transfer failure is an R03 (Account not found). Users can sometimes miskey their account number when adding their bank.
Request:
POST /funding-sources/9bfe6bfa-39db-4ac2-904a-5881689005d3 HTTP/1.1
Host: api-sandbox.dwolla.com
Accept: application/vnd.dwolla.v1.hal+json
Content-Type: application/json
Authorization: Bearer {accessToken}
{
"name": "R03"
}
Response:
{
"_links": {
"self": {
"href": "https://api-sandbox.dwolla.com/funding-sources/9bfe6bfa-39db-4ac2-904a-5881689005d3",
"type": "application/vnd.dwolla.v1.hal+json",
"resource-type": "funding-source"
}
},
"id": "9bfe6bfa-39db-4ac2-904a-5881689005d3",
"status": "unverified",
"type": "bank",
"name": "R03",
"created": "2017-04-25T21:01:16.000Z",
"removed": false,
"channels": [
"ach"
]
}
Step 6: Call the API to initiate the transaction
Specifying the funding source URL for Customer A as the source and the funding source URL for Customer B as the destination we’ll initiate the bank to bank transaction.
Request:
POST https://api-sandbox.dwolla.com/transfers
Accept: application/vnd.dwolla.v1.hal+json
Authorization: Bearer {accessToken}
Content-Type: application/json
{
"_links": {
"source": {
"href": "https://api-sandbox.dwolla.com/funding-sources/c91d6516-1855-4d36-be7c-bc78cc7c52c3"
},
"destination": {
"href": "https://api-sandbox.dwolla.com/funding-sources/9bfe6bfa-39db-4ac2-904a-5881689005d3"
}
},
"amount": {
"currency": "USD",
"value": "1337.00"
}
}
Response:
HTTP/1.1 201 Created
Location: https://api-sandbox.dwolla.com/transfers/6154634c-fd29-e711-80f1-0aa34a9b2388
Step 7: Simulate bank transfer processing
Referenced in our documentation, A “Process bank transfers” button is available in the Sandbox Dwolla Dashboard. This button allows you to simulate bank transfer processing in the Sandbox. Once the button is clicked, Dwolla will process or fail (see below for how-to trigger ACH failures) the last 500 bank transfers that occurred on your Sandbox account or the API Customer accounts you manage.
Note: This button will need to be clicked more than once to process both sides of the transaction. (ACH debit & ACH credit)
That’s it! The transfer will then fail to complete to the Customer B’s bank account and will be available in their balance. (Note: All Verified Customers will have a balance funding source attached when the account is created and in a verified state) Customer B will then need to correct any issue with their bank. i.e. adding a new one within your app. Once they’ve added a new bank a new transfer will need to be initiated which will then send funds from their balance to the new funding source (Bank account). You’ll need to call the API to fetch Customer B’s list of funding sources. i.e. GET /customers/479ce4c8-385f-4cfa-9693-262c0c3b6408/funding-sources.