Documentation
¶
Index ¶
- type CreateReaderBody
- type CreateReaderCheckoutBody
- type CreateReaderCheckoutBodyAffiliate
- type CreateReaderCheckoutBodyAffiliateTags
- type CreateReaderCheckoutBodyCardType
- type CreateReaderCheckoutBodyTotalAmount
- type CreateReaderCheckoutError
- type CreateReaderCheckoutErrorErrors
- type CreateReaderCheckoutRequest
- type CreateReaderCheckoutRequestAffiliate
- type CreateReaderCheckoutRequestAffiliateTags
- type CreateReaderCheckoutRequestCardType
- type CreateReaderCheckoutRequestTotalAmount
- type CreateReaderCheckoutResponse
- type CreateReaderCheckoutResponseData
- type CreateReaderCheckoutUnprocessableEntity
- type CreateReaderCheckoutUnprocessableEntityErrors
- type CreateReaderTerminateError
- type CreateReaderTerminateErrorErrors
- type CreateReaderTerminateUnprocessableEntity
- type CreateReaderTerminateUnprocessableEntityErrors
- type GetReaderParams
- type ListReaders200Response
- type Reader
- type ReaderDevice
- type ReaderDeviceModel
- type ReaderId
- type ReaderName
- type ReaderPairingCode
- type ReaderStatus
- type ReadersService
- func (s *ReadersService) Create(ctx context.Context, merchantCode string, body CreateReaderBody) (*Reader, error)
- func (s *ReadersService) CreateCheckout(ctx context.Context, merchantCode string, readerId string, ...) (*CreateReaderCheckoutResponse, error)
- func (s *ReadersService) DeleteReader(ctx context.Context, merchantCode string, id ReaderId) error
- func (s *ReadersService) Get(ctx context.Context, merchantCode string, id ReaderId, params GetReaderParams) (*Reader, error)
- func (s *ReadersService) List(ctx context.Context, merchantCode string) (*ListReaders200Response, error)
- func (s *ReadersService) TerminateCheckout(ctx context.Context, merchantCode string, readerId string) error
- func (s *ReadersService) Update(ctx context.Context, merchantCode string, id ReaderId, body UpdateReaderBody) (*Reader, error)
- type UpdateReaderBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateReaderBody ¶
type CreateReaderBody struct {
// A set of key-value pairs that you can attach to an object. This can be useful for storing additional information
// about the object in a structured format.
// **Warning**: Updating Meta will overwrite the existing data. Make sure to always include the complete JSON
// object.
Meta *shared.Meta `json:"meta,omitempty"`
// Custom human-readable, user-defined name for easier identification of the reader.
// Max length: 500
Name ReaderName `json:"name"`
// 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 CreateReaderCheckoutBody ¶
type CreateReaderCheckoutBody struct {
// Affiliate metadata for the transaction.
// It is a field that allow for integrators to track the source of the transaction.
Affiliate *CreateReaderCheckoutBodyAffiliate `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"`
// Time in seconds the cardholder has to select a tip rate.
// If not provided, the default value is 30 seconds.
//
// It can only be set if `tip_rates` is provided.
//
// **Note**: If the target device is a Solo, it must be in version 3.3.38.0 or higher.
// Default: 30
// Min: 30
// Max: 120
TipTimeout *int `json:"tip_timeout,omitempty"`
// Amount structure.
//
// 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 CreateReaderCheckoutBodyTotalAmount `json:"total_amount"`
}
CreateReaderCheckoutBody: Reader Checkout
type CreateReaderCheckoutBodyAffiliate ¶ added in v0.3.0
type CreateReaderCheckoutBodyAffiliate 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.
Key string `json:"key"`
// Additional metadata for the transaction.
// It is key-value object that can be associated with the transaction.
Tags *CreateReaderCheckoutBodyAffiliateTags `json:"tags,omitempty"`
}
CreateReaderCheckoutBodyAffiliate: Affiliate metadata for the transaction. It is a field that allow for integrators to track the source of the transaction.
type CreateReaderCheckoutBodyAffiliateTags ¶ added in v0.3.0
CreateReaderCheckoutBodyAffiliateTags: Additional metadata for the transaction. It is key-value object that can be associated with the transaction.
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 CreateReaderCheckoutBodyTotalAmount ¶ added in v0.3.0
type CreateReaderCheckoutBodyTotalAmount 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.
// Min: 0
MinorUnit int `json:"minor_unit"`
// Integer value of the amount.
// Min: 0
Value int `json:"value"`
}
CreateReaderCheckoutBodyTotalAmount: Amount structure.
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 CreateReaderCheckoutError ¶ added in v0.3.0
type CreateReaderCheckoutError struct {
Errors CreateReaderCheckoutErrorErrors `json:"errors"`
}
CreateReaderCheckoutError: Error description
func (*CreateReaderCheckoutError) Error ¶ added in v0.3.0
func (e *CreateReaderCheckoutError) Error() string
type CreateReaderCheckoutErrorErrors ¶ added in v0.3.0
type CreateReaderCheckoutErrorErrors struct {
// Error message
Detail *string `json:"detail,omitempty"`
}
CreateReaderCheckoutErrorErrors is a schema definition.
type CreateReaderCheckoutRequest ¶ added in v0.3.0
type CreateReaderCheckoutRequest struct {
// Affiliate metadata for the transaction.
// It is a field that allow for integrators to track the source of the transaction.
Affiliate *CreateReaderCheckoutRequestAffiliate `json:"affiliate,omitempty"`
// The card type of the card used for the transaction.
// Is is required only for some countries (e.g: Brazil).
CardType *CreateReaderCheckoutRequestCardType `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"`
// Time in seconds the cardholder has to select a tip rate.
// If not provided, the default value is 30 seconds.
//
// It can only be set if `tip_rates` is provided.
//
// **Note**: If the target device is a Solo, it must be in version 3.3.38.0 or higher.
// Default: 30
// Min: 30
// Max: 120
TipTimeout *int `json:"tip_timeout,omitempty"`
// Amount structure.
//
// 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 CreateReaderCheckoutRequestTotalAmount `json:"total_amount"`
}
CreateReaderCheckoutRequest: Reader Checkout
type CreateReaderCheckoutRequestAffiliate ¶ added in v0.3.0
type CreateReaderCheckoutRequestAffiliate 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.
Key string `json:"key"`
// Additional metadata for the transaction.
// It is key-value object that can be associated with the transaction.
Tags *CreateReaderCheckoutRequestAffiliateTags `json:"tags,omitempty"`
}
CreateReaderCheckoutRequestAffiliate: Affiliate metadata for the transaction. It is a field that allow for integrators to track the source of the transaction.
type CreateReaderCheckoutRequestAffiliateTags ¶ added in v0.3.0
CreateReaderCheckoutRequestAffiliateTags: Additional metadata for the transaction. It is key-value object that can be associated with the transaction.
type CreateReaderCheckoutRequestCardType ¶ added in v0.3.0
type CreateReaderCheckoutRequestCardType string
CreateReaderCheckoutRequestCardType: The card type of the card used for the transaction. Is is required only for some countries (e.g: Brazil).
const ( CreateReaderCheckoutRequestCardTypeCredit CreateReaderCheckoutRequestCardType = "credit" CreateReaderCheckoutRequestCardTypeDebit CreateReaderCheckoutRequestCardType = "debit" )
type CreateReaderCheckoutRequestTotalAmount ¶ added in v0.3.0
type CreateReaderCheckoutRequestTotalAmount 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.
// Min: 0
MinorUnit int `json:"minor_unit"`
// Integer value of the amount.
// Min: 0
Value int `json:"value"`
}
CreateReaderCheckoutRequestTotalAmount: Amount structure.
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 CreateReaderCheckoutResponse ¶ added in v0.3.0
type CreateReaderCheckoutResponse struct {
Data CreateReaderCheckoutResponseData `json:"data"`
}
CreateReaderCheckoutResponse is a schema definition.
type CreateReaderCheckoutResponseData ¶ added in v0.3.0
type CreateReaderCheckoutResponseData 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).
ClientTransactionId string `json:"client_transaction_id"`
}
CreateReaderCheckoutResponseData is a schema definition.
type CreateReaderCheckoutUnprocessableEntity ¶ added in v0.3.0
type CreateReaderCheckoutUnprocessableEntity struct {
Errors CreateReaderCheckoutUnprocessableEntityErrors `json:"errors"`
}
CreateReaderCheckoutUnprocessableEntity: Unprocessable entity
func (*CreateReaderCheckoutUnprocessableEntity) Error ¶ added in v0.3.0
func (e *CreateReaderCheckoutUnprocessableEntity) Error() string
type CreateReaderCheckoutUnprocessableEntityErrors ¶ added in v0.3.0
CreateReaderCheckoutUnprocessableEntityErrors is a schema definition.
type CreateReaderTerminateError ¶ added in v0.3.0
type CreateReaderTerminateError struct {
Errors CreateReaderTerminateErrorErrors `json:"errors"`
}
CreateReaderTerminateError: Error description
func (*CreateReaderTerminateError) Error ¶ added in v0.3.0
func (e *CreateReaderTerminateError) Error() string
type CreateReaderTerminateErrorErrors ¶ added in v0.3.0
type CreateReaderTerminateErrorErrors struct {
// Error message
Detail *string `json:"detail,omitempty"`
}
CreateReaderTerminateErrorErrors is a schema definition.
type CreateReaderTerminateUnprocessableEntity ¶ added in v0.3.0
type CreateReaderTerminateUnprocessableEntity struct {
Errors CreateReaderTerminateUnprocessableEntityErrors `json:"errors"`
}
CreateReaderTerminateUnprocessableEntity: Unprocessable entity
func (*CreateReaderTerminateUnprocessableEntity) Error ¶ added in v0.3.0
func (e *CreateReaderTerminateUnprocessableEntity) Error() string
type CreateReaderTerminateUnprocessableEntityErrors ¶ added in v0.3.0
CreateReaderTerminateUnprocessableEntityErrors 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 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"`
// A set of key-value pairs that you can attach to an object. This can be useful for storing additional information
// about the object in a structured format.
// **Warning**: Updating Meta will overwrite the existing data. Make sure to always include the complete JSON
// object.
Meta *shared.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, readerId string, body CreateReaderCheckoutBody) (*CreateReaderCheckoutResponse, error)
CreateCheckout: Create a Reader Checkout Creates 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 ¶
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, readerId string) error
TerminateCheckout: Terminate a Reader Checkout Terminate a Reader Checkout 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 {
// A set of key-value pairs that you can attach to an object. This can be useful for storing additional information
// about the object in a structured format.
// **Warning**: Updating Meta will overwrite the existing data. Make sure to always include the complete JSON
// object.
Meta *shared.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.