defmodule Stripe.Terminal.Reader do use Stripe.Entity @moduledoc "A Reader represents a physical device for accepting payment details.\n\nRelated guide: [Connecting to a reader](https://stripe.com/docs/terminal/payments/connect-reader)" ( defstruct [ :action, :device_sw_version, :device_type, :id, :ip_address, :label, :last_seen_at, :livemode, :location, :metadata, :object, :serial_number, :status ] @typedoc "The `terminal.reader` type.\n\n * `action` The most recent action performed by the reader.\n * `device_sw_version` The current software version of the reader.\n * `device_type` Device type of the reader.\n * `id` Unique identifier for the object.\n * `ip_address` The local IP address of the reader.\n * `label` Custom label given to the reader for easier identification.\n * `last_seen_at` The last time this reader reported to Stripe backend.\n * `livemode` Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.\n * `location` The location identifier of the reader.\n * `metadata` Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.\n * `object` String representing the object's type. Objects of the same type share the same value.\n * `serial_number` Serial number of the reader.\n * `status` The networking status of the reader. We do not recommend using this field in flows that may block taking payments.\n" @type t :: %__MODULE__{ action: term | nil, device_sw_version: binary | nil, device_type: binary, id: binary, ip_address: binary | nil, label: binary, last_seen_at: integer | nil, livemode: boolean, location: (binary | Stripe.Terminal.Location.t()) | nil, metadata: term, object: binary, serial_number: binary, status: binary | nil } ) ( @typedoc "Simulated data for the card payment method." @type card :: %{ optional(:cvc) => binary, optional(:exp_month) => integer, optional(:exp_year) => integer, optional(:number) => binary } ) ( @typedoc "Simulated data for the card_present payment method." @type card_present :: %{optional(:number) => binary} ) ( @typedoc "Cart details to display on the reader screen, including line items, amounts, and currency." @type cart :: %{ optional(:currency) => binary, optional(:line_items) => list(line_items), optional(:tax) => integer, optional(:total) => integer } ) ( @typedoc nil @type choices :: %{ optional(:id) => binary, optional(:style) => :primary | :secondary, optional(:text) => binary } ) ( @typedoc "Configuration overrides for this collection, such as tipping, surcharging, and customer cancellation settings." @type collect_config :: %{ optional(:allow_redisplay) => :always | :limited | :unspecified, optional(:enable_customer_cancellation) => boolean, optional(:skip_tipping) => boolean, optional(:tipping) => tipping } ) ( @typedoc "Configuration overrides for this confirmation, such as surcharge settings and return URL." @type confirm_config :: %{optional(:return_url) => binary} ) ( @typedoc "Customize the text which will be displayed while collecting this input" @type custom_text :: %{ optional(:description) => binary, optional(:skip_button) => binary, optional(:submit_button) => binary, optional(:title) => binary } ) ( @typedoc nil @type inputs :: %{ optional(:custom_text) => custom_text, optional(:required) => boolean, optional(:selection) => selection, optional(:toggles) => list(toggles), optional(:type) => :email | :numeric | :phone | :selection | :signature | :text } ) ( @typedoc "Simulated data for the interac_present payment method." @type interac_present :: %{optional(:number) => binary} ) ( @typedoc nil @type line_items :: %{ optional(:amount) => integer, optional(:description) => binary, optional(:quantity) => integer } ) ( @typedoc "Configuration overrides for this transaction, such as tipping and customer cancellation settings." @type process_config :: %{ optional(:allow_redisplay) => :always | :limited | :unspecified, optional(:enable_customer_cancellation) => boolean, optional(:return_url) => binary, optional(:skip_tipping) => boolean, optional(:tipping) => tipping } ) ( @typedoc "Configuration overrides for this refund, such as customer cancellation settings." @type refund_payment_config :: %{optional(:enable_customer_cancellation) => boolean} ) ( @typedoc "Options for the `selection` input" @type selection :: %{optional(:choices) => list(choices)} ) ( @typedoc "Tipping configuration for this transaction." @type tipping :: %{optional(:amount_eligible) => integer} ) ( @typedoc nil @type toggles :: %{ optional(:default_value) => :disabled | :enabled, optional(:description) => binary, optional(:title) => binary } ) ( nil @doc "
Deletes a Reader object.
Returns a list of Reader objects.
Retrieves a Reader object.
Creates a new Reader object.
Updates a Reader object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Cancels the current reader action. See Programmatic Cancellation for more details.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/readers/{reader}/cancel_action`\n" ( @spec cancel_action( reader :: binary(), params :: %{optional(:expand) => list(binary)}, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def cancel_action(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/readers/{reader}/cancel_action", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Initiates an input collection flow on a Reader to display input forms and collect information from your customers.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/readers/{reader}/collect_inputs`\n" ( @spec collect_inputs( reader :: binary(), params :: %{ optional(:expand) => list(binary), optional(:inputs) => list(inputs), optional(:metadata) => %{optional(binary) => binary} }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def collect_inputs(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/readers/{reader}/collect_inputs", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation. See Collecting a Payment method for more details.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/readers/{reader}/collect_payment_method`\n" ( @spec collect_payment_method( reader :: binary(), params :: %{ optional(:collect_config) => collect_config, optional(:expand) => list(binary), optional(:payment_intent) => binary }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def collect_payment_method(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/readers/{reader}/collect_payment_method", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Finalizes a payment on a Reader. See Confirming a Payment for more details.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/readers/{reader}/confirm_payment_intent`\n" ( @spec confirm_payment_intent( reader :: binary(), params :: %{ optional(:confirm_config) => confirm_config, optional(:expand) => list(binary), optional(:payment_intent) => binary }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def confirm_payment_intent(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/readers/{reader}/confirm_payment_intent", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Initiates a payment flow on a Reader. See process the payment for more details.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/readers/{reader}/process_payment_intent`\n" ( @spec process_payment_intent( reader :: binary(), params :: %{ optional(:expand) => list(binary), optional(:payment_intent) => binary, optional(:process_config) => process_config }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def process_payment_intent(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/readers/{reader}/process_payment_intent", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Initiates a SetupIntent flow on a Reader. See Save directly without charging for more details.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/readers/{reader}/process_setup_intent`\n" ( @spec process_setup_intent( reader :: binary(), params :: %{ optional(:allow_redisplay) => :always | :limited | :unspecified, optional(:expand) => list(binary), optional(:process_config) => process_config, optional(:setup_intent) => binary }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def process_setup_intent(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/readers/{reader}/process_setup_intent", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Initiates an in-person refund on a Reader. See Refund an Interac Payment for more details.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/readers/{reader}/refund_payment`\n" ( @spec refund_payment( reader :: binary(), params :: %{ optional(:amount) => integer, optional(:charge) => binary, optional(:expand) => list(binary), optional(:metadata) => %{optional(binary) => binary}, optional(:payment_intent) => binary, optional(:refund_application_fee) => boolean, optional(:refund_payment_config) => refund_payment_config, optional(:reverse_transfer) => boolean }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def refund_payment(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/readers/{reader}/refund_payment", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Sets the reader display to show cart details.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/terminal/readers/{reader}/set_reader_display`\n" ( @spec set_reader_display( reader :: binary(), params :: %{ optional(:cart) => cart, optional(:expand) => list(binary), optional(:type) => :cart }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def set_reader_display(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/terminal/readers/{reader}/set_reader_display", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/test_helpers/terminal/readers/{reader}/present_payment_method`\n" ( @spec present_payment_method( reader :: binary(), params :: %{ optional(:amount_tip) => integer, optional(:card) => card, optional(:card_present) => card_present, optional(:expand) => list(binary), optional(:interac_present) => interac_present, optional(:type) => :card | :card_present | :interac_present }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def present_payment_method(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/test_helpers/terminal/readers/{reader}/present_payment_method", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Use this endpoint to trigger a successful input collection on a simulated reader.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/test_helpers/terminal/readers/{reader}/succeed_input_collection`\n" ( @spec succeed_input_collection( reader :: binary(), params :: %{ optional(:expand) => list(binary), optional(:skip_non_required_inputs) => :all | :none }, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def succeed_input_collection(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/test_helpers/terminal/readers/{reader}/succeed_input_collection", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) ( nil @doc "Use this endpoint to complete an input collection with a timeout error on a simulated reader.
\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/test_helpers/terminal/readers/{reader}/timeout_input_collection`\n" ( @spec timeout_input_collection( reader :: binary(), params :: %{optional(:expand) => list(binary)}, opts :: Keyword.t() ) :: {:ok, Stripe.Terminal.Reader.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()} def timeout_input_collection(reader, params \\ %{}, opts \\ []) do path = Stripe.OpenApi.Path.replace_path_params( "/v1/test_helpers/terminal/readers/{reader}/timeout_input_collection", [ %{ __struct__: OpenApiGen.Blueprint.Parameter, in: "path", name: "reader", required: true, schema: %{ __struct__: OpenApiGen.Blueprint.Parameter.Schema, any_of: [], items: [], name: "reader", properties: [], title: nil, type: "string" } } ], [reader] ) Stripe.Request.new_request(opts) |> Stripe.Request.put_endpoint(path) |> Stripe.Request.put_params(params) |> Stripe.Request.put_method(:post) |> Stripe.Request.make_request() end ) ) end