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

Defined Under Namespace

Classes: Action, TestHelpers

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

#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #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.



708
709
710
# File 'lib/stripe/resources/terminal/reader.rb', line 708

def action
  @action
end

#deletedObject (readonly)

Always true for a deleted object



710
711
712
# File 'lib/stripe/resources/terminal/reader.rb', line 710

def deleted
  @deleted
end

#device_sw_versionObject (readonly)

The current software version of the reader.



712
713
714
# File 'lib/stripe/resources/terminal/reader.rb', line 712

def device_sw_version
  @device_sw_version
end

#device_typeObject (readonly)

Device type of the reader.



714
715
716
# File 'lib/stripe/resources/terminal/reader.rb', line 714

def device_type
  @device_type
end

#idObject (readonly)

Unique identifier for the object.



716
717
718
# File 'lib/stripe/resources/terminal/reader.rb', line 716

def id
  @id
end

#ip_addressObject (readonly)

The local IP address of the reader.



718
719
720
# File 'lib/stripe/resources/terminal/reader.rb', line 718

def ip_address
  @ip_address
end

#labelObject (readonly)

Custom label given to the reader for easier identification.



720
721
722
# File 'lib/stripe/resources/terminal/reader.rb', line 720

def label
  @label
end

#last_seen_atObject (readonly)

The last time this reader reported to Stripe backend. Timestamp is measured in milliseconds since the Unix epoch. Unlike most other Stripe timestamp fields which use seconds, this field uses milliseconds.



722
723
724
# File 'lib/stripe/resources/terminal/reader.rb', line 722

def last_seen_at
  @last_seen_at
end

#livemodeObject (readonly)

If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.



724
725
726
# File 'lib/stripe/resources/terminal/reader.rb', line 724

def livemode
  @livemode
end

#locationObject (readonly)

The location identifier of the reader.



726
727
728
# File 'lib/stripe/resources/terminal/reader.rb', line 726

def location
  @location
end

#metadataObject (readonly)

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



728
729
730
# File 'lib/stripe/resources/terminal/reader.rb', line 728

def 
  @metadata
end

#objectObject (readonly)

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



730
731
732
# File 'lib/stripe/resources/terminal/reader.rb', line 730

def object
  @object
end

#serial_numberObject (readonly)

Serial number of the reader.



732
733
734
# File 'lib/stripe/resources/terminal/reader.rb', line 732

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.



734
735
736
# File 'lib/stripe/resources/terminal/reader.rb', line 734

def status
  @status
end

Class Method Details

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

Initiates a gift card activation flow on a Reader and optionally sets its balance.



747
748
749
750
751
752
753
754
# File 'lib/stripe/resources/terminal/reader.rb', line 747

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

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

Cancels the current reader action. See Programmatic Cancellation for more details.



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

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

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

Initiates a gift card cashout flow on a Reader. A cashout sets the gift card balance to 0.



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

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

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

Initiates a gift card balance check flow on a Reader.



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

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

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

Initiates an input collection flow on a Reader to display input forms and collect information from your customers.



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

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. See Collecting a Payment method for more details.



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

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. See Confirming a Payment for more details.



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

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.



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

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.



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

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

.field_remappingsObject



1101
1102
1103
# File 'lib/stripe/resources/terminal/reader.rb', line 1101

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



1097
1098
1099
# File 'lib/stripe/resources/terminal/reader.rb', line 1097

def self.inner_class_types
  @inner_class_types = { action: Action }
end

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

Returns a list of Reader objects.



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

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. See process the payment for more details.



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

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 SetupIntent flow on a Reader. See Save directly without charging for more details.



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

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 an in-person refund on a Reader. See Refund an Interac Payment for more details.



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

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

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

Initiates a gift card reload flow on a Reader by adding the specified amount to its balance.



987
988
989
990
991
992
993
994
# File 'lib/stripe/resources/terminal/reader.rb', line 987

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

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

Sets the reader display to show cart details.



1007
1008
1009
1010
1011
1012
1013
1014
# File 'lib/stripe/resources/terminal/reader.rb', line 1007

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.



1017
1018
1019
1020
1021
1022
1023
1024
# File 'lib/stripe/resources/terminal/reader.rb', line 1017

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

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

Initiates a gift card activation flow on a Reader and optionally sets its balance.



737
738
739
740
741
742
743
744
# File 'lib/stripe/resources/terminal/reader.rb', line 737

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

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

Cancels the current reader action. See Programmatic Cancellation for more details.



757
758
759
760
761
762
763
764
# File 'lib/stripe/resources/terminal/reader.rb', line 757

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

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

Initiates a gift card cashout flow on a Reader. A cashout sets the gift card balance to 0.



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

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

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

Initiates a gift card balance check flow on a Reader.



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

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

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

Initiates an input collection flow on a Reader to display input forms and collect information from your customers.



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

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. See Collecting a Payment method for more details.



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

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. See Confirming a Payment for more details.



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

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.



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

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. See process the payment for more details.



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

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 SetupIntent flow on a Reader. See Save directly without charging for more details.



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

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 an in-person refund on a Reader. See Refund an Interac Payment for more details.



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

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

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

Initiates a gift card reload flow on a Reader by adding the specified amount to its balance.



977
978
979
980
981
982
983
984
# File 'lib/stripe/resources/terminal/reader.rb', line 977

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

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

Sets the reader display to show cart details.



997
998
999
1000
1001
1002
1003
1004
# File 'lib/stripe/resources/terminal/reader.rb', line 997

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



1026
1027
1028
# File 'lib/stripe/resources/terminal/reader.rb', line 1026

def test_helpers
  TestHelpers.new(self)
end