How to reject transactions in sandbox


(Ditch The Space) #1

Dwolla sanbox environment got changed few months ago.

https://dashboard-sandbox.dwolla.com/transactions

With new layout, apparently you can only process bank transfers. In old site it was possible to cancel or set transactions as failed

How we can test all transaction scenarios?


(Shea Daniels) #2

Hi @Ditch_The_Space, you may find this article helpful:

Testing in Sandbox


(Ditch The Space) #3

Thanks, the article was helpful. But still having trouble to test the following scenario:

  • Customer A transfer funds to Customer B (both verified accounts and verified funding sources).
  • The money is withdrawn from customer A account, but fails to deposit in customer B account
  • The money should be stored in dwolla balance for customer A

How can I test that scenario? I tried creating a destination account (customer B) with name R02 but no luck (transfer got processed anyway)

I need to have the money in dwolla balance so I can exercise the process for returning the funds to the customer

Thanks for your help


(Spencer Hunter) #4

@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

Step 2: Retrieve an IAV token for Customer A and initiate the IAV flow (adding a verified bank)

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 Access 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.


(Ditch The Space) #5

Thanks for the reply, but the transactions are still processing, so no money in dwolla balance for testing. I created a funding source with R03 in the name for customer B (the one receiving the money), and leave it as unverified, but still the transaction got processed. Can you give it a look maybe?

TRANSACTION ID
264cb611-052a-e711-80f1-0aa34a9b2388

Thanks


(Spencer Hunter) #6

@Ditch_The_Space, I am showing the transaction processed from the sending party and failed going to the recipients bank account. You should now see $10 in the recipient’s balance (customerId: b9dc5da3-b420-45b0-b1bc-54feb6fbde3a).


(Ditch The Space) #7

Thanks, I see the failed transaction now. In sandbox dashboard site the transaction appears as processed, but when clicking on the transaction and expanding the related transfers, now it’s visible the failed transaction (little confusing). Also the funding sources for customer in https://dashboard-sandbox.dwolla.com seemed to take a little time to refresh.


(Spencer Hunter) #8

Thanks for the feedback @Ditch_The_Space, I’ll be sure to pass this along to our team! I am assuming you are looking up the sending Customer and viewing that specific Customer’s list of transactions? Technically, the transaction has processed and the recipient is in possession of those funds. That being said, I do understand the confusion as you specified in your API request that the funds should go all the way to the recipients bank.