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, 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?, #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.



499
500
501
# File 'lib/stripe/resources/terminal/reader.rb', line 499

def action
  @action
end

#deletedObject (readonly)

Always true for a deleted object



523
524
525
# File 'lib/stripe/resources/terminal/reader.rb', line 523

def deleted
  @deleted
end

#device_sw_versionObject (readonly)

The current software version of the reader.



501
502
503
# File 'lib/stripe/resources/terminal/reader.rb', line 501

def device_sw_version
  @device_sw_version
end

#device_typeObject (readonly)

Device type of the reader.



503
504
505
# File 'lib/stripe/resources/terminal/reader.rb', line 503

def device_type
  @device_type
end

#idObject (readonly)

Unique identifier for the object.



505
506
507
# File 'lib/stripe/resources/terminal/reader.rb', line 505

def id
  @id
end

#ip_addressObject (readonly)

The local IP address of the reader.



507
508
509
# File 'lib/stripe/resources/terminal/reader.rb', line 507

def ip_address
  @ip_address
end

#labelObject (readonly)

Custom label given to the reader for easier identification.



509
510
511
# File 'lib/stripe/resources/terminal/reader.rb', line 509

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.



511
512
513
# File 'lib/stripe/resources/terminal/reader.rb', line 511

def livemode
  @livemode
end

#locationObject (readonly)

The location identifier of the reader.



513
514
515
# File 'lib/stripe/resources/terminal/reader.rb', line 513

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.



515
516
517
# File 'lib/stripe/resources/terminal/reader.rb', line 515

def 
  @metadata
end

#objectObject (readonly)

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



517
518
519
# File 'lib/stripe/resources/terminal/reader.rb', line 517

def object
  @object
end

#serial_numberObject (readonly)

Serial number of the reader.



519
520
521
# File 'lib/stripe/resources/terminal/reader.rb', line 519

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.



521
522
523
# File 'lib/stripe/resources/terminal/reader.rb', line 521

def status
  @status
end

Class Method Details

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

Cancels the current reader action.



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

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.



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

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.



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

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.



596
597
598
599
600
601
602
603
# File 'lib/stripe/resources/terminal/reader.rb', line 596

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.



606
607
608
609
610
611
612
613
# File 'lib/stripe/resources/terminal/reader.rb', line 606

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.



616
617
618
619
620
621
622
623
# File 'lib/stripe/resources/terminal/reader.rb', line 616

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



810
811
812
# File 'lib/stripe/resources/terminal/reader.rb', line 810

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



806
807
808
# File 'lib/stripe/resources/terminal/reader.rb', line 806

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

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

Returns a list of Reader objects.



636
637
638
639
640
641
642
643
# File 'lib/stripe/resources/terminal/reader.rb', line 636

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.



656
657
658
659
660
661
662
663
# File 'lib/stripe/resources/terminal/reader.rb', line 656

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.



676
677
678
679
680
681
682
683
# File 'lib/stripe/resources/terminal/reader.rb', line 676

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



696
697
698
699
700
701
702
703
# File 'lib/stripe/resources/terminal/reader.rb', line 696

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.



716
717
718
719
720
721
722
723
# File 'lib/stripe/resources/terminal/reader.rb', line 716

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.



726
727
728
729
730
731
732
733
# File 'lib/stripe/resources/terminal/reader.rb', line 726

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.



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

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.



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

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.



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

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.



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

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.



626
627
628
629
630
631
632
633
# File 'lib/stripe/resources/terminal/reader.rb', line 626

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.



646
647
648
649
650
651
652
653
# File 'lib/stripe/resources/terminal/reader.rb', line 646

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.



666
667
668
669
670
671
672
673
# File 'lib/stripe/resources/terminal/reader.rb', line 666

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



686
687
688
689
690
691
692
693
# File 'lib/stripe/resources/terminal/reader.rb', line 686

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.



706
707
708
709
710
711
712
713
# File 'lib/stripe/resources/terminal/reader.rb', line 706

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



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

def test_helpers
  TestHelpers.new(self)
end