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](docs.stripe.com/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?, 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.



535
536
537
# File 'lib/stripe/resources/terminal/reader.rb', line 535

def action
  @action
end

#deletedObject (readonly)

Always true for a deleted object



537
538
539
# File 'lib/stripe/resources/terminal/reader.rb', line 537

def deleted
  @deleted
end

#device_sw_versionObject (readonly)

The current software version of the reader.



539
540
541
# File 'lib/stripe/resources/terminal/reader.rb', line 539

def device_sw_version
  @device_sw_version
end

#device_typeObject (readonly)

Device type of the reader.



541
542
543
# File 'lib/stripe/resources/terminal/reader.rb', line 541

def device_type
  @device_type
end

#idObject (readonly)

Unique identifier for the object.



543
544
545
# File 'lib/stripe/resources/terminal/reader.rb', line 543

def id
  @id
end

#ip_addressObject (readonly)

The local IP address of the reader.



545
546
547
# File 'lib/stripe/resources/terminal/reader.rb', line 545

def ip_address
  @ip_address
end

#labelObject (readonly)

Custom label given to the reader for easier identification.



547
548
549
# File 'lib/stripe/resources/terminal/reader.rb', line 547

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.



549
550
551
# File 'lib/stripe/resources/terminal/reader.rb', line 549

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`.



551
552
553
# File 'lib/stripe/resources/terminal/reader.rb', line 551

def livemode
  @livemode
end

#locationObject (readonly)

The location identifier of the reader.



553
554
555
# File 'lib/stripe/resources/terminal/reader.rb', line 553

def location
  @location
end

#metadataObject (readonly)

Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



555
556
557
# File 'lib/stripe/resources/terminal/reader.rb', line 555

def 
  @metadata
end

#objectObject (readonly)

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



557
558
559
# File 'lib/stripe/resources/terminal/reader.rb', line 557

def object
  @object
end

#serial_numberObject (readonly)

Serial number of the reader.



559
560
561
# File 'lib/stripe/resources/terminal/reader.rb', line 559

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.



561
562
563
# File 'lib/stripe/resources/terminal/reader.rb', line 561

def status
  @status
end

Class Method Details

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

Cancels the current reader action. See [Programmatic Cancellation](docs.stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven#programmatic-cancellation) for more details.



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

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](docs.stripe.com/docs/terminal/features/collect-inputs) on a Reader to display input forms and collect information from your customers.



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

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](docs.stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven&process=inspect#collect-a-paymentmethod) for more details.



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

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



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

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.



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

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.



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

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



848
849
850
# File 'lib/stripe/resources/terminal/reader.rb', line 848

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



844
845
846
# File 'lib/stripe/resources/terminal/reader.rb', line 844

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

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

Returns a list of Reader objects.



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

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



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

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](docs.stripe.com/docs/terminal/features/saving-payment-details/save-directly) for more details.



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

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](docs.stripe.com/docs/terminal/payments/regional?integration-country=CA#refund-an-interac-payment) for more details.



734
735
736
737
738
739
740
741
# File 'lib/stripe/resources/terminal/reader.rb', line 734

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 the reader display to show [cart details](docs.stripe.com/docs/terminal/features/display).



754
755
756
757
758
759
760
761
# File 'lib/stripe/resources/terminal/reader.rb', line 754

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.



764
765
766
767
768
769
770
771
# File 'lib/stripe/resources/terminal/reader.rb', line 764

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. See [Programmatic Cancellation](docs.stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven#programmatic-cancellation) for more details.



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

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](docs.stripe.com/docs/terminal/features/collect-inputs) on a Reader to display input forms and collect information from your customers.



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

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](docs.stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven&process=inspect#collect-a-paymentmethod) for more details.



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

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



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

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.



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

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



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

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](docs.stripe.com/docs/terminal/features/saving-payment-details/save-directly) for more details.



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

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](docs.stripe.com/docs/terminal/payments/regional?integration-country=CA#refund-an-interac-payment) for more details.



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

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 the reader display to show [cart details](docs.stripe.com/docs/terminal/features/display).



744
745
746
747
748
749
750
751
# File 'lib/stripe/resources/terminal/reader.rb', line 744

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



773
774
775
# File 'lib/stripe/resources/terminal/reader.rb', line 773

def test_helpers
  TestHelpers.new(self)
end