github.com/stripe/stripe-go/v76@v76.25.0/terminal_reader.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // The reason for the refund.
    10  type TerminalReaderActionRefundPaymentReason string
    11  
    12  // List of values that TerminalReaderActionRefundPaymentReason can take
    13  const (
    14  	TerminalReaderActionRefundPaymentReasonDuplicate           TerminalReaderActionRefundPaymentReason = "duplicate"
    15  	TerminalReaderActionRefundPaymentReasonFraudulent          TerminalReaderActionRefundPaymentReason = "fraudulent"
    16  	TerminalReaderActionRefundPaymentReasonRequestedByCustomer TerminalReaderActionRefundPaymentReason = "requested_by_customer"
    17  )
    18  
    19  // Type of information to be displayed by the reader.
    20  type TerminalReaderActionSetReaderDisplayType string
    21  
    22  // List of values that TerminalReaderActionSetReaderDisplayType can take
    23  const (
    24  	TerminalReaderActionSetReaderDisplayTypeCart TerminalReaderActionSetReaderDisplayType = "cart"
    25  )
    26  
    27  // Status of the action performed by the reader.
    28  type TerminalReaderActionStatus string
    29  
    30  // List of values that TerminalReaderActionStatus can take
    31  const (
    32  	TerminalReaderActionStatusFailed     TerminalReaderActionStatus = "failed"
    33  	TerminalReaderActionStatusInProgress TerminalReaderActionStatus = "in_progress"
    34  	TerminalReaderActionStatusSucceeded  TerminalReaderActionStatus = "succeeded"
    35  )
    36  
    37  // Type of action performed by the reader.
    38  type TerminalReaderActionType string
    39  
    40  // List of values that TerminalReaderActionType can take
    41  const (
    42  	TerminalReaderActionTypeProcessPaymentIntent TerminalReaderActionType = "process_payment_intent"
    43  	TerminalReaderActionTypeProcessSetupIntent   TerminalReaderActionType = "process_setup_intent"
    44  	TerminalReaderActionTypeRefundPayment        TerminalReaderActionType = "refund_payment"
    45  	TerminalReaderActionTypeSetReaderDisplay     TerminalReaderActionType = "set_reader_display"
    46  )
    47  
    48  // Type of reader, one of `bbpos_wisepad3`, `stripe_m2`, `bbpos_chipper2x`, `bbpos_wisepos_e`, `verifone_P400`, `simulated_wisepos_e`, or `mobile_phone_reader`.
    49  type TerminalReaderDeviceType string
    50  
    51  // List of values that TerminalReaderDeviceType can take
    52  const (
    53  	TerminalReaderDeviceTypeBBPOSChipper2X    TerminalReaderDeviceType = "bbpos_chipper2x"
    54  	TerminalReaderDeviceTypeBBPOSWisePad3     TerminalReaderDeviceType = "bbpos_wisepad3"
    55  	TerminalReaderDeviceTypeBBPOSWisePOSE     TerminalReaderDeviceType = "bbpos_wisepos_e"
    56  	TerminalReaderDeviceTypeMobilePhoneReader TerminalReaderDeviceType = "mobile_phone_reader"
    57  	TerminalReaderDeviceTypeSimulatedWisePOSE TerminalReaderDeviceType = "simulated_wisepos_e"
    58  	TerminalReaderDeviceTypeStripeM2          TerminalReaderDeviceType = "stripe_m2"
    59  	TerminalReaderDeviceTypeVerifoneP400      TerminalReaderDeviceType = "verifone_P400"
    60  )
    61  
    62  // Deletes a Reader object.
    63  type TerminalReaderParams struct {
    64  	Params `form:"*"`
    65  	// Specifies which fields in the response should be expanded.
    66  	Expand []*string `form:"expand"`
    67  	// Custom label given to the reader for easier identification. If no label is specified, the registration code will be used.
    68  	Label *string `form:"label"`
    69  	// The location to assign the reader to.
    70  	Location *string `form:"location"`
    71  	// Set of [key-value pairs](https://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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
    72  	Metadata map[string]string `form:"metadata"`
    73  	// A code generated by the reader used for registering to an account.
    74  	RegistrationCode *string `form:"registration_code"`
    75  }
    76  
    77  // AddExpand appends a new field to expand.
    78  func (p *TerminalReaderParams) AddExpand(f string) {
    79  	p.Expand = append(p.Expand, &f)
    80  }
    81  
    82  // AddMetadata adds a new key-value pair to the Metadata.
    83  func (p *TerminalReaderParams) AddMetadata(key string, value string) {
    84  	if p.Metadata == nil {
    85  		p.Metadata = make(map[string]string)
    86  	}
    87  
    88  	p.Metadata[key] = value
    89  }
    90  
    91  // Returns a list of Reader objects.
    92  type TerminalReaderListParams struct {
    93  	ListParams `form:"*"`
    94  	// Filters readers by device type
    95  	DeviceType *string `form:"device_type"`
    96  	// Specifies which fields in the response should be expanded.
    97  	Expand []*string `form:"expand"`
    98  	// A location ID to filter the response list to only readers at the specific location
    99  	Location *string `form:"location"`
   100  	// Filters readers by serial number
   101  	SerialNumber *string `form:"serial_number"`
   102  	// A status filter to filter readers to only offline or online readers
   103  	Status *string `form:"status"`
   104  }
   105  
   106  // AddExpand appends a new field to expand.
   107  func (p *TerminalReaderListParams) AddExpand(f string) {
   108  	p.Expand = append(p.Expand, &f)
   109  }
   110  
   111  // Cancels the current reader action.
   112  type TerminalReaderCancelActionParams struct {
   113  	Params `form:"*"`
   114  	// Specifies which fields in the response should be expanded.
   115  	Expand []*string `form:"expand"`
   116  }
   117  
   118  // AddExpand appends a new field to expand.
   119  func (p *TerminalReaderCancelActionParams) AddExpand(f string) {
   120  	p.Expand = append(p.Expand, &f)
   121  }
   122  
   123  // Tipping configuration for this transaction.
   124  type TerminalReaderProcessPaymentIntentProcessConfigTippingParams struct {
   125  	// Amount used to calculate tip suggestions on tipping selection screen for this transaction. Must be a positive integer in the smallest currency unit (e.g., 100 cents to represent $1.00 or 100 to represent ¥100, a zero-decimal currency).
   126  	AmountEligible *int64 `form:"amount_eligible"`
   127  }
   128  
   129  // Configuration overrides
   130  type TerminalReaderProcessPaymentIntentProcessConfigParams struct {
   131  	// Enables cancel button on transaction screens.
   132  	EnableCustomerCancellation *bool `form:"enable_customer_cancellation"`
   133  	// Override showing a tipping selection screen on this transaction.
   134  	SkipTipping *bool `form:"skip_tipping"`
   135  	// Tipping configuration for this transaction.
   136  	Tipping *TerminalReaderProcessPaymentIntentProcessConfigTippingParams `form:"tipping"`
   137  }
   138  
   139  // Initiates a payment flow on a Reader.
   140  type TerminalReaderProcessPaymentIntentParams struct {
   141  	Params `form:"*"`
   142  	// Specifies which fields in the response should be expanded.
   143  	Expand []*string `form:"expand"`
   144  	// PaymentIntent ID
   145  	PaymentIntent *string `form:"payment_intent"`
   146  	// Configuration overrides
   147  	ProcessConfig *TerminalReaderProcessPaymentIntentProcessConfigParams `form:"process_config"`
   148  }
   149  
   150  // AddExpand appends a new field to expand.
   151  func (p *TerminalReaderProcessPaymentIntentParams) AddExpand(f string) {
   152  	p.Expand = append(p.Expand, &f)
   153  }
   154  
   155  // Configuration overrides
   156  type TerminalReaderProcessSetupIntentProcessConfigParams struct {
   157  	// Enables cancel button on transaction screens.
   158  	EnableCustomerCancellation *bool `form:"enable_customer_cancellation"`
   159  }
   160  
   161  // Initiates a setup intent flow on a Reader.
   162  type TerminalReaderProcessSetupIntentParams struct {
   163  	Params `form:"*"`
   164  	// Customer Consent Collected
   165  	CustomerConsentCollected *bool `form:"customer_consent_collected"`
   166  	// Specifies which fields in the response should be expanded.
   167  	Expand []*string `form:"expand"`
   168  	// Configuration overrides
   169  	ProcessConfig *TerminalReaderProcessSetupIntentProcessConfigParams `form:"process_config"`
   170  	// SetupIntent ID
   171  	SetupIntent *string `form:"setup_intent"`
   172  }
   173  
   174  // AddExpand appends a new field to expand.
   175  func (p *TerminalReaderProcessSetupIntentParams) AddExpand(f string) {
   176  	p.Expand = append(p.Expand, &f)
   177  }
   178  
   179  // Configuration overrides
   180  type TerminalReaderRefundPaymentRefundPaymentConfigParams struct {
   181  	// Enables cancel button on transaction screens.
   182  	EnableCustomerCancellation *bool `form:"enable_customer_cancellation"`
   183  }
   184  
   185  // Initiates a refund on a Reader
   186  type TerminalReaderRefundPaymentParams struct {
   187  	Params `form:"*"`
   188  	// A positive integer in __cents__ representing how much of this charge to refund.
   189  	Amount *int64 `form:"amount"`
   190  	// ID of the Charge to refund.
   191  	Charge *string `form:"charge"`
   192  	// Specifies which fields in the response should be expanded.
   193  	Expand []*string `form:"expand"`
   194  	// Set of [key-value pairs](https://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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
   195  	Metadata map[string]string `form:"metadata"`
   196  	// ID of the PaymentIntent to refund.
   197  	PaymentIntent *string `form:"payment_intent"`
   198  	// Boolean indicating whether the application fee should be refunded when refunding this charge. If a full charge refund is given, the full application fee will be refunded. Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. An application fee can be refunded only by the application that created the charge.
   199  	RefundApplicationFee *bool `form:"refund_application_fee"`
   200  	// Configuration overrides
   201  	RefundPaymentConfig *TerminalReaderRefundPaymentRefundPaymentConfigParams `form:"refund_payment_config"`
   202  	// Boolean indicating whether the transfer should be reversed when refunding this charge. The transfer will be reversed proportionally to the amount being refunded (either the entire or partial amount). A transfer can be reversed only by the application that created the charge.
   203  	ReverseTransfer *bool `form:"reverse_transfer"`
   204  }
   205  
   206  // AddExpand appends a new field to expand.
   207  func (p *TerminalReaderRefundPaymentParams) AddExpand(f string) {
   208  	p.Expand = append(p.Expand, &f)
   209  }
   210  
   211  // AddMetadata adds a new key-value pair to the Metadata.
   212  func (p *TerminalReaderRefundPaymentParams) AddMetadata(key string, value string) {
   213  	if p.Metadata == nil {
   214  		p.Metadata = make(map[string]string)
   215  	}
   216  
   217  	p.Metadata[key] = value
   218  }
   219  
   220  // Array of line items that were purchased.
   221  type TerminalReaderSetReaderDisplayCartLineItemParams struct {
   222  	// The price of the item in cents.
   223  	Amount *int64 `form:"amount"`
   224  	// The description or name of the item.
   225  	Description *string `form:"description"`
   226  	// The quantity of the line item being purchased.
   227  	Quantity *int64 `form:"quantity"`
   228  }
   229  
   230  // Cart
   231  type TerminalReaderSetReaderDisplayCartParams struct {
   232  	// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
   233  	Currency *string `form:"currency"`
   234  	// Array of line items that were purchased.
   235  	LineItems []*TerminalReaderSetReaderDisplayCartLineItemParams `form:"line_items"`
   236  	// The amount of tax in cents.
   237  	Tax *int64 `form:"tax"`
   238  	// Total balance of cart due in cents.
   239  	Total *int64 `form:"total"`
   240  }
   241  
   242  // Sets reader display to show cart details.
   243  type TerminalReaderSetReaderDisplayParams struct {
   244  	Params `form:"*"`
   245  	// Cart
   246  	Cart *TerminalReaderSetReaderDisplayCartParams `form:"cart"`
   247  	// Specifies which fields in the response should be expanded.
   248  	Expand []*string `form:"expand"`
   249  	// Type
   250  	Type *string `form:"type"`
   251  }
   252  
   253  // AddExpand appends a new field to expand.
   254  func (p *TerminalReaderSetReaderDisplayParams) AddExpand(f string) {
   255  	p.Expand = append(p.Expand, &f)
   256  }
   257  
   258  // Represents a per-transaction tipping configuration
   259  type TerminalReaderActionProcessPaymentIntentProcessConfigTipping struct {
   260  	// Amount used to calculate tip suggestions on tipping selection screen for this transaction. Must be a positive integer in the smallest currency unit (e.g., 100 cents to represent $1.00 or 100 to represent ¥100, a zero-decimal currency).
   261  	AmountEligible int64 `json:"amount_eligible"`
   262  }
   263  
   264  // Represents a per-transaction override of a reader configuration
   265  type TerminalReaderActionProcessPaymentIntentProcessConfig struct {
   266  	// Enable customer initiated cancellation when processing this payment.
   267  	EnableCustomerCancellation bool `json:"enable_customer_cancellation"`
   268  	// Override showing a tipping selection screen on this transaction.
   269  	SkipTipping bool `json:"skip_tipping"`
   270  	// Represents a per-transaction tipping configuration
   271  	Tipping *TerminalReaderActionProcessPaymentIntentProcessConfigTipping `json:"tipping"`
   272  }
   273  
   274  // Represents a reader action to process a payment intent
   275  type TerminalReaderActionProcessPaymentIntent struct {
   276  	// Most recent PaymentIntent processed by the reader.
   277  	PaymentIntent *PaymentIntent `json:"payment_intent"`
   278  	// Represents a per-transaction override of a reader configuration
   279  	ProcessConfig *TerminalReaderActionProcessPaymentIntentProcessConfig `json:"process_config"`
   280  }
   281  
   282  // Represents a per-setup override of a reader configuration
   283  type TerminalReaderActionProcessSetupIntentProcessConfig struct {
   284  	// Enable customer initiated cancellation when processing this SetupIntent.
   285  	EnableCustomerCancellation bool `json:"enable_customer_cancellation"`
   286  }
   287  
   288  // Represents a reader action to process a setup intent
   289  type TerminalReaderActionProcessSetupIntent struct {
   290  	// ID of a card PaymentMethod generated from the card_present PaymentMethod that may be attached to a Customer for future transactions. Only present if it was possible to generate a card PaymentMethod.
   291  	GeneratedCard string `json:"generated_card"`
   292  	// Represents a per-setup override of a reader configuration
   293  	ProcessConfig *TerminalReaderActionProcessSetupIntentProcessConfig `json:"process_config"`
   294  	// Most recent SetupIntent processed by the reader.
   295  	SetupIntent *SetupIntent `json:"setup_intent"`
   296  }
   297  
   298  // Represents a per-transaction override of a reader configuration
   299  type TerminalReaderActionRefundPaymentRefundPaymentConfig struct {
   300  	// Enable customer initiated cancellation when refunding this payment.
   301  	EnableCustomerCancellation bool `json:"enable_customer_cancellation"`
   302  }
   303  
   304  // Represents a reader action to refund a payment
   305  type TerminalReaderActionRefundPayment struct {
   306  	// The amount being refunded.
   307  	Amount int64 `json:"amount"`
   308  	// Charge that is being refunded.
   309  	Charge *Charge `json:"charge"`
   310  	// Set of [key-value pairs](https://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.
   311  	Metadata map[string]string `json:"metadata"`
   312  	// Payment intent that is being refunded.
   313  	PaymentIntent *PaymentIntent `json:"payment_intent"`
   314  	// The reason for the refund.
   315  	Reason TerminalReaderActionRefundPaymentReason `json:"reason"`
   316  	// Unique identifier for the refund object.
   317  	Refund *Refund `json:"refund"`
   318  	// Boolean indicating whether the application fee should be refunded when refunding this charge. If a full charge refund is given, the full application fee will be refunded. Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. An application fee can be refunded only by the application that created the charge.
   319  	RefundApplicationFee bool `json:"refund_application_fee"`
   320  	// Represents a per-transaction override of a reader configuration
   321  	RefundPaymentConfig *TerminalReaderActionRefundPaymentRefundPaymentConfig `json:"refund_payment_config"`
   322  	// Boolean indicating whether the transfer should be reversed when refunding this charge. The transfer will be reversed proportionally to the amount being refunded (either the entire or partial amount). A transfer can be reversed only by the application that created the charge.
   323  	ReverseTransfer bool `json:"reverse_transfer"`
   324  }
   325  
   326  // List of line items in the cart.
   327  type TerminalReaderActionSetReaderDisplayCartLineItem struct {
   328  	// The amount of the line item. A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
   329  	Amount int64 `json:"amount"`
   330  	// Description of the line item.
   331  	Description string `json:"description"`
   332  	// The quantity of the line item.
   333  	Quantity int64 `json:"quantity"`
   334  }
   335  
   336  // Cart object to be displayed by the reader.
   337  type TerminalReaderActionSetReaderDisplayCart struct {
   338  	// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
   339  	Currency Currency `json:"currency"`
   340  	// List of line items in the cart.
   341  	LineItems []*TerminalReaderActionSetReaderDisplayCartLineItem `json:"line_items"`
   342  	// Tax amount for the entire cart. A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
   343  	Tax int64 `json:"tax"`
   344  	// Total amount for the entire cart, including tax. A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
   345  	Total int64 `json:"total"`
   346  }
   347  
   348  // Represents a reader action to set the reader display
   349  type TerminalReaderActionSetReaderDisplay struct {
   350  	// Cart object to be displayed by the reader.
   351  	Cart *TerminalReaderActionSetReaderDisplayCart `json:"cart"`
   352  	// Type of information to be displayed by the reader.
   353  	Type TerminalReaderActionSetReaderDisplayType `json:"type"`
   354  }
   355  
   356  // The most recent action performed by the reader.
   357  type TerminalReaderAction struct {
   358  	// Failure code, only set if status is `failed`.
   359  	FailureCode string `json:"failure_code"`
   360  	// Detailed failure message, only set if status is `failed`.
   361  	FailureMessage string `json:"failure_message"`
   362  	// Represents a reader action to process a payment intent
   363  	ProcessPaymentIntent *TerminalReaderActionProcessPaymentIntent `json:"process_payment_intent"`
   364  	// Represents a reader action to process a setup intent
   365  	ProcessSetupIntent *TerminalReaderActionProcessSetupIntent `json:"process_setup_intent"`
   366  	// Represents a reader action to refund a payment
   367  	RefundPayment *TerminalReaderActionRefundPayment `json:"refund_payment"`
   368  	// Represents a reader action to set the reader display
   369  	SetReaderDisplay *TerminalReaderActionSetReaderDisplay `json:"set_reader_display"`
   370  	// Status of the action performed by the reader.
   371  	Status TerminalReaderActionStatus `json:"status"`
   372  	// Type of action performed by the reader.
   373  	Type TerminalReaderActionType `json:"type"`
   374  }
   375  
   376  // A Reader represents a physical device for accepting payment details.
   377  //
   378  // Related guide: [Connecting to a reader](https://stripe.com/docs/terminal/payments/connect-reader)
   379  type TerminalReader struct {
   380  	APIResource
   381  	// The most recent action performed by the reader.
   382  	Action  *TerminalReaderAction `json:"action"`
   383  	Deleted bool                  `json:"deleted"`
   384  	// The current software version of the reader.
   385  	DeviceSwVersion string `json:"device_sw_version"`
   386  	// Type of reader, one of `bbpos_wisepad3`, `stripe_m2`, `bbpos_chipper2x`, `bbpos_wisepos_e`, `verifone_P400`, `simulated_wisepos_e`, or `mobile_phone_reader`.
   387  	DeviceType TerminalReaderDeviceType `json:"device_type"`
   388  	// Unique identifier for the object.
   389  	ID string `json:"id"`
   390  	// The local IP address of the reader.
   391  	IPAddress string `json:"ip_address"`
   392  	// Custom label given to the reader for easier identification.
   393  	Label string `json:"label"`
   394  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   395  	Livemode bool `json:"livemode"`
   396  	// The location identifier of the reader.
   397  	Location *TerminalLocation `json:"location"`
   398  	// Set of [key-value pairs](https://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.
   399  	Metadata map[string]string `json:"metadata"`
   400  	// String representing the object's type. Objects of the same type share the same value.
   401  	Object string `json:"object"`
   402  	// Serial number of the reader.
   403  	SerialNumber string `json:"serial_number"`
   404  	// The networking status of the reader.
   405  	Status string `json:"status"`
   406  }
   407  
   408  // TerminalReaderList is a list of Readers as retrieved from a list endpoint.
   409  type TerminalReaderList struct {
   410  	APIResource
   411  	ListMeta
   412  	Data []*TerminalReader `json:"data"`
   413  }