PHP API Sandbox createCustomerFundingSource error: "The request body contains bad syntax or is incomplete."

(Shawn Murphy) #1


I cannot figure out for the life of me what the problem is here. I create a customer of Type “Personal” and it shows the customer as “Verified”.

I then try and add a funding source with PHP API but keeping getting this response:

{“code”:“BadRequest”,“message”:“The request body contains bad syntax or is incomplete.”}

Here are the $POSTed values: {“routing_number”:“073000228”,“account_number”:“123456789”,“type”:“savings”,“name”:“SPMTest”}

Any thoughts? Thanks in advance!!


Here is my code:

<?php $mainApiKey = "{MY SANDBOX APP KEY}"; $mainApiSecret = "{MY SANDBOX APP SECRET}"; $mainAccessToken = "nkIpIezPUwL99RQE8QR3InZ5A3zA7BaSpj606GyKeDCmNOouAl"; #This access token is generated in my sandbox account application section by clicking: Create an OAuth access token require('DwollaSwagger.php'); DwollaSwagger\Configuration::$access_token = $mainAccessToken; # For UAT/Sandbox $apiClient = new DwollaSwagger\ApiClient(""); $customerLink = "19a398bf-ec16-4aee-b1f8-9b20ce3d257f"; $fundingApi = new DwollaSwagger\FundingsourcesApi($apiClient); $createFundingSources = $fundingApi->createCustomerFundingSource( [ 'routing_number' => "073000228", 'account_number' => "123456789", 'type' => "savings", 'name' => "SPMTest" ] ,$customerLink); ?>

(Spencer Hunter) #2

Hey @Shawn_Murphy, Apologies for the late response on this thread! The only issue I see is that you are passing in invalid parameters into the body of the request. You are using routing_number which should be routingNumber and account_number which should be accountNumber. Try changing those both to camel case and see if the request works for you.