[BadRequest] The request body contains bad syntax or is incomplete

Using the dwolla golang library GitHub - kolanos/dwolla-v2-go: A Go wrapper for the Dwolla API V2 and getting the error " [BadRequest] The request body contains bad syntax or is incomplete. " when I try to initiate a transfer with a facilitator fee. Could someone provide a sample code on how to initialize the TransferRequest in Golang? I ran the debugger and was able to see the output that was being sent. I replaced the funding ID and the customer ID for privacy.

“{"_links":{"destination":{"href":"destination-funding-id"},"source":{"href":"source-funding-id"}},"amount":{"value":"5.00","currency":"usd"},"fees":[{"_links":{"charge-to":{"href":"source-customer-id"}},"amount":{"value":"1.00","currency":"usd"}}],"clearing":{}}”

Edit: I am not sure why the clearing field is showing up in the JSON output, I never specified it. Is that field required? I am only sending the Resource, Amount and Fees field. The following Golang code is what I am using to initiate the transfer:

transferRequest := &dwolla.TransferRequest{
	Resource: srcDstResource,
	Amount:   amount,
	Fees:     transferFees,
}

transfer, err := dwollaClient.Transfer.Create(dwollaContext, transferRequest)

Edit Two: I figured it out. I was missing the URL in front of the funding source ID and the customer ID so I prepend the URL and it worked.

1 Like

@jonpchin , Glad you were able to figure it out! Although the API wrapper you referenced is maintained by a third party, please feel free to post back and we can try to help where we are able. :smiley: