Skip to content

File uploader

Last updated: 20th September 2022

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.

Endpoints

For the full API specification, see the API reference.

    post

    https://api.checkout.com/files

    Additional parameters

    ParameterDescription

    file

    required
    string (binary)

    The path of the file to upload, and its type.

    This must be a local path.

    purpose

    required
    string

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

      1
      2
      3
      4
      5
      6
      7
      8
      import { Checkout } from "checkout-node-sdk";
      const cko = new Checkout("sk_XXXX");
      const file = await cko.files.upload({
      path: fs.createReadStream("./test/files/evidence.jpg"),
      purpose: "dispute_evidence",
      });

      The POST response

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

      Response example

      1
      2
      3
      4
      5
      6
      7
      8
      {
      "id": "file_6lbss42ezvoufcb2beo76rvwly",
      "_links": {
      "self": {
      "href": "https://api.sandbox.checkout.com/files/file_6lbss42ezvoufcb2beo76rvwly"
      }
      }
      }

      Get file information

      Use the following endpoint to retrieve information about a file that you've uploaded.

      Endpoints

      For the full API specification, see the API reference.

        get

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

        Request example

          1
          2
          3
          4
          5
          import { Checkout } from "checkout-node-sdk";
          const cko = new Checkout("sk_XXXX");
          const getFile = await cko.files.getFile("file_zna32sccqbwevd3ldmejtplbhu");

          Response example

          If the response returns a file id, your request was successful.

          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          14
          15
          {
          "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"
          }
          }
          }