View Source Stripe.File (Striped v0.4.0)

This is an object representing a file hosted on Stripe's servers. The file may have been uploaded by yourself using the create file request (for example, when uploading dispute evidence) or it may have been created by Stripe (for example, the results of a Sigma scheduled query).

Related guide: File Upload Guide.

Link to this section Summary

Types

t()

The file type.

Functions

To upload a file to Stripe, you’ll need to send a request of type multipart/form-data. The request should contain the file you would like to upload, as well as the parameters for creating a file.

Returns a list of the files that your account has access to. The files are returned sorted by creation date, with the most recently created files appearing first.

Retrieves the details of an existing file object. Supply the unique file ID from a file, and Stripe will return the corresponding file object. To access file contents, see the File Upload Guide.

Link to this section Types

@type created() :: %{
  optional(:gt) => integer(),
  optional(:gte) => integer(),
  optional(:lt) => integer(),
  optional(:lte) => integer()
}
@type t() :: %Stripe.File{
  created: integer(),
  expires_at: integer() | nil,
  filename: binary() | nil,
  id: binary(),
  links: term() | nil,
  object: binary(),
  purpose: binary(),
  size: integer(),
  title: binary() | nil,
  type: binary() | nil,
  url: binary() | nil
}

The file type.

  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • expires_at The time at which the file expires and is no longer available in epoch seconds.
  • filename A filename for the file, suitable for saving to a filesystem.
  • id Unique identifier for the object.
  • links A list of file links that point at this file.
  • object String representing the object's type. Objects of the same type share the same value.
  • purpose The purpose of the uploaded file.
  • size The size in bytes of the file object.
  • title A user friendly title for the document.
  • type The type of the file returned (e.g., csv, pdf, jpg, or png).
  • url The URL from which the file can be downloaded using your live secret API key.

Link to this section Functions

Link to this function

create(client, opts \\ [])

View Source
@spec create(client :: Stripe.t(), opts :: Keyword.t()) ::
  {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

To upload a file to Stripe, you’ll need to send a request of type multipart/form-data. The request should contain the file you would like to upload, as well as the parameters for creating a file.

All of Stripe’s officially supported Client libraries should have support for sending multipart/form-data.

Details

  • Method: post
  • Path: /v1/files
Link to this function

list(client, params \\ %{}, opts \\ [])

View Source
@spec list(
  client :: Stripe.t(),
  params :: %{
    optional(:created) => created() | integer(),
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:purpose) =>
      :account_requirement
      | :additional_verification
      | :business_icon
      | :business_logo
      | :customer_signature
      | :dispute_evidence
      | :document_provider_identity_document
      | :finance_report_run
      | :identity_document
      | :identity_document_downloadable
      | :pci_document
      | :selfie
      | :sigma_scheduled_query
      | :tax_document_user_upload
      | :terminal_reader_splashscreen,
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Returns a list of the files that your account has access to. The files are returned sorted by creation date, with the most recently created files appearing first.

Details

  • Method: get
  • Path: /v1/files
Link to this function

retrieve(client, file, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  client :: Stripe.t(),
  file :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves the details of an existing file object. Supply the unique file ID from a file, and Stripe will return the corresponding file object. To access file contents, see the File Upload Guide.

Details

  • Method: get
  • Path: /v1/files/{file}