Class: Stripe::Terminal::Reader

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List
Includes:
APIOperations::Delete, APIOperations::Save
Defined in:
lib/stripe/resources/terminal/reader.rb

Overview

A Reader represents a physical device for accepting payment details.

Related guide: [Connecting to a reader](stripe.com/docs/terminal/payments/connect-reader)

Defined Under Namespace

Classes: Action, CancelActionParams, CollectInputsParams, CollectPaymentMethodParams, ConfirmPaymentIntentParams, CreateParams, DeleteParams, ListParams, PresentPaymentMethodParams, ProcessPaymentIntentParams, ProcessSetupIntentParams, RefundPaymentParams, SetReaderDisplayParams, SucceedInputCollectionParams, TestHelpers, TimeoutInputCollectionParams, UpdateParams

Constant Summary collapse

OBJECT_NAME =
"terminal.reader"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods included from APIOperations::Delete

included

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#actionObject (readonly)

The most recent action performed by the reader.



741
742
743
# File 'lib/stripe/resources/terminal/reader.rb', line 741

def action
  @action
end

#deletedObject (readonly)

Always true for a deleted object



765
766
767
# File 'lib/stripe/resources/terminal/reader.rb', line 765

def deleted
  @deleted
end

#device_sw_versionObject (readonly)

The current software version of the reader.



743
744
745
# File 'lib/stripe/resources/terminal/reader.rb', line 743

def device_sw_version
  @device_sw_version
end

#device_typeObject (readonly)

Device type of the reader.



745
746
747
# File 'lib/stripe/resources/terminal/reader.rb', line 745

def device_type
  @device_type
end

#idObject (readonly)

Unique identifier for the object.



747
748
749
# File 'lib/stripe/resources/terminal/reader.rb', line 747

def id
  @id
end

#ip_addressObject (readonly)

The local IP address of the reader.



749
750
751
# File 'lib/stripe/resources/terminal/reader.rb', line 749

def ip_address
  @ip_address
end

#labelObject (readonly)

Custom label given to the reader for easier identification.



751
752
753
# File 'lib/stripe/resources/terminal/reader.rb', line 751

def label
  @label
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



753
754
755
# File 'lib/stripe/resources/terminal/reader.rb', line 753

def livemode
  @livemode
end

#locationObject (readonly)

The location identifier of the reader.



755
756
757
# File 'lib/stripe/resources/terminal/reader.rb', line 755

def location
  @location
end

#metadataObject (readonly)

Set of [key-value pairs](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.



757
758
759
# File 'lib/stripe/resources/terminal/reader.rb', line 757

def 
  @metadata
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



759
760
761
# File 'lib/stripe/resources/terminal/reader.rb', line 759

def object
  @object
end

#serial_numberObject (readonly)

Serial number of the reader.



761
762
763
# File 'lib/stripe/resources/terminal/reader.rb', line 761

def serial_number
  @serial_number
end

#statusObject (readonly)

The networking status of the reader. We do not recommend using this field in flows that may block taking payments.



763
764
765
# File 'lib/stripe/resources/terminal/reader.rb', line 763

def status
  @status
end

Class Method Details

.cancel_action(reader, params = {}, opts = {}) ⇒ Object

Cancels the current reader action.



778
779
780
781
782
783
784
785
# File 'lib/stripe/resources/terminal/reader.rb', line 778

def self.cancel_action(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/cancel_action", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.collect_inputs(reader, params = {}, opts = {}) ⇒ Object

Initiates an input collection flow on a Reader.



798
799
800
801
802
803
804
805
# File 'lib/stripe/resources/terminal/reader.rb', line 798

def self.collect_inputs(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.collect_payment_method(reader, params = {}, opts = {}) ⇒ Object

Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.



818
819
820
821
822
823
824
825
# File 'lib/stripe/resources/terminal/reader.rb', line 818

def self.collect_payment_method(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.confirm_payment_intent(reader, params = {}, opts = {}) ⇒ Object

Finalizes a payment on a Reader.



838
839
840
841
842
843
844
845
# File 'lib/stripe/resources/terminal/reader.rb', line 838

def self.confirm_payment_intent(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.create(params = {}, opts = {}) ⇒ Object

Creates a new Reader object.



848
849
850
851
852
853
854
855
# File 'lib/stripe/resources/terminal/reader.rb', line 848

def self.create(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "/v1/terminal/readers",
    params: params,
    opts: opts
  )
end

.delete(reader, params = {}, opts = {}) ⇒ Object

Deletes a Reader object.



858
859
860
861
862
863
864
865
# File 'lib/stripe/resources/terminal/reader.rb', line 858

def self.delete(reader, params = {}, opts = {})
  request_stripe_object(
    method: :delete,
    path: format("/v1/terminal/readers/%<reader>s", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.list(params = {}, opts = {}) ⇒ Object

Returns a list of Reader objects.



878
879
880
881
882
883
884
885
# File 'lib/stripe/resources/terminal/reader.rb', line 878

def self.list(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/terminal/readers",
    params: params,
    opts: opts
  )
end

.object_nameObject



16
17
18
# File 'lib/stripe/resources/terminal/reader.rb', line 16

def self.object_name
  "terminal.reader"
end

.process_payment_intent(reader, params = {}, opts = {}) ⇒ Object

Initiates a payment flow on a Reader.



898
899
900
901
902
903
904
905
# File 'lib/stripe/resources/terminal/reader.rb', line 898

def self.process_payment_intent(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.process_setup_intent(reader, params = {}, opts = {}) ⇒ Object

Initiates a setup intent flow on a Reader.



918
919
920
921
922
923
924
925
# File 'lib/stripe/resources/terminal/reader.rb', line 918

def self.process_setup_intent(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.refund_payment(reader, params = {}, opts = {}) ⇒ Object

Initiates a refund on a Reader



938
939
940
941
942
943
944
945
# File 'lib/stripe/resources/terminal/reader.rb', line 938

def self.refund_payment(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.set_reader_display(reader, params = {}, opts = {}) ⇒ Object

Sets reader display to show cart details.



958
959
960
961
962
963
964
965
# File 'lib/stripe/resources/terminal/reader.rb', line 958

def self.set_reader_display(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.update(reader, params = {}, opts = {}) ⇒ Object

Updates a Reader object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.



968
969
970
971
972
973
974
975
# File 'lib/stripe/resources/terminal/reader.rb', line 968

def self.update(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

#cancel_action(params = {}, opts = {}) ⇒ Object

Cancels the current reader action.



768
769
770
771
772
773
774
775
# File 'lib/stripe/resources/terminal/reader.rb', line 768

def cancel_action(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/cancel_action", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#collect_inputs(params = {}, opts = {}) ⇒ Object

Initiates an input collection flow on a Reader.



788
789
790
791
792
793
794
795
# File 'lib/stripe/resources/terminal/reader.rb', line 788

def collect_inputs(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#collect_payment_method(params = {}, opts = {}) ⇒ Object

Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.



808
809
810
811
812
813
814
815
# File 'lib/stripe/resources/terminal/reader.rb', line 808

def collect_payment_method(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#confirm_payment_intent(params = {}, opts = {}) ⇒ Object

Finalizes a payment on a Reader.



828
829
830
831
832
833
834
835
# File 'lib/stripe/resources/terminal/reader.rb', line 828

def confirm_payment_intent(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#delete(params = {}, opts = {}) ⇒ Object

Deletes a Reader object.



868
869
870
871
872
873
874
875
# File 'lib/stripe/resources/terminal/reader.rb', line 868

def delete(params = {}, opts = {})
  request_stripe_object(
    method: :delete,
    path: format("/v1/terminal/readers/%<reader>s", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#process_payment_intent(params = {}, opts = {}) ⇒ Object

Initiates a payment flow on a Reader.



888
889
890
891
892
893
894
895
# File 'lib/stripe/resources/terminal/reader.rb', line 888

def process_payment_intent(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#process_setup_intent(params = {}, opts = {}) ⇒ Object

Initiates a setup intent flow on a Reader.



908
909
910
911
912
913
914
915
# File 'lib/stripe/resources/terminal/reader.rb', line 908

def process_setup_intent(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#refund_payment(params = {}, opts = {}) ⇒ Object

Initiates a refund on a Reader



928
929
930
931
932
933
934
935
# File 'lib/stripe/resources/terminal/reader.rb', line 928

def refund_payment(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#set_reader_display(params = {}, opts = {}) ⇒ Object

Sets reader display to show cart details.



948
949
950
951
952
953
954
955
# File 'lib/stripe/resources/terminal/reader.rb', line 948

def set_reader_display(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#test_helpersObject



977
978
979
# File 'lib/stripe/resources/terminal/reader.rb', line 977

def test_helpers
  TestHelpers.new(self)
end