readers

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Affiliate

type Affiliate struct {
	// Application ID of the affiliate.
	// It is a unique identifier for the application and should be set by the integrator in the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) page.
	AppId string `json:"app_id"`
	// Foreign transaction ID of the affiliate.
	// It is a unique identifier for the transaction.
	// It can be used later to fetch the transaction details via the [Transactions API](https://developer.sumup.com/api/transactions/get).
	ForeignTransactionId string `json:"foreign_transaction_id"`
	// Key of the affiliate.
	// It is a unique identifier for the key  and should be generated by the integrator in the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) page.
	//
	// Format: uuid
	Key string `json:"key"`
	// Additional metadata for the transaction.
	// It is key-value object that can be associated with the transaction.
	Tags *AffiliateTags `json:"tags,omitempty"`
}

Affiliate: Affiliate metadata for the transaction. It is an optional field that allow for integrators to track the source of the transaction.

type AffiliateTags

type AffiliateTags map[string]any

AffiliateTags: Additional metadata for the transaction. It is key-value object that can be associated with the transaction.

type CreateReaderBody

type CreateReaderBody struct {
	// Set of user-defined key-value pairs attached to the object.
	// Max properties: 50
	Meta *Meta `json:"meta,omitempty"`
	// Custom human-readable, user-defined name for easier identification of the reader.
	// Max length: 500
	Name *ReaderName `json:"name,omitempty"`
	// The pairing code is a 8 or 9 character alphanumeric string that is displayed on a SumUp Device after initiating
	// the pairing. It is used to link the physical device to the created pairing.
	// Min length: 8
	// Max length: 9
	PairingCode ReaderPairingCode `json:"pairing_code"`
}

CreateReaderBody is a schema definition.

type CreateReaderCheckout

type CreateReaderCheckout struct {
	// Affiliate metadata for the transaction.
	// It is an optional field that allow for integrators to track the source of the transaction.
	Affiliate *Affiliate `json:"affiliate,omitempty"`
	// The card type of the card used for the transaction.
	// Is is required only for some countries (e.g: Brazil).
	CardType *CreateReaderCheckoutCardType `json:"card_type,omitempty"`
	// Description of the checkout to be shown in the Merchant Sales
	Description *string `json:"description,omitempty"`
	// Number of installments for the transaction.
	// It may vary according to the merchant country.
	// For example, in Brazil, the maximum number of installments is 12.
	Installments *int `json:"installments,omitempty"`
	// Webhook URL to which the payment result will be sent.
	// It must be a HTTPS url.
	// Format: uri
	ReturnUrl *string `json:"return_url,omitempty"`
	// List of tipping rates to be displayed to the cardholder.
	// The rates are in percentage and should be between 0.01 and 0.99.
	// The list should be sorted in ascending order.
	TipRates *[]float64 `json:"tip_rates,omitempty"`
	// Amount of the transaction.
	// The amount is represented as an integer value altogether with the currency and the minor unit.
	// For example, EUR 1.00 is represented as value 100 with minor unit of 2.
	TotalAmount CreateReaderCheckoutAmount `json:"total_amount"`
}

CreateReaderCheckout: Reader Checkout

type CreateReaderCheckout201Response

type CreateReaderCheckout201Response struct {
	Data *CreateReaderCheckout201ResponseData `json:"data,omitempty"`
}

CreateReaderCheckout201Response is a schema definition.

type CreateReaderCheckout201ResponseData

type CreateReaderCheckout201ResponseData struct {
	// The client transaction ID is a unique identifier for the transaction that is generated for the client.
	// It can be used later to fetch the transaction details via the [Transactions API](https://developer.sumup.com/api/transactions/get).
	// Format: uuid
	ClientTransactionId *string `json:"client_transaction_id,omitempty"`
}

CreateReaderCheckout201ResponseData is a schema definition.

type CreateReaderCheckout400Response

type CreateReaderCheckout400Response struct {
	Errors *CreateReaderCheckout400ResponseErrors `json:"errors,omitempty"`
}

CreateReaderCheckout400Response is a schema definition.

func (*CreateReaderCheckout400Response) Error

type CreateReaderCheckout400ResponseErrors

type CreateReaderCheckout400ResponseErrors struct {
	Detail *string `json:"detail,omitempty"`
}

CreateReaderCheckout400ResponseErrors is a schema definition.

type CreateReaderCheckout422Response

type CreateReaderCheckout422Response struct {
	Errors *CreateReaderCheckout422ResponseErrors `json:"errors,omitempty"`
}

CreateReaderCheckout422Response is a schema definition.

func (*CreateReaderCheckout422Response) Error

type CreateReaderCheckout422ResponseErrors

type CreateReaderCheckout422ResponseErrors map[string]any

CreateReaderCheckout422ResponseErrors is a schema definition.

type CreateReaderCheckout500Response

type CreateReaderCheckout500Response struct {
	Errors *CreateReaderCheckout500ResponseErrors `json:"errors,omitempty"`
}

CreateReaderCheckout500Response is a schema definition.

func (*CreateReaderCheckout500Response) Error

type CreateReaderCheckout500ResponseErrors

type CreateReaderCheckout500ResponseErrors struct {
	Detail *string `json:"detail,omitempty"`
}

CreateReaderCheckout500ResponseErrors is a schema definition.

type CreateReaderCheckout502Response

type CreateReaderCheckout502Response struct {
	Errors *CreateReaderCheckout502ResponseErrors `json:"errors,omitempty"`
}

CreateReaderCheckout502Response is a schema definition.

func (*CreateReaderCheckout502Response) Error

type CreateReaderCheckout502ResponseErrors

type CreateReaderCheckout502ResponseErrors struct {
	Detail *string `json:"detail,omitempty"`
}

CreateReaderCheckout502ResponseErrors is a schema definition.

type CreateReaderCheckout504Response

type CreateReaderCheckout504Response struct {
	Errors *CreateReaderCheckout504ResponseErrors `json:"errors,omitempty"`
}

CreateReaderCheckout504Response is a schema definition.

func (*CreateReaderCheckout504Response) Error

type CreateReaderCheckout504ResponseErrors

type CreateReaderCheckout504ResponseErrors struct {
	Detail *string `json:"detail,omitempty"`
}

CreateReaderCheckout504ResponseErrors is a schema definition.

type CreateReaderCheckoutAmount

type CreateReaderCheckoutAmount struct {
	// Currency ISO 4217 code
	Currency string `json:"currency"`
	// The minor units of the currency. It represents the number of decimals of the currency.
	// For the currencies CLP, COP and HUF, the minor unit is 0.
	MinorUnit int `json:"minor_unit"`
	// Total amount of the transaction.
	// It must be a positive integer.
	Value int `json:"value"`
}

CreateReaderCheckoutAmount: Amount of the transaction. The amount is represented as an integer value altogether with the currency and the minor unit. For example, EUR 1.00 is represented as value 100 with minor unit of 2.

type CreateReaderCheckoutBody

type CreateReaderCheckoutBody struct {
	// Affiliate metadata for the transaction.
	// It is an optional field that allow for integrators to track the source of the transaction.
	Affiliate *Affiliate `json:"affiliate,omitempty"`
	// The card type of the card used for the transaction.
	// Is is required only for some countries (e.g: Brazil).
	CardType *CreateReaderCheckoutBodyCardType `json:"card_type,omitempty"`
	// Description of the checkout to be shown in the Merchant Sales
	Description *string `json:"description,omitempty"`
	// Number of installments for the transaction.
	// It may vary according to the merchant country.
	// For example, in Brazil, the maximum number of installments is 12.
	Installments *int `json:"installments,omitempty"`
	// Webhook URL to which the payment result will be sent.
	// It must be a HTTPS url.
	// Format: uri
	ReturnUrl *string `json:"return_url,omitempty"`
	// List of tipping rates to be displayed to the cardholder.
	// The rates are in percentage and should be between 0.01 and 0.99.
	// The list should be sorted in ascending order.
	TipRates *[]float64 `json:"tip_rates,omitempty"`
	// Amount of the transaction.
	// The amount is represented as an integer value altogether with the currency and the minor unit.
	// For example, EUR 1.00 is represented as value 100 with minor unit of 2.
	TotalAmount CreateReaderCheckoutAmount `json:"total_amount"`
}

CreateReaderCheckoutBody: Reader Checkout

type CreateReaderCheckoutBodyCardType

type CreateReaderCheckoutBodyCardType string

CreateReaderCheckoutBodyCardType: The card type of the card used for the transaction. Is is required only for some countries (e.g: Brazil).

const (
	CreateReaderCheckoutBodyCardTypeCredit CreateReaderCheckoutBodyCardType = "credit"
	CreateReaderCheckoutBodyCardTypeDebit  CreateReaderCheckoutBodyCardType = "debit"
)

type CreateReaderCheckoutCardType

type CreateReaderCheckoutCardType string

CreateReaderCheckoutCardType: The card type of the card used for the transaction. Is is required only for some countries (e.g: Brazil).

const (
	CreateReaderCheckoutCardTypeCredit CreateReaderCheckoutCardType = "credit"
	CreateReaderCheckoutCardTypeDebit  CreateReaderCheckoutCardType = "debit"
)

type CreateReaderTerminate422Response

type CreateReaderTerminate422Response struct {
	Errors *CreateReaderTerminate422ResponseErrors `json:"errors,omitempty"`
}

CreateReaderTerminate422Response is a schema definition.

func (*CreateReaderTerminate422Response) Error

type CreateReaderTerminate422ResponseErrors

type CreateReaderTerminate422ResponseErrors map[string]any

CreateReaderTerminate422ResponseErrors is a schema definition.

type CreateReaderTerminate500Response

type CreateReaderTerminate500Response struct {
	Errors *CreateReaderTerminate500ResponseErrors `json:"errors,omitempty"`
}

CreateReaderTerminate500Response is a schema definition.

func (*CreateReaderTerminate500Response) Error

type CreateReaderTerminate500ResponseErrors

type CreateReaderTerminate500ResponseErrors struct {
	Detail *string `json:"detail,omitempty"`
}

CreateReaderTerminate500ResponseErrors is a schema definition.

type CreateReaderTerminate502Response

type CreateReaderTerminate502Response struct {
	Errors *CreateReaderTerminate502ResponseErrors `json:"errors,omitempty"`
}

CreateReaderTerminate502Response is a schema definition.

func (*CreateReaderTerminate502Response) Error

type CreateReaderTerminate502ResponseErrors

type CreateReaderTerminate502ResponseErrors struct {
	Detail *string `json:"detail,omitempty"`
}

CreateReaderTerminate502ResponseErrors is a schema definition.

type CreateReaderTerminate504Response

type CreateReaderTerminate504Response struct {
	Errors *CreateReaderTerminate504ResponseErrors `json:"errors,omitempty"`
}

CreateReaderTerminate504Response is a schema definition.

func (*CreateReaderTerminate504Response) Error

type CreateReaderTerminate504ResponseErrors

type CreateReaderTerminate504ResponseErrors struct {
	Detail *string `json:"detail,omitempty"`
}

CreateReaderTerminate504ResponseErrors is a schema definition.

type GetReaderParams

type GetReaderParams struct {
	// Return the reader only if it has been modified after the specified timestamp given in the headers.
	//
	// Timestamps are accepted in the following formats:
	//
	//  - HTTP Standard: [IMF format (RFC 5322)](https://www.rfc-editor.org/rfc/rfc5322#section-3.3), sometimes also
	// referred to as [RFC 7231](https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1).
	//  - RFC 3339: Used for timestamps in JSON payloads on this API.
	IfModifiedSince *string
}

GetReaderParams: query parameters for GetReader

func (*GetReaderParams) QueryValues

func (p *GetReaderParams) QueryValues() url.Values

QueryValues converts GetReaderParams into url.Values.

type ListReaders200Response

type ListReaders200Response struct {
	Items []Reader `json:"items"`
}

ListReaders200Response is a schema definition.

type Meta

type Meta map[string]any

Meta: Set of user-defined key-value pairs attached to the object. Max properties: 50

type Reader

type Reader struct {
	// The timestamp of when the reader was created.
	CreatedAt time.Time `json:"created_at"`
	// Information about the underlying physical device.
	Device ReaderDevice `json:"device"`
	// Unique identifier of the object.
	// Note that this identifies the instance of the physical devices pairing with your SumUp account.
	// If you DELETE a reader, and pair the device again, the ID will be different. Do not use this ID to refer to
	// a physical device.
	// Min length: 30
	// Max length: 30
	Id ReaderId `json:"id"`
	// Set of user-defined key-value pairs attached to the object.
	// Max properties: 50
	Meta *Meta `json:"meta,omitempty"`
	// Custom human-readable, user-defined name for easier identification of the reader.
	// Max length: 500
	Name ReaderName `json:"name"`
	// The status of the reader object gives information about the current state of the reader.
	//
	// Possible values:
	//
	// - `unknown` - The reader status is unknown.
	// - `processing` - The reader is created and waits for the physical device to confirm the pairing.
	// - `paired` - The reader is paired with a merchant account and can be used with SumUp APIs.
	// - `expired` - The pairing is expired and no longer usable with the account. The resource needs to get recreated
	Status ReaderStatus `json:"status"`
	// The timestamp of when the reader was last updated.
	UpdatedAt time.Time `json:"updated_at"`
}

Reader: A physical card reader device that can accept in-person payments.

type ReaderDevice

type ReaderDevice struct {
	// A unique identifier of the physical device (e.g. serial number).
	Identifier string `json:"identifier"`
	// Identifier of the model of the device.
	Model ReaderDeviceModel `json:"model"`
}

ReaderDevice: Information about the underlying physical device.

type ReaderDeviceModel

type ReaderDeviceModel string

ReaderDeviceModel: Identifier of the model of the device.

const (
	ReaderDeviceModelSolo        ReaderDeviceModel = "solo"
	ReaderDeviceModelVirtualSolo ReaderDeviceModel = "virtual-solo"
)

type ReaderId

type ReaderId string

ReaderId: Unique identifier of the object. Note that this identifies the instance of the physical devices pairing with your SumUp account. If you DELETE a reader, and pair the device again, the ID will be different. Do not use this ID to refer to a physical device. Min length: 30 Max length: 30

type ReaderName

type ReaderName string

ReaderName: Custom human-readable, user-defined name for easier identification of the reader. Max length: 500

type ReaderPairingCode

type ReaderPairingCode string

ReaderPairingCode: The pairing code is a 8 or 9 character alphanumeric string that is displayed on a SumUp Device after initiating the pairing. It is used to link the physical device to the created pairing. Min length: 8 Max length: 9

type ReaderStatus

type ReaderStatus string

ReaderStatus: The status of the reader object gives information about the current state of the reader.

Possible values:

- `unknown` - The reader status is unknown. - `processing` - The reader is created and waits for the physical device to confirm the pairing. - `paired` - The reader is paired with a merchant account and can be used with SumUp APIs. - `expired` - The pairing is expired and no longer usable with the account. The resource needs to get recreated

const (
	ReaderStatusExpired    ReaderStatus = "expired"
	ReaderStatusPaired     ReaderStatus = "paired"
	ReaderStatusProcessing ReaderStatus = "processing"
	ReaderStatusUnknown    ReaderStatus = "unknown"
)

type ReadersService

type ReadersService struct {
	// contains filtered or unexported fields
}

func NewReadersService

func NewReadersService(c *client.Client) *ReadersService

func (*ReadersService) Create

func (s *ReadersService) Create(ctx context.Context, merchantCode string, body CreateReaderBody) (*Reader, error)

Create: Create a Reader Create a new Reader for the merchant account.

func (*ReadersService) CreateCheckout

func (s *ReadersService) CreateCheckout(ctx context.Context, merchantCode string, id string, body CreateReaderCheckoutBody) (*CreateReaderCheckout201Response, error)

CreateCheckout: Create a Reader Checkout Create a Checkout for a Reader.

This process is asynchronous and the actual transaction may take some time to be stared on the device.

There are some caveats when using this endpoint: * The target device must be online, otherwise checkout won't be accepted * After the checkout is accepted, the system has 60 seconds to start the payment on the target device. During this time, any other checkout for the same device will be rejected.

**Note**: If the target device is a Solo, it must be in version 3.3.24.3 or higher.

func (*ReadersService) DeleteReader

func (s *ReadersService) DeleteReader(ctx context.Context, merchantCode string, id ReaderId) error

DeleteReader: Delete a reader Delete a reader.

func (*ReadersService) Get

func (s *ReadersService) Get(ctx context.Context, merchantCode string, id ReaderId, params GetReaderParams) (*Reader, error)

Get: Retrieve a Reader Retrieve a Reader.

func (*ReadersService) List

func (s *ReadersService) List(ctx context.Context, merchantCode string) (*ListReaders200Response, error)

List: List Readers List all readers of the merchant.

func (*ReadersService) TerminateCheckout

func (s *ReadersService) TerminateCheckout(ctx context.Context, merchantCode string, id string) error

TerminateCheckout: Create a Reader Terminate action Create a Terminate action for a Reader.

It stops the current transaction on the target device.

This process is asynchronous and the actual termination may take some time to be performed on the device.

There are some caveats when using this endpoint: * The target device must be online, otherwise terminate won't be accepted * The action will succeed only if the device is waiting for cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of the termination.

If a transaction is successfully terminated and `return_url` was provided on Checkout, the transaction status will be sent as `failed` to the provided URL.

**Note**: If the target device is a Solo, it must be in version 3.3.28.0 or higher.

func (*ReadersService) Update

func (s *ReadersService) Update(ctx context.Context, merchantCode string, id ReaderId, body UpdateReaderBody) (*Reader, error)

Update: Update a Reader Update a Reader.

type UpdateReaderBody

type UpdateReaderBody struct {
	// Set of user-defined key-value pairs attached to the object.
	// Max properties: 50
	Meta *Meta `json:"meta,omitempty"`
	// Custom human-readable, user-defined name for easier identification of the reader.
	// Max length: 500
	Name *ReaderName `json:"name,omitempty"`
}

UpdateReaderBody is a schema definition.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL