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

#==, #[], #[]=, #_get_inner_class_type, 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.



1004
1005
1006
# File 'lib/stripe/resources/terminal/reader.rb', line 1004

def action
  @action
end

#deletedObject (readonly)

Always true for a deleted object



1028
1029
1030
# File 'lib/stripe/resources/terminal/reader.rb', line 1028

def deleted
  @deleted
end

#device_sw_versionObject (readonly)

The current software version of the reader.



1006
1007
1008
# File 'lib/stripe/resources/terminal/reader.rb', line 1006

def device_sw_version
  @device_sw_version
end

#device_typeObject (readonly)

Device type of the reader.



1008
1009
1010
# File 'lib/stripe/resources/terminal/reader.rb', line 1008

def device_type
  @device_type
end

#idObject (readonly)

Unique identifier for the object.



1010
1011
1012
# File 'lib/stripe/resources/terminal/reader.rb', line 1010

def id
  @id
end

#ip_addressObject (readonly)

The local IP address of the reader.



1012
1013
1014
# File 'lib/stripe/resources/terminal/reader.rb', line 1012

def ip_address
  @ip_address
end

#labelObject (readonly)

Custom label given to the reader for easier identification.



1014
1015
1016
# File 'lib/stripe/resources/terminal/reader.rb', line 1014

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.



1016
1017
1018
# File 'lib/stripe/resources/terminal/reader.rb', line 1016

def livemode
  @livemode
end

#locationObject (readonly)

The location identifier of the reader.



1018
1019
1020
# File 'lib/stripe/resources/terminal/reader.rb', line 1018

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.



1020
1021
1022
# File 'lib/stripe/resources/terminal/reader.rb', line 1020

def 
  @metadata
end

#objectObject (readonly)

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



1022
1023
1024
# File 'lib/stripe/resources/terminal/reader.rb', line 1022

def object
  @object
end

#serial_numberObject (readonly)

Serial number of the reader.



1024
1025
1026
# File 'lib/stripe/resources/terminal/reader.rb', line 1024

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.



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

def status
  @status
end

Class Method Details

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

Cancels the current reader action.



1041
1042
1043
1044
1045
1046
1047
1048
# File 'lib/stripe/resources/terminal/reader.rb', line 1041

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.



1061
1062
1063
1064
1065
1066
1067
1068
# File 'lib/stripe/resources/terminal/reader.rb', line 1061

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.



1081
1082
1083
1084
1085
1086
1087
1088
# File 'lib/stripe/resources/terminal/reader.rb', line 1081

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.



1101
1102
1103
1104
1105
1106
1107
1108
# File 'lib/stripe/resources/terminal/reader.rb', line 1101

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.



1111
1112
1113
1114
1115
1116
1117
1118
# File 'lib/stripe/resources/terminal/reader.rb', line 1111

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.



1121
1122
1123
1124
1125
1126
1127
1128
# File 'lib/stripe/resources/terminal/reader.rb', line 1121

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



1315
1316
1317
# File 'lib/stripe/resources/terminal/reader.rb', line 1315

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



1311
1312
1313
# File 'lib/stripe/resources/terminal/reader.rb', line 1311

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

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

Returns a list of Reader objects.



1141
1142
1143
1144
1145
1146
1147
1148
# File 'lib/stripe/resources/terminal/reader.rb', line 1141

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.



1161
1162
1163
1164
1165
1166
1167
1168
# File 'lib/stripe/resources/terminal/reader.rb', line 1161

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.



1181
1182
1183
1184
1185
1186
1187
1188
# File 'lib/stripe/resources/terminal/reader.rb', line 1181

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



1201
1202
1203
1204
1205
1206
1207
1208
# File 'lib/stripe/resources/terminal/reader.rb', line 1201

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.



1221
1222
1223
1224
1225
1226
1227
1228
# File 'lib/stripe/resources/terminal/reader.rb', line 1221

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.



1231
1232
1233
1234
1235
1236
1237
1238
# File 'lib/stripe/resources/terminal/reader.rb', line 1231

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.



1031
1032
1033
1034
1035
1036
1037
1038
# File 'lib/stripe/resources/terminal/reader.rb', line 1031

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.



1051
1052
1053
1054
1055
1056
1057
1058
# File 'lib/stripe/resources/terminal/reader.rb', line 1051

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.



1071
1072
1073
1074
1075
1076
1077
1078
# File 'lib/stripe/resources/terminal/reader.rb', line 1071

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.



1091
1092
1093
1094
1095
1096
1097
1098
# File 'lib/stripe/resources/terminal/reader.rb', line 1091

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.



1131
1132
1133
1134
1135
1136
1137
1138
# File 'lib/stripe/resources/terminal/reader.rb', line 1131

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.



1151
1152
1153
1154
1155
1156
1157
1158
# File 'lib/stripe/resources/terminal/reader.rb', line 1151

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.



1171
1172
1173
1174
1175
1176
1177
1178
# File 'lib/stripe/resources/terminal/reader.rb', line 1171

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



1191
1192
1193
1194
1195
1196
1197
1198
# File 'lib/stripe/resources/terminal/reader.rb', line 1191

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.



1211
1212
1213
1214
1215
1216
1217
1218
# File 'lib/stripe/resources/terminal/reader.rb', line 1211

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



1240
1241
1242
# File 'lib/stripe/resources/terminal/reader.rb', line 1240

def test_helpers
  TestHelpers.new(self)
end