File uploader

Our file uploader allows you to upload files to Checkout.com. You can then use these to provide evidence in a dispute.

Upload a file

Upload a file to use as evidence in a dispute. Your request must be multipart/form-data and the file must be in either JPEG/JPG, PNG or PDF format, and no larger than 4MB.

The request

Use the details below to set up your request.

Endpoints

Live

https://api.checkout.com/files

Sandbox

https://api.sandbox.checkout.com/files

Header parameters

Header
Value

Authorization
Required

secret key

Use the valid secret key of your Checkout.com account. You can find this in the Hub.

Additional parameters

Parameter
Description

file
String (binary)
Required

The path of the file to upload and its type.

purpose
String
Required

The purpose of the file upload. You must set this to dispute_evidence.

Example request

curl https://api.sandbox.checkout.com/files
-H "Authorization: sk_11111111-2222-3333-4444-555555555555"
-F "[email protected]/path/receipt.png;type=image/png"
-F "purpose=dispute_evidence"
public static async Task Main(string[] args)
{
  using (var httpClient = new HttpClient())
  {
    httpClient.DefaultRequestHeaders.Add("Authorization", "sk_11111111-2222-3333-4444-555555555555");
    using (var form = new MultipartFormDataContent())
    {
      using (var fileStream = new FileStream("test.png", FileMode.Open))
      {
        var streamContent = new StreamContent(fileStream);
        streamContent.Headers.ContentType = new MediaTypeHeaderValue("image/png");
        form.Add(streamContent, "File", "test.png");
        form.Add(new StringContent("dispute_evidence"), "purpose");
        var response = await httpClient.PostAsync("https://api.sandbox.checkout.com/files", form);
        Console.WriteLine(response.StatusCode);
        string responseContent = await response.Content.ReadAsStringAsync();
        Console.WriteLine(responseContent);
      }
    }
  }
}

The response

If the response returns a file id, your request was successful. Take a look at the example response below.

{
  "id": "file_6lbss42ezvoufcb2beo76rvwly",
  "_links": {
    "self": {
      "href": "https://api.sandbox.checkout.com/files/file_6lbss42ezvoufcb2beo76rvwly"
    }
  }
}

Get file information

Get information about a file that was previously uploaded.

The request

Use the details below to set up your request.

Endpoints

Live

GEThttps://api.checkout.com/files/{file_id}

Sandbox

GEThttps://api.sandbox.checkout.com/files/{file_id}

Header and path parameters

Header
Value

Authorization
Required

secret key

Use the valid secret key of your Checkout.com account. You can find this in the Hub.

Path
Value

file_id
String (file)
Required

The file identifier. It is always prefixed by file_.

Example request

curl https://api.sandbox.checkout.com/files/file_6lbss42ezvoufcb2beo76rvwly
    -H "Authorization: sk_11111111-2222-3333-4444-555555555555"

The response

If the response returns a file id, your request was successful. Take a look at the example response below.

{
  "id": "file_6lbss42ezvoufcb2beo76rvwly",
  "filename": "receipt.png",
  "purpose": "dispute_evidence",
  "size": 1024,
  "uploaded_on": "2016-05-17T16:48:52.000Z",
  "_links": {
    "self": {
      "href": "https://api.sandbox.checkout.com/files/file_6lbss42ezvoufcb2beo76rvwly"
    },
    "download": {
      "href": "https://checkout-file-upload.s3.eu-west-2.amazonaws.com/ucdac/ucdac/6lbss42ezvoufcb2beo76rvwly?X-Amz-Expires=3600&x-amz-security-token=FQoDYXdzENL%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEa"
    }
  }
}

Can we help?

Thanks for using Checkout.com. If you need any help or support, then message our support team at [email protected].

Updated about a month ago

File uploader


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.