See also the DocumentUpload response object.


The ability to upload documents via the API is currently in a limited release, and the API is subject to change.

'file' required, file

The binary data of the file to upload. Only png, jpg, jpeg, or pdf files are supported.

'kind' required, multiple

The type of uploaded document. Value should always be EVIDENCE_DOCUMENT.


$result = $gateway->documentUpload()->create([
  'kind' => Braintree\DocumentUpload::EVIDENCE_DOCUMENT,
  'file' => fopen('local_file.pdf', 'rb')

if ($result->success) {
  # document successfully uploaded
  $document = $result->documentUpload;
} else {
  echo $result->errors;
This code snippet now uses PHP standard PSR-4 namespacing to load modules. Learn more.