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, CreateParams, DeleteParams, ListParams, PresentPaymentMethodParams, ProcessPaymentIntentParams, ProcessSetupIntentParams, RefundPaymentParams, SetReaderDisplayParams, TestHelpers, 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.



421
422
423
# File 'lib/stripe/resources/terminal/reader.rb', line 421

def action
  @action
end

#deletedObject (readonly)

Always true for a deleted object



445
446
447
# File 'lib/stripe/resources/terminal/reader.rb', line 445

def deleted
  @deleted
end

#device_sw_versionObject (readonly)

The current software version of the reader.



423
424
425
# File 'lib/stripe/resources/terminal/reader.rb', line 423

def device_sw_version
  @device_sw_version
end

#device_typeObject (readonly)

Type of reader, one of ‘bbpos_wisepad3`, `stripe_m2`, `stripe_s700`, `bbpos_chipper2x`, `bbpos_wisepos_e`, `verifone_P400`, `simulated_wisepos_e`, or `mobile_phone_reader`.



425
426
427
# File 'lib/stripe/resources/terminal/reader.rb', line 425

def device_type
  @device_type
end

#idObject (readonly)

Unique identifier for the object.



427
428
429
# File 'lib/stripe/resources/terminal/reader.rb', line 427

def id
  @id
end

#ip_addressObject (readonly)

The local IP address of the reader.



429
430
431
# File 'lib/stripe/resources/terminal/reader.rb', line 429

def ip_address
  @ip_address
end

#labelObject (readonly)

Custom label given to the reader for easier identification.



431
432
433
# File 'lib/stripe/resources/terminal/reader.rb', line 431

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.



433
434
435
# File 'lib/stripe/resources/terminal/reader.rb', line 433

def livemode
  @livemode
end

#locationObject (readonly)

The location identifier of the reader.



435
436
437
# File 'lib/stripe/resources/terminal/reader.rb', line 435

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.



437
438
439
# File 'lib/stripe/resources/terminal/reader.rb', line 437

def 
  @metadata
end

#objectObject (readonly)

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



439
440
441
# File 'lib/stripe/resources/terminal/reader.rb', line 439

def object
  @object
end

#serial_numberObject (readonly)

Serial number of the reader.



441
442
443
# File 'lib/stripe/resources/terminal/reader.rb', line 441

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.



443
444
445
# File 'lib/stripe/resources/terminal/reader.rb', line 443

def status
  @status
end

Class Method Details

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

Cancels the current reader action.



458
459
460
461
462
463
464
465
# File 'lib/stripe/resources/terminal/reader.rb', line 458

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

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

Creates a new Reader object.



468
469
470
471
472
473
474
475
# File 'lib/stripe/resources/terminal/reader.rb', line 468

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.



478
479
480
481
482
483
484
485
# File 'lib/stripe/resources/terminal/reader.rb', line 478

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.



498
499
500
501
502
503
504
505
# File 'lib/stripe/resources/terminal/reader.rb', line 498

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.



518
519
520
521
522
523
524
525
# File 'lib/stripe/resources/terminal/reader.rb', line 518

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.



538
539
540
541
542
543
544
545
# File 'lib/stripe/resources/terminal/reader.rb', line 538

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



558
559
560
561
562
563
564
565
# File 'lib/stripe/resources/terminal/reader.rb', line 558

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.



578
579
580
581
582
583
584
585
# File 'lib/stripe/resources/terminal/reader.rb', line 578

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.



588
589
590
591
592
593
594
595
# File 'lib/stripe/resources/terminal/reader.rb', line 588

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.



448
449
450
451
452
453
454
455
# File 'lib/stripe/resources/terminal/reader.rb', line 448

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

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

Deletes a Reader object.



488
489
490
491
492
493
494
495
# File 'lib/stripe/resources/terminal/reader.rb', line 488

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.



508
509
510
511
512
513
514
515
# File 'lib/stripe/resources/terminal/reader.rb', line 508

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.



528
529
530
531
532
533
534
535
# File 'lib/stripe/resources/terminal/reader.rb', line 528

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



548
549
550
551
552
553
554
555
# File 'lib/stripe/resources/terminal/reader.rb', line 548

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.



568
569
570
571
572
573
574
575
# File 'lib/stripe/resources/terminal/reader.rb', line 568

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



597
598
599
# File 'lib/stripe/resources/terminal/reader.rb', line 597

def test_helpers
  TestHelpers.new(self)
end