Can not upload document for beneficial owner from Android device

I’m using Retrofit library to upload document for a beneficial owner in Sand box enviroment as below:

 public void uploadDocumentForBeneficialOwner(String dwollaAccessToken, String beneficialOwnerIdFromDwolla, final Uri imageUri, String documentType) {
        File file = new File(RealPathUtil.getRealPath(context, imageUri));
        RequestBody documentTypePart = RequestBody.create(documentType, MediaType.parse("text/plain"));
        MultipartBody.Part imagePart = MultipartBody.Part.createFormData("file", "Image", RequestBody.create(file, MediaType.parse("image/*")));

        HashMap<String, String> headers = new HashMap<>();
        headers.put("Authorization","Bearer " + dwollaAccessToken);
        headers.put("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
        headers.put("Accept", "application/vnd.dwolla.v1.hal+json");

        Call<ResponseBody> call = APIService.apiService.uploadDocumentForBeneficialOwners(headers, beneficialOwnerIdFromDwolla, documentTypePart, imagePart);
        call.enqueue(new Callback<ResponseBody>() {
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                if (response.code() == 200 || response.code() == 201) {
                    String location = response.headers().get("Location");
                    uploadDocumentCallback.completed(true, location, null);
                } else {
                    String message = response.message();
                    uploadDocumentCallback.completed(false, null, message);

            public void onFailure(Call<ResponseBody> call, Throwable t) {
                uploadDocumentCallback.completed(false, null, t.getMessage());

Whenever I call uploadDocumentForBeneficialOwner() function I get code 400 or 500 as image below

How can I upload a document to beneficial owners from Android device?


Hi @Vinh_Phan_Tan – could you share the Beneficial Owner Id for us to take a look? Also, is the document upload working fine for Verified Customers and just not Beneficial Owners?

I @shreya , I have solved the problem. I use OkHttpClient library to create the post request and I got the expected result.
Thank you for your prompt feedback!

Awesome! Thanks for posting an update, @Vinh_Phan_Tan!