Documentation
¶
Index ¶
- Constants
- Variables
- func VerifyEventSignature(secret string, payload []byte, signature string) error
- type APIError
- type Address
- type AddressLegacy
- type Affiliate
- type Amount
- type Attributes
- type BadRequest
- type BadRequestErrors
- type BadRequestErrorsType
- type BasePerson
- type Brand
- type Branding
- type BusinessProfile
- type Card
- type CardResponse
- type CardType
- type CategoryV10
- type ChangeStatus
- type Checkout
- type CheckoutAccepted
- type CheckoutAcceptedNextStep
- type CheckoutAcceptedNextStepMechanism
- type CheckoutAcceptedNextStepPayload
- type CheckoutCreateRequest
- type CheckoutCreateRequestPurpose
- type CheckoutCreatedEvent
- type CheckoutExpiredEvent
- type CheckoutFailedEvent
- type CheckoutPaidEvent
- type CheckoutStatus
- type CheckoutSuccess
- type CheckoutSuccessPaymentInstrument
- type CheckoutSuccessStatus
- type CheckoutSuccessTransaction
- type CheckoutTransaction
- type CheckoutUpdateRequest
- type CheckoutUpdatedEvent
- type CheckoutsClient
- func (c *CheckoutsClient) Create(ctx context.Context, body CheckoutsCreateParams) (*Checkout, error)
- func (c *CheckoutsClient) CreateApplePaySession(ctx context.Context, checkoutID string, ...) (*CheckoutsCreateApplePaySessionResponse, error)
- func (c *CheckoutsClient) Deactivate(ctx context.Context, checkoutID string) (*Checkout, error)
- func (c *CheckoutsClient) Get(ctx context.Context, checkoutID string) (*CheckoutSuccess, error)
- func (c *CheckoutsClient) List(ctx context.Context, params CheckoutsListParams) (*CheckoutsListResponse, error)
- func (c *CheckoutsClient) ListAvailablePaymentMethods(ctx context.Context, merchantCode string, ...) (*CheckoutsListAvailablePaymentMethodsResponse, error)
- func (c *CheckoutsClient) Process(ctx context.Context, checkoutID string, body CheckoutsProcessParams) (*CheckoutsProcessResponse, error)
- func (c *CheckoutsClient) Update(ctx context.Context, checkoutID string, body CheckoutsUpdateParams) (*Checkout, error)
- type CheckoutsCreateApplePaySession400Response
- type CheckoutsCreateApplePaySessionParams
- type CheckoutsCreateApplePaySessionResponse
- type CheckoutsCreateParams
- type CheckoutsListAvailablePaymentMethodsParams
- type CheckoutsListAvailablePaymentMethodsResponse
- type CheckoutsListAvailablePaymentMethodsResponseAvailablePaymentMethod
- type CheckoutsListParams
- type CheckoutsListResponse
- type CheckoutsProcess400Response
- type CheckoutsProcessCheckoutSuccessResponse
- type CheckoutsProcessCheckoutSuccessResponsePaymentInstrument
- type CheckoutsProcessCheckoutSuccessResponseStatus
- type CheckoutsProcessCheckoutSuccessResponseTransaction
- type CheckoutsProcessParams
- type CheckoutsProcessResponse
- type CheckoutsUpdateParams
- type ClassicMerchantIdentifiers
- type Client
- func (c *Client) EventsHandler(secret string, fallback EventCallback) (*EventsHandler, error)
- func (c *Client) ParseEventNotification(secret string, payload []byte, signature string) (EventNotification, error)
- func (c *Client) ParseEventNotificationWithoutVerification(payload []byte) (EventNotification, error)
- type Company
- type CompanyIdentifier
- type CompanyIdentifiers
- type CountryCode
- type CreateCheckoutRequest
- type CreateCheckoutRequestAADE
- type CreateCheckoutRequestAffiliate
- type CreateCheckoutRequestAffiliateTags
- type CreateCheckoutRequestCardType
- type CreateCheckoutRequestPaymentType
- type CreateCheckoutRequestTotalAmount
- type CreateReaderCheckoutError
- type CreateReaderCheckoutErrorErrors
- type CreateReaderCheckoutResponse
- type CreateReaderCheckoutResponseData
- type CreateReaderCheckoutUnprocessableEntity
- type CreateReaderCheckoutUnprocessableEntityErrors
- type CreateReaderTerminateError
- type CreateReaderTerminateErrorErrors
- type CreateReaderTerminateUnprocessableEntity
- type CreateReaderTerminateUnprocessableEntityErrors
- type Currency
- type Customer
- type CustomerValidationError
- type CustomersClient
- func (c *CustomersClient) Create(ctx context.Context, body CustomersCreateParams) (*Customer, error)
- func (c *CustomersClient) DeactivatePaymentInstrument(ctx context.Context, customerID string, token string) error
- func (c *CustomersClient) Get(ctx context.Context, customerID string) (*Customer, error)
- func (c *CustomersClient) ListPaymentInstruments(ctx context.Context, customerID string) (*CustomersListPaymentInstrumentsResponse, error)
- func (c *CustomersClient) Update(ctx context.Context, customerID string, body CustomersUpdateParams) (*Customer, error)
- type CustomersCreate400Response
- type CustomersCreateParams
- type CustomersListPaymentInstrumentsResponse
- type CustomersUpdateParams
- type DetailsError
- type DetailsErrorFailedConstraint
- type Device
- type DiscountApplicationMode
- type DiscountClas
- type DiscountLevel
- type DiscountLine
- type DiscountSource
- type DiscountSourceAdHoc
- type DiscountSourceBasic
- type DiscountSourceCoupon
- type DiscountSourceLoyalty
- type DiscountSourceLoyaltySchemeType
- type DiscountSourceLoyaltyType
- type DiscountSourceOffer
- type DiscountValue
- type ElvCardAccount
- type EntryMode
- type Error
- type ErrorExtended
- type ErrorForbidden
- type Event
- type EventCallback
- type EventCallbackError
- type EventNotification
- type EventObject
- type EventsHandler
- func (h *EventsHandler) GoString() string
- func (h *EventsHandler) Handle(ctx context.Context, payload []byte, signature string) error
- func (h *EventsHandler) OnCheckoutCreated(callback func(context.Context, *CheckoutCreatedEvent) error) error
- func (h *EventsHandler) OnCheckoutExpired(callback func(context.Context, *CheckoutExpiredEvent) error) error
- func (h *EventsHandler) OnCheckoutFailed(callback func(context.Context, *CheckoutFailedEvent) error) error
- func (h *EventsHandler) OnCheckoutPaid(callback func(context.Context, *CheckoutPaidEvent) error) error
- func (h *EventsHandler) OnCheckoutUpdated(callback func(context.Context, *CheckoutUpdatedEvent) error) error
- func (h *EventsHandler) OnMemberCreated(callback func(context.Context, *MemberCreatedEvent) error) error
- func (h *EventsHandler) OnMemberDeleted(callback func(context.Context, *MemberDeletedEvent) error) error
- func (h *EventsHandler) OnMemberUpdated(callback func(context.Context, *MemberUpdatedEvent) error) error
- func (h *EventsHandler) OnReaderCreated(callback func(context.Context, *ReaderCreatedEvent) error) error
- func (h *EventsHandler) OnReaderDeleted(callback func(context.Context, *ReaderDeletedEvent) error) error
- func (h *EventsHandler) OnRoleCreated(callback func(context.Context, *RoleCreatedEvent) error) error
- func (h *EventsHandler) OnRoleDeleted(callback func(context.Context, *RoleDeletedEvent) error) error
- func (h *EventsHandler) OnRoleUpdated(callback func(context.Context, *RoleUpdatedEvent) error) error
- func (h *EventsHandler) Parse(payload []byte, signature string) (EventNotification, error)
- func (h *EventsHandler) String() string
- type FeatureV10
- type FeatureValueTypeV10
- type FinalPriceAmounts
- type FinancialPayout
- type FinancialPayoutStatus
- type FinancialPayoutType
- type FinancialPayouts
- type GetReaderCheckoutResponse
- type GetReaderCheckoutResponseData
- type GetReaderCheckoutResponseDataCardType
- type GetReaderCheckoutResponseDataPaymentType
- type GetReaderCheckoutResponseDataStatus
- type GetReaderCheckoutResponseDataTotalAmount
- type GetReaderSettingsResponse
- type GetReaderSettingsResponseData
- type GetReaderSettingsResponseDataMenuLock
- type HorizontalAccuracy
- type HostedCheckout
- type Invite
- type ItemReferencesV10
- type ItemReferencesV10CatalogSource
- type ItemTypeV10
- type Lat
- type LegalType
- type LineItemPriceV10
- type LineItemPriceV10TotalGrossAmount
- type LineItemPriceV10TotalGrossAmountFinal
- type LineItemPriceV10TotalNetAmount
- type LineItemPriceV10TotalNetAmountFinal
- type Link
- type ListPersonsResponseBody
- type Lon
- type MandatePayload
- type MandatePayloadType
- type MandateResponse
- type MandateResponseStatus
- type Member
- type MemberCreatedEvent
- type MemberDeletedEvent
- type MemberUpdatedEvent
- type MembersClient
- func (c *MembersClient) Create(ctx context.Context, merchantCode string, body MembersCreateParams) (*Member, error)
- func (c *MembersClient) Delete(ctx context.Context, merchantCode string, memberID string) error
- func (c *MembersClient) Get(ctx context.Context, merchantCode string, memberID string) (*Member, error)
- func (c *MembersClient) List(ctx context.Context, merchantCode string, params MembersListParams) (*MembersListResponse, error)
- func (c *MembersClient) Update(ctx context.Context, merchantCode string, memberID string, ...) (*Member, error)
- type MembersCreateParams
- type MembersListParams
- type MembersListResponse
- type MembersUpdateParams
- type MembersUpdateParamsUser
- type Membership
- type MembershipResource
- type MembershipStatus
- type MembershipUser
- type MembershipUserClassic
- type MembershipsClient
- type MembershipsListParams
- type MembershipsListResponse
- type Merchant
- type MerchantsClient
- func (c *MerchantsClient) Get(ctx context.Context, merchantCode string) (*Merchant, error)
- func (c *MerchantsClient) GetPerson(ctx context.Context, merchantCode string, personID string) (*Person, error)
- func (c *MerchantsClient) ListPersons(ctx context.Context, merchantCode string) (*ListPersonsResponseBody, error)
- type Meta
- type Metadata
- type ModifierItem
- type ModifierSet
- type NotFound
- type NotFoundErrors
- type Operator
- type OperatorAccountType
- type Ownership
- type PaymentInstrumentResponse
- type PaymentInstrumentResponseCard
- type PaymentInstrumentResponseType
- type PaymentStatusFilterV10
- type PaymentType
- type PayoutsClient
- type PayoutsList400Response
- type PayoutsListFormat
- type PayoutsListOrder
- type PayoutsListParams
- type Permissions
- type Person
- type PersonalDetails
- type PersonalIdentifier
- type PersonalIdentifiers
- type PhoneNumber
- type PositiveAmount
- type PositivePriceAmounts
- type PositivePriceAmountsTotalGrossAmount
- type PositivePriceAmountsTotalNetAmount
- type PositivePriceWithTaxes
- type PositiveTaxLine
- type PositiveTaxLineGrossAmount
- type PositiveTaxLineNetAmount
- type PositiveTaxLineTaxAmount
- type PriceAmounts
- type PriceAmountsTotalGrossAmount
- type PriceAmountsTotalNetAmount
- type Problem
- type ProblemV10
- type ProcessCheckout
- type ProcessCheckoutPaymentType
- type Product
- type PublicApmType
- type PublicCardV10
- type PublicCardV10Type
- type PublicGiftCardPayment
- type PublicPaymentMethod
- type PublicPaymentV10
- type PublicPaymentV10Status
- type Quantity
- type Reader
- type ReaderCreatedEvent
- type ReaderDeletedEvent
- type ReaderDevice
- type ReaderDeviceModel
- type ReaderID
- type ReaderName
- type ReaderPairingCode
- type ReaderPaymentRequestParams
- type ReaderPaymentRequestParamsAffiliate
- type ReaderPaymentRequestParamsTotalAmount
- type ReaderPaymentResponse
- type ReaderPaymentResponseData
- type ReaderStatus
- type ReadersClient
- func (c *ReadersClient) Create(ctx context.Context, merchantCode string, body ReadersCreateParams) (*Reader, error)
- func (c *ReadersClient) CreateCheckout(ctx context.Context, merchantCode string, readerID string, ...) (*CreateReaderCheckoutResponse, error)
- func (c *ReadersClient) CreateGoCheckout(ctx context.Context, merchantCode string, readerID ReaderID, ...) (*ReaderPaymentResponse, error)
- func (c *ReadersClient) Delete(ctx context.Context, merchantCode string, readerID ReaderID) error
- func (c *ReadersClient) Get(ctx context.Context, merchantCode string, readerID ReaderID, ...) (*Reader, error)
- func (c *ReadersClient) GetCheckout(ctx context.Context, merchantCode string, readerID string, checkoutID string) (*GetReaderCheckoutResponse, error)
- func (c *ReadersClient) GetReaderSettings(ctx context.Context, merchantCode string, readerID string) (*GetReaderSettingsResponse, error)
- func (c *ReadersClient) GetStatus(ctx context.Context, merchantCode string, readerID string) (*StatusResponse, error)
- func (c *ReadersClient) List(ctx context.Context, merchantCode string) (*ReadersListResponse, error)
- func (c *ReadersClient) TerminateCheckout(ctx context.Context, merchantCode string, readerID string) error
- func (c *ReadersClient) Update(ctx context.Context, merchantCode string, readerID ReaderID, ...) (*Reader, error)
- func (c *ReadersClient) UpdateReaderSettings(ctx context.Context, merchantCode string, readerID string, ...) (*UpdateReaderSettingsResponse, error)
- type ReadersCreateCheckoutParams
- type ReadersCreateGoCheckoutParams
- type ReadersCreateParams
- type ReadersGetParams
- type ReadersListResponse
- type ReadersUpdateParams
- type ReadersUpdateReaderSettingsParams
- type Receipt
- type ReceiptAcquirerData
- type ReceiptCard
- type ReceiptEvent
- type ReceiptMerchantData
- type ReceiptMerchantDataMerchantProfile
- type ReceiptMerchantDataMerchantProfileAddress
- type ReceiptReader
- type ReceiptTransaction
- type ReceiptTransactionProcessA
- type ReceiptTransactionProduct
- type ReceiptTransactionVATRate
- type ReceiptsClient
- type ReceiptsGetParams
- type Reference
- type ResourceType
- type Role
- type RoleCreatedEvent
- type RoleDeletedEvent
- type RoleUpdatedEvent
- type RolesClient
- func (c *RolesClient) Create(ctx context.Context, merchantCode string, body RolesCreateParams) (*Role, error)
- func (c *RolesClient) Delete(ctx context.Context, merchantCode string, roleID string) error
- func (c *RolesClient) Get(ctx context.Context, merchantCode string, roleID string) (*Role, error)
- func (c *RolesClient) List(ctx context.Context, merchantCode string) (*RolesListResponse, error)
- func (c *RolesClient) Update(ctx context.Context, merchantCode string, roleID string, ...) (*Role, error)
- type RolesCreateParams
- type RolesListResponse
- type RolesUpdateParams
- type Sale
- type SaleLineItemV10
- type SaleLineItemV10ServiceType
- type SalePage
- type SalePriceV10
- type SalePriceV10GrossAmount
- type SalePriceV10NetAmount
- type SaleSearchItem
- type SaleSearchItemTotalAmount
- type SaleSearchRequest
- type SaleSearchResponse
- type SaleSource
- type SaleStateV10
- type SalesChannel
- type SalesChannelFilterV10
- type SalesClient
- func (c *SalesClient) GetSaleV10(ctx context.Context, merchantCode string, saleID string) (*Sale, error)
- func (c *SalesClient) ListSalesV10(ctx context.Context, merchantCode string, params SalesListSalesV10Params) (*SalePage, error)
- func (c *SalesClient) SearchSalesV10(ctx context.Context, merchantCode string, body SalesSearchSalesV10Params) (*SaleSearchResponse, error)
- type SalesListSalesV10Params
- type SalesSearchSalesV10Params
- type StatusResponse
- type StatusResponseData
- type StatusResponseDataConnectionType
- type StatusResponseDataState
- type StatusResponseDataStatus
- type SubaccountsClient
- func (c *SubaccountsClient) CompatGetOperator(ctx context.Context, operatorID int32) (*Operator, error)
- func (c *SubaccountsClient) CreateSubAccount(ctx context.Context, body SubaccountsCreateSubAccountParams) (*Operator, error)
- func (c *SubaccountsClient) ListSubAccounts(ctx context.Context, params SubaccountsListSubAccountsParams) (*SubaccountsListSubAccountsResponse, error)
- func (c *SubaccountsClient) UpdateSubAccount(ctx context.Context, operatorID int32, body SubaccountsUpdateSubAccountParams) (*Operator, error)
- type SubaccountsCreateSubAccountParams
- type SubaccountsCreateSubAccountParamsPermissions
- type SubaccountsListSubAccountsParams
- type SubaccountsListSubAccountsResponse
- type SubaccountsUpdateSubAccountParams
- type SubaccountsUpdateSubAccountParamsPermissions
- type TaxLine
- type TaxLineGrossAmount
- type TaxLineNetAmount
- type TaxLineTaxAmount
- type TaxMode
- type TaxRate
- type Timestamps
- type Token
- type TokenTokenType
- type TokensClient
- type TokensCreateParams
- type TokensCreateParamsAction
- type TransactionBase
- type TransactionCheckoutInfo
- type TransactionEvent
- type TransactionEventID
- type TransactionEventStatus
- type TransactionEventType
- type TransactionFull
- type TransactionFullLocation
- type TransactionFullPayoutPlan
- type TransactionFullPayoutType
- type TransactionFullProcessA
- type TransactionFullSimplePaymentType
- type TransactionFullSimpleStatus
- type TransactionFullVATRate
- type TransactionFullVerificationMethod
- type TransactionHistory
- type TransactionHistoryPayoutPlan
- type TransactionHistoryPayoutType
- type TransactionHistoryType
- type TransactionID
- type TransactionMixinHistory
- type TransactionMixinHistoryPayoutPlan
- type TransactionStatus
- type TransactionsClient
- func (c *TransactionsClient) Get(ctx context.Context, merchantCode string, params TransactionsGetParams) (*TransactionFull, error)
- func (c *TransactionsClient) List(ctx context.Context, merchantCode string, params TransactionsListParams) (*TransactionsListResponse, error)
- func (c *TransactionsClient) Refund(ctx context.Context, merchantCode string, transactionID string, ...) (*TransactionsRefundResponse, error)
- type TransactionsGetParams
- type TransactionsHistoryLink
- type TransactionsListOrder
- type TransactionsListParams
- type TransactionsListResponse
- type TransactionsListStatusesItem
- type TransactionsListTypesItem
- type TransactionsRefundParams
- type TransactionsRefundResponse
- type TypedEvent
- type Unauthorized
- type UnauthorizedErrors
- type UnauthorizedErrorsType
- type UnitOfMeasure
- type UnknownEvent
- type UpdateReaderSettingsError
- type UpdateReaderSettingsErrorErrors
- type UpdateReaderSettingsRequest
- type UpdateReaderSettingsRequestMenuLock
- type UpdateReaderSettingsResponse
- type UpdateReaderSettingsResponseData
- type UpdateReaderSettingsResponseDataMenuLock
- type UpdateReaderSettingsResponseDataStatus
- type UpdateReaderSettingsUnprocessableEntity
- type UpdateReaderSettingsUnprocessableEntityErrors
- type UserType
- type Version
Examples ¶
Constants ¶
const ( // EventSignatureHeader carries t=<unix timestamp>,v1=<hex HMAC>. EventSignatureHeader = "X-SumUp-Webhook-Signature" // EventSignatureVersion is the accepted signature scheme. EventSignatureVersion = "v1" )
const EventTypeCheckoutCreated = "checkouts.created"
EventTypeCheckoutCreated identifies a checkouts.created notification.
const EventTypeCheckoutExpired = "checkouts.expired"
EventTypeCheckoutExpired identifies a checkouts.expired notification.
const EventTypeCheckoutFailed = "checkouts.failed"
EventTypeCheckoutFailed identifies a checkouts.failed notification.
const EventTypeCheckoutPaid = "checkouts.paid"
EventTypeCheckoutPaid identifies a checkouts.paid notification.
const EventTypeCheckoutUpdated = "checkouts.updated"
EventTypeCheckoutUpdated identifies a checkouts.updated notification.
const EventTypeMemberCreated = "members.created"
EventTypeMemberCreated identifies a members.created notification.
const EventTypeMemberDeleted = "members.deleted"
EventTypeMemberDeleted identifies a members.deleted notification.
const EventTypeMemberUpdated = "members.updated"
EventTypeMemberUpdated identifies a members.updated notification.
const EventTypeReaderCreated = "readers.created"
EventTypeReaderCreated identifies a readers.created notification.
const EventTypeReaderDeleted = "readers.deleted"
EventTypeReaderDeleted identifies a readers.deleted notification.
const EventTypeRoleCreated = "roles.created"
EventTypeRoleCreated identifies a roles.created notification.
const EventTypeRoleDeleted = "roles.deleted"
EventTypeRoleDeleted identifies a roles.deleted notification.
const EventTypeRoleUpdated = "roles.updated"
EventTypeRoleUpdated identifies a roles.updated notification.
Variables ¶
var ( // ErrEventSecretMissing indicates an empty signing secret. ErrEventSecretMissing = errors.New("missing event signing secret") // ErrEventTimestampInvalid indicates a missing or malformed timestamp. ErrEventTimestampInvalid = errors.New("invalid event timestamp") // ErrEventSignatureInvalid indicates a missing, malformed, or mismatched signature. ErrEventSignatureInvalid = errors.New("invalid event signature") // ErrEventSignatureExpired indicates a timestamp outside the allowed clock skew. ErrEventSignatureExpired = errors.New("event timestamp outside allowed tolerance") // ErrEventPayloadInvalid indicates a JSON object that could not be decoded as an event. ErrEventPayloadInvalid = errors.New("invalid event payload") // ErrEventAlreadyRegistered indicates a duplicate typed callback registration. ErrEventAlreadyRegistered = errors.New("event callback already registered") )
var OAuth2Endpoint = oauth2.Endpoint{
AuthURL: "https://api.sumup.com/authorize",
TokenURL: "https://api.sumup.com/token",
}
OAuth2Endpoint is SumUp's OAuth 2.0 endpoint.
Functions ¶
func VerifyEventSignature ¶ added in v0.22.0
VerifyEventSignature verifies HMAC-SHA256 over v1:timestamp:body using the signing secret and a fixed five-minute tolerance. Verification uses the exact body bytes and constant-time digest comparison. Pass the complete signature header in t=<unix timestamp>,v1=<hex HMAC> format. An empty secret is always rejected.
Types ¶
type APIError ¶ added in v0.21.0
APIError preserves the HTTP response for an unsuccessful API request. Use errors.As to inspect a documented body such as *Problem.
type Address ¶ added in v0.14.0
type Address struct {
// In Spain, an autonomous community is the first sub-national level of political and administrative division.
// Max length: 60
AutonomousCommunity *string `json:"autonomous_community,omitempty"`
// The city of the address.
// Max length: 60
City *string `json:"city,omitempty"`
// In many countries, terms cognate with "commune" are used, referring to the community living in the area and
// the common interest. Used in countries such as Chile.
// Max length: 60
Commune *string `json:"commune,omitempty"`
// The ISO3166-1 Alpha-2 code of the address country.
// Min length: 2
// Max length: 2
// Pattern: ^[A-Z]{2}$
Country CountryCode `json:"country"`
// A county is a geographic region of a country used for administrative or other purposes in some nations. Used
// in countries such as Ireland, Romania, etc.
// Max length: 60
County *string `json:"county,omitempty"`
// A department (French: département, Spanish: departamento) is an administrative or political division in
// several countries. Used in countries such as Colombia.
// Max length: 60
Department *string `json:"department,omitempty"`
// A district is a type of administrative division that in some countries is managed by the local government. Used
// in countries such as Portugal.
// Max length: 60
District *string `json:"district,omitempty"`
// A postal address in Ireland.
// Max length: 10
Eircode *string `json:"eircode,omitempty"`
// A municipality is usually a single administrative division having corporate status and powers of self-government or
// jurisdiction as granted by national and regional laws to which it is subordinate. Used in countries such as
// Colombia.
// Max length: 60
Municipality *string `json:"municipality,omitempty"`
// Locality level of the address. Used in countries such as Brazil or Chile.
// Max length: 60
Neighborhood *string `json:"neighborhood,omitempty"`
// The postal code (aka. zip code) of the address.
// Max length: 10
PostCode *string `json:"post_code,omitempty"`
// A post town is a required part of all postal addresses in the United Kingdom and Ireland, and a basic unit
// of the postal delivery system.
// Max length: 60
PostTown *string `json:"post_town,omitempty"`
// The province where the address is located. This may not be relevant in some countries.
// Max length: 60
Province *string `json:"province,omitempty"`
// The region where the address is located. This may not be relevant in some countries.
// Max length: 60
Region *string `json:"region,omitempty"`
// Most often, a country has a single state, with various administrative divisions. The term "state" is sometimes
// used to refer to the federated polities that make up the federation. Used in countries such as the United States
// and Brazil.
// Max length: 60
State *string `json:"state,omitempty"`
// Max items: 2
StreetAddress []string `json:"street_address,omitempty"`
// A US system of postal codes used by the United States Postal Service (USPS).
// Max length: 10
ZipCode *string `json:"zip_code,omitempty"`
}
An address somewhere in the world. The address fields used depend on the country conventions. For example, in Great Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addresses is `state`, whereas in Chile it's `region`. Whether an address is valid or not depends on whether the locally required fields are present. Fields not supported in a country will be ignored. Address documentation: https://developer.sumup.com/tools/glossary/address
type AddressLegacy ¶ added in v0.14.0
type AddressLegacy struct {
// City name from the address.
City *string `json:"city,omitempty"`
// Two letter country code formatted according to [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
Country *string `json:"country,omitempty"`
// First line of the address with details of the street name and number.
Line1 *string `json:"line_1,omitempty"`
// Second line of the address with details of the building, unit, apartment, and floor numbers.
Line2 *string `json:"line_2,omitempty"`
// Postal code from the address.
PostalCode *string `json:"postal_code,omitempty"`
// State name or abbreviation from the address.
State *string `json:"state,omitempty"`
}
Profile's personal address information.
type Amount ¶ added in v0.18.0
type Amount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Amount is a schema definition.
type Attributes ¶ added in v0.14.0
Object attributes that are modifiable only by SumUp applications.
type BadRequest ¶ added in v0.14.0
type BadRequest struct {
Errors BadRequestErrors `json:"errors"`
}
400 Bad Request
func (*BadRequest) Error ¶ added in v0.14.0
func (e *BadRequest) Error() string
type BadRequestErrors ¶ added in v0.14.0
type BadRequestErrors struct {
// Fuller message giving context to error
Detail *string `json:"detail,omitempty"`
// Key indicating type of error
Type BadRequestErrorsType `json:"type"`
}
BadRequestErrors is a schema definition.
type BadRequestErrorsType ¶ added in v0.14.0
type BadRequestErrorsType string
Key indicating type of error
const ( BadRequestErrorsTypeAppOutdated BadRequestErrorsType = "APP_OUTDATED" BadRequestErrorsTypeDuplicateHeaders BadRequestErrorsType = "DUPLICATE_HEADERS" BadRequestErrorsTypeInvalidAffiliateKey BadRequestErrorsType = "INVALID_AFFILIATE_KEY" BadRequestErrorsTypeInvalidBearerToken BadRequestErrorsType = "INVALID_BEARER_TOKEN" BadRequestErrorsTypeInvalidUserAgent BadRequestErrorsType = "INVALID_USER_AGENT" BadRequestErrorsTypeNotEnoughUnpaidPayouts BadRequestErrorsType = "NOT_ENOUGH_UNPAID_PAYOUTS" )
type BasePerson ¶ added in v0.14.0
type BasePerson struct {
// An address somewhere in the world. The address fields used depend on the country conventions. For example, in
// Great Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addresses
// is `state`, whereas in Chile it's `region`.
// Whether an address is valid or not depends on whether the locally required fields are present. Fields not
// supported in a country will be ignored.
// Address documentation: https://developer.sumup.com/tools/glossary/address
Address *Address `json:"address,omitempty"`
// The date of birth of the individual, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format.
// Format: date
Birthdate *datetime.Date `json:"birthdate,omitempty"`
// Reflects the status of changes submitted through the `PATCH` endpoints for the Merchant or Persons. If some
// changes have not been applied yet, the status will be `pending`. If all changes have been applied, the status
// `done`.
// The status is only returned after write operations or on read endpoints when the `version` query parameter is
// provided.
// Read only
ChangeStatus *ChangeStatus `json:"change_status,omitempty"`
// An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
// country code. This definition users `oneOf` with a two-character string
// type to allow for support of future countries in client code.
// Min length: 2
// Max length: 2
// Pattern: ^[A-Z]{2}$
Citizenship *CountryCode `json:"citizenship,omitempty"`
// An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code representing the country
// where the Person resides.
// Pattern: ^[A-Z]{2}$
CountryOfResidence *nullable.Field[string] `json:"country_of_residence,omitempty"`
// The last name(s) of the individual.
// Min length: 1
// Max length: 60
FamilyName *string `json:"family_name,omitempty"`
// The first name(s) of the individual.
// Min length: 1
// Max length: 60
GivenName *string `json:"given_name,omitempty"`
// The unique identifier for the Person. This is a [typeid](https://github.com/sumup/typeid).
// Read only
ID string `json:"id"`
// A list of country-specific personal identifiers.
// Max items: 32
Identifiers PersonalIdentifiers `json:"identifiers,omitempty"`
// The Person's nationality. May be an [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country
// code, but legacy data may not conform to this standard.
// Pattern: ^[A-Z]{2}$
Nationality *nullable.Field[string] `json:"nationality,omitempty"`
Ownership *Ownership `json:"ownership,omitempty"`
// A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format.
// Max length: 16
PhoneNumber *PhoneNumber `json:"phone_number,omitempty"`
// A list of roles the Person has in the Merchant or towards SumUp. A Merchant must have at least one Person with
// the relationship `representative`.
// Min items: 1
// Max items: 1
Relationships []string `json:"relationships,omitempty"`
// A corresponding identity user ID for the Person, if they have a user account.
UserID *string `json:"user_id,omitempty"`
// The version of the resource. The version reflects a specific change submitted to the API via one of the `PATCH`
// endpoints.
Version *Version `json:"version,omitempty"`
}
Base schema for a Person associated with a Merchant. This can be a legal representative, business owner (ultimate beneficial owner), or an officer. A legal representative is the Person who registered the Merchant with SumUp. They should always have a `user_id`.
Person documentation: https://developer.sumup.com/tools/glossary/merchant#persons
type Brand ¶ added in v0.22.0
type Brand string
The brand of the card. Input is case-insensitive; the canonical form is lowercase snake_case. **VALUES**: [amex, cup, diners, discover, elo, elv, hipercard, jcb, maestro, mastercard, visa, visa_electron, visa_vpay, vr, eftpos, conecs, swile, girocard, interac, sumup, bancomat]. Max length: 20
type Branding ¶ added in v0.14.0
type Branding struct {
// A hex color value representing the preferred background color of this merchant.
BackgroundColor *string `json:"background_color,omitempty"`
// Min length: 1
// Max length: 500
FooterText *string `json:"footer_text,omitempty"`
// Data-URL encoded hero image for the merchant business.
// Format: uri
Hero *string `json:"hero,omitempty"`
// An icon for the merchant. Must be square.
// Format: uri
Icon *string `json:"icon,omitempty"`
// A logo for the merchant that will be used in place of the icon and without the merchant's name next to it
// if there's sufficient space.
// Format: uri
Logo *string `json:"logo,omitempty"`
// A hex color value representing the primary branding color of this merchant (your brand color).
PrimaryColor *string `json:"primary_color,omitempty"`
// A hex color value representing the color of the text displayed on branding color of this merchant.
PrimaryColorFg *string `json:"primary_color_fg,omitempty"`
// A hex color value representing the secondary branding color of this merchant (accent color used for buttons).
SecondaryColor *string `json:"secondary_color,omitempty"`
// A hex color value representing the color of the text displayed on secondary branding color of this merchant.
SecondaryColorFg *string `json:"secondary_color_fg,omitempty"`
}
Settings used to apply the Merchant's branding to email receipts, invoices, checkouts, and other products.
type BusinessProfile ¶ added in v0.14.0
type BusinessProfile struct {
// An address somewhere in the world. The address fields used depend on the country conventions. For example, in
// Great Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addresses
// is `state`, whereas in Chile it's `region`.
// Whether an address is valid or not depends on whether the locally required fields are present. Fields not
// supported in a country will be ignored.
// Address documentation: https://developer.sumup.com/tools/glossary/address
Address *Address `json:"address,omitempty"`
// Settings used to apply the Merchant's branding to email receipts, invoices, checkouts, and other products.
Branding *Branding `json:"branding,omitempty"`
// The descriptor is the text that your customer sees on their bank account statement.
// The more recognisable your descriptor is, the less risk you have of receiving disputes (e.g. chargebacks).
// Min length: 1
// Max length: 30
// Pattern: ^[a-zA-Z0-9 +'_.-]+$
DynamicDescriptor *string `json:"dynamic_descriptor,omitempty"`
// A publicly available email address.
// Min length: 1
// Max length: 255
Email *string `json:"email,omitempty"`
// The customer-facing business name.
// Min length: 1
// Max length: 150
Name *string `json:"name,omitempty"`
// A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format.
// Max length: 16
PhoneNumber *PhoneNumber `json:"phone_number,omitempty"`
// The business's publicly available website.
// Min length: 1
// Max length: 255
Website *string `json:"website,omitempty"`
}
Business information about the merchant. This information will be visible to the merchant's customers.
type Card ¶ added in v0.14.0
type Card struct {
// Three or four-digit card verification value (security code) of the payment card.
// Write only
// Min length: 3
// Max length: 4
Cvv string `json:"cvv"`
// Two-digit expiration month, from `01` through `12`.
// Write only
// Min length: 2
// Max length: 2
// Pattern: ^(0[1-9]|1[0-2])$
ExpiryMonth string `json:"expiry_month"`
// Two- or four-digit expiration year in `YY` or `YYYY` format.
// Write only
// Pattern: ^[0-9]{2}([0-9]{2})?$
ExpiryYear string `json:"expiry_year"`
// Name of the cardholder as it appears on the payment card.
// Write only
Name string `json:"name"`
// Number of the payment card (without spaces).
// Write only
Number string `json:"number"`
// Issuing card network of the payment card used for the transaction.
Type CardType `json:"type"`
// Required five-digit ZIP code. Applicable only to merchant users in the USA.
// Write only
// Min length: 5
// Max length: 5
ZipCode *string `json:"zip_code,omitempty"`
}
__Required when payment type is `card`.__ Details of the payment card.
type CardResponse ¶ added in v0.14.0
type CardResponse struct {
// Last 4 digits of the payment card number.
// Read only
// Min length: 4
// Max length: 4
Last4Digits *string `json:"last_4_digits,omitempty"`
// Payment Account Reference (PAR) defined by [EMVCo](https://www.emvco.com/emv-technologies/payment-tokenisation/). It
// links a card's primary account number (PAN) with its affiliated payment tokens, allowing transactions made
// with the physical card and tokenized versions of that card, such as digital wallets, to be correlated when
// PAR is available.
//
// This reference cannot be used to initiate a payment and is separate from the saved payment instrument `token`
// used to process checkouts. Returned only when available for the card; integrations must handle its absence.
PaymentAccountReference *string `json:"payment_account_reference,omitempty"`
// Issuing card network of the payment card used for the transaction.
Type *CardType `json:"type,omitempty"`
}
Details of the payment card.
type CardType ¶ added in v0.14.0
type CardType string
Issuing card network of the payment card used for the transaction.
const ( CardTypeAlelo CardType = "ALELO" CardTypeAmex CardType = "AMEX" CardTypeBancomat CardType = "BANCOMAT" CardTypeConecs CardType = "CONECS" CardTypeCup CardType = "CUP" CardTypeDiners CardType = "DINERS" CardTypeDiscover CardType = "DISCOVER" CardTypeEftpos CardType = "EFTPOS" CardTypeElo CardType = "ELO" CardTypeElv CardType = "ELV" CardTypeGirocard CardType = "GIROCARD" CardTypeHipercard CardType = "HIPERCARD" CardTypeInterac CardType = "INTERAC" CardTypeJcb CardType = "JCB" CardTypeMaestro CardType = "MAESTRO" CardTypeMastercard CardType = "MASTERCARD" CardTypePluxee CardType = "PLUXEE" CardTypeSumup CardType = "SUMUP" CardTypeSwile CardType = "SWILE" CardTypeTicket CardType = "TICKET" CardTypeUnknown CardType = "UNKNOWN" CardTypeVisa CardType = "VISA" CardTypeVisaElectron CardType = "VISA_ELECTRON" CardTypeVisaVpay CardType = "VISA_VPAY" CardTypeVpay CardType = "VPAY" CardTypeVr CardType = "VR" )
type CategoryV10 ¶ added in v0.22.0
type CategoryV10 struct {
// The category id. Usually a UUID, but not always (legacy cases).
// Max length: 100
ID string `json:"id"`
// The category name.
// Max length: 30
Name string `json:"name"`
}
A category a line belongs to.
type ChangeStatus ¶ added in v0.14.0
type ChangeStatus string
Reflects the status of changes submitted through the `PATCH` endpoints for the Merchant or Persons. If some changes have not been applied yet, the status will be `pending`. If all changes have been applied, the status `done`. The status is only returned after write operations or on read endpoints when the `version` query parameter is provided.
Read only
type Checkout ¶ added in v0.14.0
type Checkout struct {
// Amount to be charged to the payer, expressed in major units.
Amount *float32 `json:"amount,omitempty"`
// Merchant-defined reference for the checkout. Use it to correlate the SumUp checkout with your own order, cart,
// subscription, or payment attempt in your systems.
// Max length: 64
CheckoutReference *string `json:"checkout_reference,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// Merchant-scoped identifier of the customer associated with the checkout. Use it when storing payment instruments
// or reusing saved customer context for recurring and returning-payer flows.
CustomerID *string `json:"customer_id,omitempty"`
// The timestamp of when the checkout was created.
Date *time.Time `json:"date,omitempty"`
// Short merchant-defined description shown in SumUp tools and reporting. Use it to make the checkout easier to
// recognize in dashboards, support workflows, and reconciliation.
Description *string `json:"description,omitempty"`
// URL of the SumUp-hosted payment page that handles the payment flow. Returned when Hosted Checkout is enabled
// for the checkout.
// Read only
// Format: uri
HostedCheckoutURL *string `json:"hosted_checkout_url,omitempty"`
// Unique SumUp identifier of the checkout resource.
// Read only
ID *string `json:"id,omitempty"`
// Details of the mandate linked to the saved payment instrument.
Mandate *MandateResponse `json:"mandate,omitempty"`
// Short unique identifier for the merchant that receives the payment.
MerchantCode *string `json:"merchant_code,omitempty"`
// Optional backend callback URL for checkout status notifications. SumUp sends an HTTP POST with `event_type` and
// the checkout `id`. Retrieve the checkout to verify its current status before updating your order. See the
// [webhook guide](https://developer.sumup.com/online-payments/webhooks/) for the payload and response requirements.
// Format: uri
ReturnURL *string `json:"return_url,omitempty"`
// Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID`
// means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkout
// can no longer be processed.
Status *CheckoutStatus `json:"status,omitempty"`
// Payment attempts and resulting transaction records linked to this checkout. Use the Transactions endpoints when
// you need the authoritative payment result and event history.
// Unique items only
Transactions []CheckoutTransaction `json:"transactions,omitempty"`
// Optional expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable.
// If omitted, the checkout does not have an explicit expiry time.
ValidUntil *nullable.Field[time.Time] `json:"valid_until,omitempty"`
}
Core checkout resource returned by the Checkouts API. A checkout is created before payment processing and then updated as payment attempts, redirects, and resulting transactions are attached to it.
type CheckoutAccepted ¶ added in v0.14.0
type CheckoutAccepted struct {
// Instructions for the next action the payer or client must take.
NextStep *CheckoutAcceptedNextStep `json:"next_step,omitempty"`
}
Response returned when checkout processing requires an additional payer action, such as a 3DS challenge or a redirect to an external payment method page.
type CheckoutAcceptedNextStep ¶ added in v0.14.0
type CheckoutAcceptedNextStep struct {
// Allowed presentation mechanisms for the next step. `iframe` means the flow can be embedded, while `browser` means
// it can be completed through a full-page redirect.
Mechanism []CheckoutAcceptedNextStepMechanism `json:"mechanism,omitempty"`
// HTTP method to use when following the next step.
Method *string `json:"method,omitempty"`
// Parameters required to complete the next step. The exact keys depend on the payment provider and flow type.
Payload CheckoutAcceptedNextStepPayload `json:"payload,omitempty"`
// Merchant URL where the payer returns after the external flow finishes.
RedirectURL *string `json:"redirect_url,omitempty"`
// URL to open or submit in order to continue processing.
URL *string `json:"url,omitempty"`
}
Instructions for the next action the payer or client must take.
type CheckoutAcceptedNextStepMechanism ¶ added in v0.14.0
type CheckoutAcceptedNextStepMechanism string
CheckoutAcceptedNextStepMechanism is a schema definition.
const ( CheckoutAcceptedNextStepMechanismBrowser CheckoutAcceptedNextStepMechanism = "browser" CheckoutAcceptedNextStepMechanismIframe CheckoutAcceptedNextStepMechanism = "iframe" )
type CheckoutAcceptedNextStepPayload ¶ added in v0.14.0
Parameters required to complete the next step. The exact keys depend on the payment provider and flow type.
type CheckoutCreateRequest ¶ added in v0.14.0
type CheckoutCreateRequest struct {
// Amount to be charged to the payer, expressed in major units.
Amount float32 `json:"amount"`
// Merchant-defined reference for the new checkout, up to 64 characters. Use it to correlate the checkout with
// an order or payment attempt in your own system. If a checkout already exists for the supplied unique parameters,
// creation returns `409` with `DUPLICATED_CHECKOUT`; see the conflict response.
// Max length: 64
CheckoutReference string `json:"checkout_reference"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency Currency `json:"currency"`
// Merchant-scoped customer identifier. Required when setting up recurring payments and useful when the checkout
// should be linked to a returning payer.
CustomerID *string `json:"customer_id,omitempty"`
// Short merchant-defined description shown in SumUp tools and reporting for easier identification of the checkout.
Description *string `json:"description,omitempty"`
// Hosted Checkout configuration. Enable it to receive a SumUp-hosted payment page URL in the checkout response.
HostedCheckout *HostedCheckout `json:"hosted_checkout,omitempty"`
// Short unique identifier for the merchant that should receive the payment.
MerchantCode string `json:"merchant_code"`
// Business purpose of the checkout. Use `CHECKOUT` for a standard payment and `SETUP_RECURRING_PAYMENT` when
// collecting consent and payment details for future recurring charges.
// Default: CHECKOUT
Purpose *CheckoutCreateRequestPurpose `json:"purpose,omitempty"`
// URL where the payer should be sent after a redirect-based payment or SCA flow completes. This is required for
// [APMs](https://developer.sumup.com/online-payments/apm/introduction) and recommended for card checkouts that
// may require [3DS](https://developer.sumup.com/online-payments/features/3ds). If it is omitted, the [Payment Widget](https://developer.sumup.com/online-payments/checkouts)
// can render the challenge in an iframe instead of using a full-page redirect.
RedirectURL *string `json:"redirect_url,omitempty"`
// Optional backend callback URL for checkout status notifications. SumUp sends an HTTP POST with `event_type` and
// the checkout `id`. Retrieve the checkout to verify its current status before updating your order. See the
// [webhook guide](https://developer.sumup.com/online-payments/webhooks/) for the payload and response requirements.
// Format: uri
ReturnURL *string `json:"return_url,omitempty"`
// Optional expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable.
// If omitted, the checkout does not have an explicit expiry time.
ValidUntil *nullable.Field[time.Time] `json:"valid_until,omitempty"`
}
Request body for creating a checkout before processing payment. Define the payment amount, currency, merchant, and optional customer or redirect behavior here.
type CheckoutCreateRequestPurpose ¶ added in v0.14.0
type CheckoutCreateRequestPurpose string
Business purpose of the checkout. Use `CHECKOUT` for a standard payment and `SETUP_RECURRING_PAYMENT` when collecting consent and payment details for future recurring charges. Default: CHECKOUT
const ( CheckoutCreateRequestPurposeCheckout CheckoutCreateRequestPurpose = "CHECKOUT" CheckoutCreateRequestPurposeSetupRecurringPayment CheckoutCreateRequestPurpose = "SETUP_RECURRING_PAYMENT" )
type CheckoutCreatedEvent ¶ added in v0.22.0
type CheckoutCreatedEvent struct{ TypedEvent[Checkout] }
CheckoutCreatedEvent is a checkouts.created notification. FetchObject retrieves the latest Checkout.
type CheckoutExpiredEvent ¶ added in v0.22.0
type CheckoutExpiredEvent struct{ TypedEvent[Checkout] }
CheckoutExpiredEvent is a checkouts.expired notification. FetchObject retrieves the latest Checkout.
type CheckoutFailedEvent ¶ added in v0.22.0
type CheckoutFailedEvent struct{ TypedEvent[Checkout] }
CheckoutFailedEvent is a checkouts.failed notification. FetchObject retrieves the latest Checkout.
type CheckoutPaidEvent ¶ added in v0.22.0
type CheckoutPaidEvent struct{ TypedEvent[Checkout] }
CheckoutPaidEvent is a checkouts.paid notification. FetchObject retrieves the latest Checkout.
type CheckoutStatus ¶ added in v0.14.0
type CheckoutStatus string
Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID` means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkout can no longer be processed.
const ( CheckoutStatusExpired CheckoutStatus = "EXPIRED" CheckoutStatusFailed CheckoutStatus = "FAILED" CheckoutStatusPaid CheckoutStatus = "PAID" CheckoutStatusPending CheckoutStatus = "PENDING" )
type CheckoutSuccess ¶ added in v0.14.0
type CheckoutSuccess struct {
// Amount to be charged to the payer, expressed in major units.
Amount *float32 `json:"amount,omitempty"`
// Merchant-defined reference for the checkout. Use it to correlate the SumUp checkout with your own order, cart,
// subscription, or payment attempt in your systems.
// Max length: 64
CheckoutReference *string `json:"checkout_reference,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// Merchant-scoped identifier of the customer associated with the checkout. Use it when storing payment instruments
// or reusing saved customer context for recurring and returning-payer flows.
CustomerID *string `json:"customer_id,omitempty"`
// The timestamp of when the checkout was created.
Date *time.Time `json:"date,omitempty"`
// Short merchant-defined description shown in SumUp tools and reporting. Use it to make the checkout easier to
// recognize in dashboards, support workflows, and reconciliation.
Description *string `json:"description,omitempty"`
// URL of the SumUp-hosted payment page that handles the payment flow. Returned when Hosted Checkout is enabled
// for the checkout.
// Read only
// Format: uri
HostedCheckoutURL *string `json:"hosted_checkout_url,omitempty"`
// Unique SumUp identifier of the checkout resource.
// Read only
ID *string `json:"id,omitempty"`
// Details of the mandate linked to the saved payment instrument.
Mandate *MandateResponse `json:"mandate,omitempty"`
// Short unique identifier for the merchant that receives the payment.
MerchantCode *string `json:"merchant_code,omitempty"`
// Name of the merchant.
MerchantName *string `json:"merchant_name,omitempty"`
// Details of the saved payment instrument created or reused during checkout processing.
PaymentInstrument *CheckoutSuccessPaymentInstrument `json:"payment_instrument,omitempty"`
// URL where the payer is redirected after a redirect-based payment or SCA flow completes.
RedirectURL *string `json:"redirect_url,omitempty"`
// Optional backend callback URL for checkout status notifications. SumUp sends an HTTP POST with `event_type` and
// the checkout `id`. Retrieve the checkout to verify its current status before updating your order. See the
// [webhook guide](https://developer.sumup.com/online-payments/webhooks/) for the payload and response requirements.
// Format: uri
ReturnURL *string `json:"return_url,omitempty"`
// Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID`
// means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkout
// can no longer be processed.
Status *CheckoutSuccessStatus `json:"status,omitempty"`
// Transaction code of the successful transaction with which the payment for the checkout is completed.
// Read only
TransactionCode *string `json:"transaction_code,omitempty"`
// Unique identifier of the successful transaction that completed payment for the checkout.
// Read only
TransactionID *string `json:"transaction_id,omitempty"`
// Payment attempts and resulting transaction records linked to this checkout. Use the Transactions endpoints when
// you need the authoritative payment result and event history.
// Unique items only
Transactions []CheckoutSuccessTransaction `json:"transactions,omitempty"`
// Optional expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable.
// If omitted, the checkout does not have an explicit expiry time.
ValidUntil *nullable.Field[time.Time] `json:"valid_until,omitempty"`
}
Checkout resource returned after a synchronous processing attempt. In addition to the base checkout fields, it can include the resulting transaction identifiers and any newly created payment instrument token.
type CheckoutSuccessPaymentInstrument ¶ added in v0.14.0
type CheckoutSuccessPaymentInstrument struct {
// Unique token of the saved payment instrument.
Token *string `json:"token,omitempty"`
}
Details of the saved payment instrument created or reused during checkout processing.
type CheckoutSuccessStatus ¶ added in v0.14.0
type CheckoutSuccessStatus string
Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID` means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkout can no longer be processed.
const ( CheckoutSuccessStatusExpired CheckoutSuccessStatus = "EXPIRED" CheckoutSuccessStatusFailed CheckoutSuccessStatus = "FAILED" CheckoutSuccessStatusPaid CheckoutSuccessStatus = "PAID" CheckoutSuccessStatusPending CheckoutSuccessStatus = "PENDING" )
type CheckoutSuccessTransaction ¶ added in v0.14.0
type CheckoutSuccessTransaction struct {
// Total amount of the transaction in major units of `currency`, for example `10.1` for EUR 10.10.
Amount *float32 `json:"amount,omitempty"`
// Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments.
AuthCode *string `json:"auth_code,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// How the payment details were captured, for example `CHIP` or `CONTACTLESS` for card-present payments and
// `CUSTOMER_ENTRY` for card details entered by the payer. For wallet and alternative payment methods, this can
// identify the method, such as `APPLE_PAY` or `BLIK`.
EntryMode *EntryMode `json:"entry_mode,omitempty"`
// Unique identifier of the transaction.
ID *string `json:"id,omitempty"`
// Number of installments for a deferred payment.
// Min: 1
InstallmentsCount *int `json:"installments_count,omitempty"`
// Unique code of the registered merchant to whom the payment is made.
MerchantCode *string `json:"merchant_code,omitempty"`
// Payment category recorded on a transaction, for example `POS` for a point-of-sale card payment, `ECOM` for
// an online card payment, or `RECURRING` for a recurring card payment. These reporting values are separate from
// the lowercase `payment_type` values used to process checkouts.
PaymentType *PaymentType `json:"payment_type,omitempty"`
// Current status of the transaction.
//
// - `PENDING`: The transaction has been created but its final outcome is not known yet.
// - `SUCCESSFUL`: The transaction completed successfully.
// - `CANCELLED`: The transaction was cancelled or otherwise reversed before completion.
// - `FAILED`: The transaction attempt did not complete successfully.
// - `REFUNDED`: The transaction was refunded in full or in part.
Status *TransactionStatus `json:"status,omitempty"`
// The timestamp of when the transaction was created.
Timestamp *time.Time `json:"timestamp,omitempty"`
// Tip included in the total transaction amount, in major units of the transaction's currency.
TipAmount *float32 `json:"tip_amount,omitempty"`
// SumUp transaction code, for example `TEENSK4W2K`. Use it to look up the transaction with the `transaction_code` query
// parameter. This is separate from the transaction's `id` and the card issuer's `auth_code`.
TransactionCode *string `json:"transaction_code,omitempty"`
// VAT included in the total transaction amount, in major units of the transaction's currency.
VATAmount *float32 `json:"vat_amount,omitempty"`
}
CheckoutSuccessTransaction is a schema definition.
type CheckoutTransaction ¶ added in v0.14.0
type CheckoutTransaction struct {
// Total amount of the transaction in major units of `currency`, for example `10.1` for EUR 10.10.
Amount *float32 `json:"amount,omitempty"`
// Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments.
AuthCode *string `json:"auth_code,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// How the payment details were captured, for example `CHIP` or `CONTACTLESS` for card-present payments and
// `CUSTOMER_ENTRY` for card details entered by the payer. For wallet and alternative payment methods, this can
// identify the method, such as `APPLE_PAY` or `BLIK`.
EntryMode *EntryMode `json:"entry_mode,omitempty"`
// Unique identifier of the transaction.
ID *string `json:"id,omitempty"`
// Number of installments for a deferred payment.
// Min: 1
InstallmentsCount *int `json:"installments_count,omitempty"`
// Unique code of the registered merchant to whom the payment is made.
MerchantCode *string `json:"merchant_code,omitempty"`
// Payment category recorded on a transaction, for example `POS` for a point-of-sale card payment, `ECOM` for
// an online card payment, or `RECURRING` for a recurring card payment. These reporting values are separate from
// the lowercase `payment_type` values used to process checkouts.
PaymentType *PaymentType `json:"payment_type,omitempty"`
// Current status of the transaction.
//
// - `PENDING`: The transaction has been created but its final outcome is not known yet.
// - `SUCCESSFUL`: The transaction completed successfully.
// - `CANCELLED`: The transaction was cancelled or otherwise reversed before completion.
// - `FAILED`: The transaction attempt did not complete successfully.
// - `REFUNDED`: The transaction was refunded in full or in part.
Status *TransactionStatus `json:"status,omitempty"`
// The timestamp of when the transaction was created.
Timestamp *time.Time `json:"timestamp,omitempty"`
// Tip included in the total transaction amount, in major units of the transaction's currency.
TipAmount *float32 `json:"tip_amount,omitempty"`
// SumUp transaction code, for example `TEENSK4W2K`. Use it to look up the transaction with the `transaction_code` query
// parameter. This is separate from the transaction's `id` and the card issuer's `auth_code`.
TransactionCode *string `json:"transaction_code,omitempty"`
// VAT included in the total transaction amount, in major units of the transaction's currency.
VATAmount *float32 `json:"vat_amount,omitempty"`
}
CheckoutTransaction is a schema definition.
type CheckoutUpdateRequest ¶ added in v0.17.1
type CheckoutUpdateRequest struct {
// Updated amount to be charged to the payer, expressed in major units.
Amount *float32 `json:"amount,omitempty"`
// Updated merchant-defined reference for the checkout.
// Max length: 64
CheckoutReference *string `json:"checkout_reference,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// Updated merchant-scoped customer identifier associated with the checkout.
CustomerID *string `json:"customer_id,omitempty"`
// Updated short merchant-defined description shown in SumUp tools and reporting.
Description *string `json:"description,omitempty"`
// Updated expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable.
ValidUntil *nullable.Field[time.Time] `json:"valid_until,omitempty"`
}
Request body for updating an existing checkout. Include only the fields that should be changed.
type CheckoutUpdatedEvent ¶ added in v0.22.0
type CheckoutUpdatedEvent struct{ TypedEvent[Checkout] }
CheckoutUpdatedEvent is a checkouts.updated notification. FetchObject retrieves the latest Checkout.
type CheckoutsClient ¶ added in v0.14.0
type CheckoutsClient struct {
// contains filtered or unexported fields
}
CheckoutsClient provides access to the Checkouts API.
Checkouts represent online payment sessions that you create before attempting to charge a payer. A checkout captures the payment intent, such as the amount, currency, merchant, and optional customer or redirect settings, and then moves through its lifecycle as you process it.
Use this tag to: - create a checkout before collecting or confirming payment details - process the checkout with a card, saved card, wallet, or supported alternative payment method - retrieve or list checkouts to inspect their current state and associated payment attempts - deactivate a checkout that should no longer be used
Typical workflow: - create a checkout with the order amount, currency, and merchant information - process the checkout through SumUp client tools such as the [Payment Widget and Swift Checkout SDK](https://developer.sumup.com/online-payments/checkouts) - retrieve the checkout or use the Transactions endpoints to inspect the resulting payment record
Checkouts are used to initiate and orchestrate online payments. Transactions remain the authoritative record of the resulting payment outcome.
func NewCheckoutsClient ¶ added in v0.14.0
func NewCheckoutsClient(c *client.Client) *CheckoutsClient
func (*CheckoutsClient) Create ¶ added in v0.14.0
func (c *CheckoutsClient) Create(ctx context.Context, body CheckoutsCreateParams) (*Checkout, error)
Creates a payment checkout for the specified merchant, amount, and currency. Supply a `checkout_reference` to identify the payment attempt in your own systems. Creating a checkout does not charge a payment instrument.
Set `hosted_checkout.enabled` to `true` to receive a [Hosted Checkout](https://developer.sumup.com/online-payments/checkouts/hosted-checkout/) URL where the customer can complete the payment. Use `redirect_url` for redirect-based payment and 3DS flows. If `return_url` is provided, SumUp sends processing updates to that backend callback URL.
Complete the payment through [Hosted Checkout](https://developer.sumup.com/online-payments/checkouts/hosted-checkout/) or the [Payment Widget](https://developer.sumup.com/online-payments/checkouts/card-widget).
func (*CheckoutsClient) CreateApplePaySession ¶ added in v0.16.0
func (c *CheckoutsClient) CreateApplePaySession(ctx context.Context, checkoutID string, body CheckoutsCreateApplePaySessionParams) (*CheckoutsCreateApplePaySessionResponse, error)
Creates an Apple Pay merchant session for the specified checkout.
Use this endpoint after the customer selects Apple Pay and before calling `ApplePaySession.completeMerchantValidation(...)` in the browser. SumUp validates the merchant session request and returns the Apple Pay session object that your frontend should pass to Apple's JavaScript API.
func (*CheckoutsClient) Deactivate ¶ added in v0.14.0
Deactivates an identified checkout resource. If the checkout has already been processed it can not be deactivated.
func (*CheckoutsClient) Get ¶ added in v0.14.0
func (c *CheckoutsClient) Get(ctx context.Context, checkoutID string) (*CheckoutSuccess, error)
Retrieves a checkout by its SumUp `checkout_id`. After processing a payment, returning from a redirect, or receiving a checkout notification, retrieve the checkout to confirm its current `status` before updating your order or displaying the payment outcome to the payer.
func (*CheckoutsClient) List ¶ added in v0.14.0
func (c *CheckoutsClient) List(ctx context.Context, params CheckoutsListParams) (*CheckoutsListResponse, error)
Lists created checkout resources according to the applied `checkout_reference`.
func (*CheckoutsClient) ListAvailablePaymentMethods ¶ added in v0.14.0
func (c *CheckoutsClient) ListAvailablePaymentMethods(ctx context.Context, merchantCode string, params CheckoutsListAvailablePaymentMethodsParams) (*CheckoutsListAvailablePaymentMethodsResponse, error)
Lists the payment methods available to the merchant for checkout payments. Use the optional amount and currency filters to check eligibility for a particular payment before presenting payment options to the payer.
func (*CheckoutsClient) Process ¶ added in v0.14.0
func (c *CheckoutsClient) Process(ctx context.Context, checkoutID string, body CheckoutsProcessParams) (*CheckoutsProcessResponse, error)
:::caution[PCI DSS compliance required] When you submit raw card details directly to the Checkout API, your systems store, process, or transmit cardholder data and are therefore subject to applicable [PCI DSS requirements](https://www.pcisecuritystandards.org/document_library/). You should only use this integration if your environment is appropriately PCI DSS compliant. :::
Processing a checkout will attempt to charge the provided payment instrument for the amount of the specified checkout resource initiated in the `Create a checkout` endpoint.
A processing response can require an additional payer action, such as a 3DS challenge or a payment-provider redirect. If `next_step` is returned, follow its instructions to continue the payment flow.
Retrieve the checkout afterwards to confirm its payment status. Acceptance of the processing request does not by itself mean the checkout is paid.
func (*CheckoutsClient) Update ¶ added in v0.17.1
func (c *CheckoutsClient) Update(ctx context.Context, checkoutID string, body CheckoutsUpdateParams) (*Checkout, error)
Updates the amount, currency, description, reference, expiration, or customer associated with an existing checkout. Only the supplied fields are updated.
This request changes the checkout details; it does not charge a payment instrument. Process the checkout separately to attempt a payment.
type CheckoutsCreateApplePaySession400Response ¶ added in v0.16.0
type CheckoutsCreateApplePaySession400Response json.RawMessage
CheckoutsCreateApplePaySession400Response is a schema definition.
func (*CheckoutsCreateApplePaySession400Response) Error ¶ added in v0.16.0
func (e *CheckoutsCreateApplePaySession400Response) Error() string
type CheckoutsCreateApplePaySessionParams ¶ added in v0.16.0
type CheckoutsCreateApplePaySessionParams struct {
// Hostname of the website displaying the Apple Pay payment sheet, without a URL scheme or path. Use the domain
// registered for Apple Pay.
// Format: hostname
Context string `json:"context"`
// Apple Pay validation URL received as `validationURL` in the browser's `onvalidatemerchant` event.
// Format: uri
Target string `json:"target"`
}
CheckoutsCreateApplePaySessionParams is a schema definition.
type CheckoutsCreateApplePaySessionResponse ¶ added in v0.16.0
type CheckoutsCreateApplePaySessionResponse = json.RawMessage
CheckoutsCreateApplePaySessionResponse is a schema definition.
type CheckoutsCreateParams ¶ added in v0.14.0
type CheckoutsCreateParams = CheckoutCreateRequest
type CheckoutsListAvailablePaymentMethodsParams ¶ added in v0.14.0
type CheckoutsListAvailablePaymentMethodsParams struct {
// Payment amount in major units, for example `9.99` for EUR 9.99. When filtering by `amount`, also provide `currency`.
Amount *float64
// Three-letter ISO 4217 currency code for which the payment methods should be eligible, for example `EUR`.
Currency *string
}
CheckoutsListAvailablePaymentMethodsParams are query parameters for GetPaymentMethods.
func (*CheckoutsListAvailablePaymentMethodsParams) QueryValues ¶ added in v0.14.0
func (p *CheckoutsListAvailablePaymentMethodsParams) QueryValues() url.Values
QueryValues converts CheckoutsListAvailablePaymentMethodsParams into url.Values.
type CheckoutsListAvailablePaymentMethodsResponse ¶ added in v0.14.0
type CheckoutsListAvailablePaymentMethodsResponse struct {
// Payment methods available to the merchant for the checkout.
AvailablePaymentMethods []CheckoutsListAvailablePaymentMethodsResponseAvailablePaymentMethod `json:"available_payment_methods,omitempty"`
}
CheckoutsListAvailablePaymentMethodsResponse is a schema definition.
type CheckoutsListAvailablePaymentMethodsResponseAvailablePaymentMethod ¶ added in v0.14.0
type CheckoutsListAvailablePaymentMethodsResponseAvailablePaymentMethod struct {
// Unique identifier of the payment method.
ID string `json:"id"`
}
CheckoutsListAvailablePaymentMethodsResponseAvailablePaymentMethod is a schema definition.
type CheckoutsListParams ¶ added in v0.14.0
type CheckoutsListParams struct {
// Filters checkouts by the merchant-defined `checkout_reference` supplied when creating the checkout. This is
// separate from the SumUp-generated checkout `id`.
CheckoutReference *string
}
CheckoutsListParams are query parameters for ListCheckouts.
func (*CheckoutsListParams) QueryValues ¶ added in v0.14.0
func (p *CheckoutsListParams) QueryValues() url.Values
QueryValues converts CheckoutsListParams into url.Values.
type CheckoutsListResponse ¶ added in v0.14.0
type CheckoutsListResponse []CheckoutSuccess
CheckoutsListResponse is a schema definition.
type CheckoutsProcess400Response ¶ added in v0.14.0
type CheckoutsProcess400Response json.RawMessage
CheckoutsProcess400Response is a schema definition.
func (*CheckoutsProcess400Response) Error ¶ added in v0.14.0
func (e *CheckoutsProcess400Response) Error() string
type CheckoutsProcessCheckoutSuccessResponse ¶ added in v0.20.0
type CheckoutsProcessCheckoutSuccessResponse struct {
// Amount to be charged to the payer, expressed in major units.
Amount *float32 `json:"amount,omitempty"`
// Merchant-defined reference for the checkout. Use it to correlate the SumUp checkout with your own order, cart,
// subscription, or payment attempt in your systems.
// Max length: 64
CheckoutReference *string `json:"checkout_reference,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// Merchant-scoped identifier of the customer associated with the checkout. Use it when storing payment instruments
// or reusing saved customer context for recurring and returning-payer flows.
CustomerID *string `json:"customer_id,omitempty"`
// The timestamp of when the checkout was created.
Date *time.Time `json:"date,omitempty"`
// Short merchant-defined description shown in SumUp tools and reporting. Use it to make the checkout easier to
// recognize in dashboards, support workflows, and reconciliation.
Description *string `json:"description,omitempty"`
// URL of the SumUp-hosted payment page that handles the payment flow. Returned when Hosted Checkout is enabled
// for the checkout.
// Read only
// Format: uri
HostedCheckoutURL *string `json:"hosted_checkout_url,omitempty"`
// Unique SumUp identifier of the checkout resource.
// Read only
ID *string `json:"id,omitempty"`
// Details of the mandate linked to the saved payment instrument.
Mandate *MandateResponse `json:"mandate,omitempty"`
// Short unique identifier for the merchant that receives the payment.
MerchantCode *string `json:"merchant_code,omitempty"`
// Name of the merchant.
MerchantName *string `json:"merchant_name,omitempty"`
// Details of the saved payment instrument created or reused during checkout processing.
PaymentInstrument *CheckoutsProcessCheckoutSuccessResponsePaymentInstrument `json:"payment_instrument,omitempty"`
// URL where the payer is redirected after a redirect-based payment or SCA flow completes.
RedirectURL *string `json:"redirect_url,omitempty"`
// Optional backend callback URL for checkout status notifications. SumUp sends an HTTP POST with `event_type` and
// the checkout `id`. Retrieve the checkout to verify its current status before updating your order. See the
// [webhook guide](https://developer.sumup.com/online-payments/webhooks/) for the payload and response requirements.
// Format: uri
ReturnURL *string `json:"return_url,omitempty"`
// Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID`
// means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkout
// can no longer be processed.
Status *CheckoutsProcessCheckoutSuccessResponseStatus `json:"status,omitempty"`
// Transaction code of the successful transaction with which the payment for the checkout is completed.
// Read only
TransactionCode *string `json:"transaction_code,omitempty"`
// Unique identifier of the successful transaction that completed payment for the checkout.
// Read only
TransactionID *string `json:"transaction_id,omitempty"`
// Payment attempts and resulting transaction records linked to this checkout. Use the Transactions endpoints when
// you need the authoritative payment result and event history.
// Unique items only
Transactions []CheckoutsProcessCheckoutSuccessResponseTransaction `json:"transactions,omitempty"`
// Optional expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable.
// If omitted, the checkout does not have an explicit expiry time.
ValidUntil *nullable.Field[time.Time] `json:"valid_until,omitempty"`
}
Checkout resource returned after a synchronous processing attempt. In addition to the base checkout fields, it can include the resulting transaction identifiers and any newly created payment instrument token.
type CheckoutsProcessCheckoutSuccessResponsePaymentInstrument ¶ added in v0.20.0
type CheckoutsProcessCheckoutSuccessResponsePaymentInstrument struct {
// Unique token of the saved payment instrument.
Token *string `json:"token,omitempty"`
}
Details of the saved payment instrument created or reused during checkout processing.
type CheckoutsProcessCheckoutSuccessResponseStatus ¶ added in v0.20.0
type CheckoutsProcessCheckoutSuccessResponseStatus string
Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID` means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkout can no longer be processed.
const ( CheckoutsProcessCheckoutSuccessResponseStatusExpired CheckoutsProcessCheckoutSuccessResponseStatus = "EXPIRED" CheckoutsProcessCheckoutSuccessResponseStatusFailed CheckoutsProcessCheckoutSuccessResponseStatus = "FAILED" CheckoutsProcessCheckoutSuccessResponseStatusPaid CheckoutsProcessCheckoutSuccessResponseStatus = "PAID" CheckoutsProcessCheckoutSuccessResponseStatusPending CheckoutsProcessCheckoutSuccessResponseStatus = "PENDING" )
type CheckoutsProcessCheckoutSuccessResponseTransaction ¶ added in v0.20.0
type CheckoutsProcessCheckoutSuccessResponseTransaction struct {
// Total amount of the transaction in major units of `currency`, for example `10.1` for EUR 10.10.
Amount *float32 `json:"amount,omitempty"`
// Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments.
AuthCode *string `json:"auth_code,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// How the payment details were captured, for example `CHIP` or `CONTACTLESS` for card-present payments and
// `CUSTOMER_ENTRY` for card details entered by the payer. For wallet and alternative payment methods, this can
// identify the method, such as `APPLE_PAY` or `BLIK`.
EntryMode *EntryMode `json:"entry_mode,omitempty"`
// Unique identifier of the transaction.
ID *string `json:"id,omitempty"`
// Number of installments for a deferred payment.
// Min: 1
InstallmentsCount *int `json:"installments_count,omitempty"`
// Unique code of the registered merchant to whom the payment is made.
MerchantCode *string `json:"merchant_code,omitempty"`
// Payment category recorded on a transaction, for example `POS` for a point-of-sale card payment, `ECOM` for
// an online card payment, or `RECURRING` for a recurring card payment. These reporting values are separate from
// the lowercase `payment_type` values used to process checkouts.
PaymentType *PaymentType `json:"payment_type,omitempty"`
// Current status of the transaction.
//
// - `PENDING`: The transaction has been created but its final outcome is not known yet.
// - `SUCCESSFUL`: The transaction completed successfully.
// - `CANCELLED`: The transaction was cancelled or otherwise reversed before completion.
// - `FAILED`: The transaction attempt did not complete successfully.
// - `REFUNDED`: The transaction was refunded in full or in part.
Status *TransactionStatus `json:"status,omitempty"`
// The timestamp of when the transaction was created.
Timestamp *time.Time `json:"timestamp,omitempty"`
// Tip included in the total transaction amount, in major units of the transaction's currency.
TipAmount *float32 `json:"tip_amount,omitempty"`
// SumUp transaction code, for example `TEENSK4W2K`. Use it to look up the transaction with the `transaction_code` query
// parameter. This is separate from the transaction's `id` and the card issuer's `auth_code`.
TransactionCode *string `json:"transaction_code,omitempty"`
// VAT included in the total transaction amount, in major units of the transaction's currency.
VATAmount *float32 `json:"vat_amount,omitempty"`
}
CheckoutsProcessCheckoutSuccessResponseTransaction is a schema definition.
type CheckoutsProcessParams ¶ added in v0.14.0
type CheckoutsProcessParams = ProcessCheckout
type CheckoutsProcessResponse ¶ added in v0.14.0
type CheckoutsProcessResponse struct {
CheckoutsProcessCheckoutSuccessResponse *CheckoutsProcessCheckoutSuccessResponse
CheckoutAccepted *CheckoutAccepted
}
func (*CheckoutsProcessResponse) AsCheckoutAccepted ¶ added in v0.14.0
func (r *CheckoutsProcessResponse) AsCheckoutAccepted() (*CheckoutAccepted, bool)
func (*CheckoutsProcessResponse) AsCheckoutsProcessCheckoutSuccessResponse ¶ added in v0.20.0
func (r *CheckoutsProcessResponse) AsCheckoutsProcessCheckoutSuccessResponse() (*CheckoutsProcessCheckoutSuccessResponse, bool)
type CheckoutsUpdateParams ¶ added in v0.17.1
type CheckoutsUpdateParams = CheckoutUpdateRequest
type ClassicMerchantIdentifiers ¶ added in v0.14.0
type ClassicMerchantIdentifiers struct {
// Classic (serial) merchant ID.
// Format: int64
// Deprecated: this operation is deprecated
ID int64 `json:"id"`
}
ClassicMerchantIdentifiers is a schema definition.
type Client ¶
type Client struct {
Checkouts *CheckoutsClient
Customers *CustomersClient
Members *MembersClient
Memberships *MembershipsClient
Merchants *MerchantsClient
Payouts *PayoutsClient
Readers *ReadersClient
Receipts *ReceiptsClient
Roles *RolesClient
Sales *SalesClient
Tokens *TokensClient
Transactions *TransactionsClient
// contains filtered or unexported fields
}
Example ¶
package main
import (
"context"
"log"
"os"
"github.com/sumup/sumup-go"
)
func main() {
client := sumup.NewClient()
merchant, err := client.Merchants.Get(context.Background(), os.Getenv("SUMUP_MERCHANT_CODE"))
if err != nil {
log.Printf("[ERROR] get merchant account: %v", err)
return
}
log.Printf("[INFO] business profile: %+v", merchant.BusinessProfile)
}
Output:
func NewClient ¶
func NewClient(opts ...client.ClientOption) *Client
NewClient creates new SumUp API client. The client is by default configured environment variables (`SUMUP_API_KEY`). To override the default configuration use [ClientOption]s.
func (*Client) EventsHandler ¶ added in v0.22.0
func (c *Client) EventsHandler(secret string, fallback EventCallback) (*EventsHandler, error)
EventsHandler creates a verified event receiver bound to this API client.
Example ¶
package main
import (
"context"
"log"
"os"
"github.com/sumup/sumup-go"
)
func main() {
c := sumup.NewClient()
h, err := c.EventsHandler(os.Getenv("SUMUP_EVENT_SECRET"), func(_ context.Context, event sumup.EventNotification) error {
log.Printf("unhandled event: %s", event.EventType())
return nil
})
if err != nil {
log.Fatal(err)
}
if err := h.OnMemberUpdated(func(ctx context.Context, event *sumup.MemberUpdatedEvent) error {
member, err := event.FetchObject(ctx)
if err != nil {
return err
}
log.Printf("member updated: %s", member.ID)
return nil
}); err != nil {
log.Fatal(err)
}
// In an HTTP receiver, limit and read the raw body, then call
// h.Handle(r.Context(), body, r.Header.Get(sumup.EventSignatureHeader)).
// Acknowledge only on success.
}
Output:
func (*Client) ParseEventNotification ¶ added in v0.22.0
func (c *Client) ParseEventNotification(secret string, payload []byte, signature string) (EventNotification, error)
ParseEventNotification verifies the signature and timestamp before parsing the exact raw body. Prefer Client.EventsHandler when using callback dispatch.
func (*Client) ParseEventNotificationWithoutVerification ¶ added in v0.22.0
func (c *Client) ParseEventNotificationWithoutVerification(payload []byte) (EventNotification, error)
ParseEventNotificationWithoutVerification skips signature verification. Use this for fixtures or payloads verified before being queued for later processing. Prefer Client.ParseEventNotification for incoming requests.
Example ¶
package main
import (
"fmt"
"log"
"github.com/sumup/sumup-go"
)
func main() {
c := sumup.NewClient()
event, err := c.ParseEventNotificationWithoutVerification([]byte(`{"id":"evt_123","type":"members.updated","created_at":"2026-04-11T10:00:00Z","object":{"id":"member_123","type":"member","url":"https://api.sumup.com/v0.1/merchants/MCODE/members/member_123"}}`))
if err != nil {
log.Fatal(err)
}
fmt.Println(event.EventID(), event.EventType())
}
Output: evt_123 members.updated
type Company ¶ added in v0.14.0
type Company struct {
// The company's primary address.
// Address documentation: https://developer.sumup.com/tools/glossary/address
Address *Address `json:"address,omitempty"`
// Object attributes that are modifiable only by SumUp applications.
Attributes Attributes `json:"attributes,omitempty"`
// A list of country-specific company identifiers.
Identifiers CompanyIdentifiers `json:"identifiers,omitempty"`
// The category identifying the legal structure of the company or legal entity.
// Min length: 4
// Max length: 64
// Pattern: ^[a-z]{2}\.[a-z_]+$
// The country SDK documentation for legal types.: https://developer.sumup.com/tools/glossary/merchant#legal-types
LegalType *LegalType `json:"legal_type,omitempty"`
// The merchant category code for the account as specified by [ISO18245](https://www.iso.org/standard/33365.html). MCCs
// are used to classify businesses based on the goods or services they provide.
// Pattern: ^[0-9]{4}$
MerchantCategoryCode *string `json:"merchant_category_code,omitempty"`
// The company's legal name.
// Min length: 1
// Max length: 150
Name *string `json:"name,omitempty"`
// The company's phone number (used for verification) in [E.164](https://en.wikipedia.org/wiki/E.164) format.
// Max length: 16
PhoneNumber *PhoneNumber `json:"phone_number,omitempty"`
// A trading address is where your suppliers, banks or customers send you correspondence to. Trading address can
// be different to the company's registered address (`address`).
// Address documentation: https://developer.sumup.com/tools/glossary/address
TradingAddress *Address `json:"trading_address,omitempty"`
// HTTP(S) URL of the company's website.
// Min length: 1
// Max length: 255
Website *string `json:"website,omitempty"`
}
Information about the company or business. This is legal information that is used for verification.
Company documentation: https://developer.sumup.com/tools/glossary/merchant#company
type CompanyIdentifier ¶ added in v0.14.0
type CompanyIdentifier struct {
// The unique reference for the company identifier type as defined in the country SDK.
// Pattern: ^[a-z]{2}\.[a-z_]+$
Ref string `json:"ref"`
// The company identifier value.
// Min length: 1
// Max length: 100
Value string `json:"value"`
}
CompanyIdentifier is a schema definition. Company identifier documentation: https://developer.sumup.com/tools/glossary/merchant#company-identifiers
type CompanyIdentifiers ¶ added in v0.14.0
type CompanyIdentifiers []CompanyIdentifier
A list of country-specific company identifiers.
type CountryCode ¶ added in v0.14.0
type CountryCode string
An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. This definition users `oneOf` with a two-character string type to allow for support of future countries in client code. Min length: 2 Max length: 2 Pattern: ^[A-Z]{2}$
type CreateCheckoutRequest ¶ added in v0.14.0
type CreateCheckoutRequest struct {
// Optional object containing data for transactions from ERP integrators in Greece that comply with the AADE
// 1155 protocol.
// When such regulatory/business requirements apply, this object must be provided and contains the data needed
// to validate the transaction with the AADE signature provider.
AADE *CreateCheckoutRequestAADE `json:"aade,omitempty"`
// Optional affiliate metadata associated with the checkout's payment.
// Provide both `app_id` and `key` when including this object.
Affiliate *nullable.Field[CreateCheckoutRequestAffiliate] `json:"affiliate,omitempty"`
// The card type of the card used for the transaction.
// It is required only for some countries (e.g: Brazil).
CardType *CreateCheckoutRequestCardType `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.
//
// Omit if the merchant country does not support installments.
// Otherwise, the checkout will be rejected.
// Min: 1
Installments *nullable.Field[int] `json:"installments,omitempty"`
// The payment method type for the transaction. Defaults to `card`.
//
// Use `pix` to initiate a Pix QR-code payment flow on the device.
// Pix is only supported for Brazilian merchants; other merchants will receive a 422 error.
// Default: card
PaymentType *CreateCheckoutRequestPaymentType `json:"payment_type,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"`
// Exactly three distinct tipping rates to be displayed to the cardholder.
// Each rate is a fraction between 0.01 and 1.00 in increments of 0.01.
// The rates are sorted in ascending order by the server.
// Unique items only
// Min items: 3
// Max items: 3
TipRates []float32 `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 CreateCheckoutRequestTotalAmount `json:"total_amount"`
}
Payment details for a Reader Checkout.
type CreateCheckoutRequestAADE ¶ added in v0.15.2
type CreateCheckoutRequestAADE struct {
// The identifier of the AADE signature provider.
ProviderID string `json:"provider_id"`
// The base64 encoded signature of the transaction data.
Signature string `json:"signature"`
// The string containing the signed transaction data.
SignatureData string `json:"signature_data"`
}
Optional object containing data for transactions from ERP integrators in Greece that comply with the AADE 1155 protocol. When such regulatory/business requirements apply, this object must be provided and contains the data needed to validate the transaction with the AADE signature provider.
type CreateCheckoutRequestAffiliate ¶ added in v0.14.0
type CreateCheckoutRequestAffiliate struct {
// Integrator application identifier from the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) page.
//
// Required when the affiliate object is provided.
AppID string `json:"app_id"`
// Integrator-owned transaction reference. Optional.
// Can be used to retrieve the transaction via the [Transactions API](https://developer.sumup.com/api/transactions/get).
ForeignTransactionID *string `json:"foreign_transaction_id,omitempty"`
// Affiliate key generated in the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) page.
// Required when the affiliate object is provided.
Key string `json:"key"`
// Optional key-value metadata associated with the transaction.
Tags CreateCheckoutRequestAffiliateTags `json:"tags,omitempty"`
}
Optional affiliate metadata associated with the checkout's payment. Provide both `app_id` and `key` when including this object.
type CreateCheckoutRequestAffiliateTags ¶ added in v0.14.0
Optional key-value metadata associated with the transaction.
type CreateCheckoutRequestCardType ¶ added in v0.14.0
type CreateCheckoutRequestCardType string
The card type of the card used for the transaction. It is required only for some countries (e.g: Brazil).
const ( CreateCheckoutRequestCardTypeCredit CreateCheckoutRequestCardType = "credit" CreateCheckoutRequestCardTypeDebit CreateCheckoutRequestCardType = "debit" )
type CreateCheckoutRequestPaymentType ¶ added in v0.21.0
type CreateCheckoutRequestPaymentType string
The payment method type for the transaction. Defaults to `card`.
Use `pix` to initiate a Pix QR-code payment flow on the device. Pix is only supported for Brazilian merchants; other merchants will receive a 422 error.
Default: card
const ( CreateCheckoutRequestPaymentTypeCard CreateCheckoutRequestPaymentType = "card" CreateCheckoutRequestPaymentTypePix CreateCheckoutRequestPaymentType = "pix" )
type CreateCheckoutRequestTotalAmount ¶ added in v0.14.0
type CreateCheckoutRequestTotalAmount 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"`
}
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.14.0
type CreateReaderCheckoutError struct {
Errors CreateReaderCheckoutErrorErrors `json:"errors"`
}
Error description
func (*CreateReaderCheckoutError) Error ¶ added in v0.14.0
func (e *CreateReaderCheckoutError) Error() string
type CreateReaderCheckoutErrorErrors ¶ added in v0.14.0
type CreateReaderCheckoutErrorErrors struct {
// Error message
Detail *string `json:"detail,omitempty"`
// Error code
Type string `json:"type"`
}
CreateReaderCheckoutErrorErrors is a schema definition.
type CreateReaderCheckoutResponse ¶ added in v0.14.0
type CreateReaderCheckoutResponse struct {
Data CreateReaderCheckoutResponseData `json:"data"`
}
CreateReaderCheckoutResponse is a schema definition.
type CreateReaderCheckoutResponseData ¶ added in v0.14.0
type CreateReaderCheckoutResponseData struct {
// The checkout ID is a unique identifier for the checkout.
CheckoutID *string `json:"checkout_id,omitempty"`
// Unique identifier for the transaction associated with this checkout.
// Use this value to match the checkout with payment events and transaction records.
ClientTransactionID string `json:"client_transaction_id"`
}
CreateReaderCheckoutResponseData is a schema definition.
type CreateReaderCheckoutUnprocessableEntity ¶ added in v0.14.0
type CreateReaderCheckoutUnprocessableEntity struct {
Errors CreateReaderCheckoutUnprocessableEntityErrors `json:"errors"`
}
Unprocessable entity
func (*CreateReaderCheckoutUnprocessableEntity) Error ¶ added in v0.14.0
func (e *CreateReaderCheckoutUnprocessableEntity) Error() string
type CreateReaderCheckoutUnprocessableEntityErrors ¶ added in v0.14.0
CreateReaderCheckoutUnprocessableEntityErrors is a schema definition.
type CreateReaderTerminateError ¶ added in v0.14.0
type CreateReaderTerminateError struct {
Errors CreateReaderTerminateErrorErrors `json:"errors"`
}
Error description
func (*CreateReaderTerminateError) Error ¶ added in v0.14.0
func (e *CreateReaderTerminateError) Error() string
type CreateReaderTerminateErrorErrors ¶ added in v0.14.0
type CreateReaderTerminateErrorErrors struct {
// Error message
Detail *string `json:"detail,omitempty"`
// Error code
Type string `json:"type"`
}
CreateReaderTerminateErrorErrors is a schema definition.
type CreateReaderTerminateUnprocessableEntity ¶ added in v0.14.0
type CreateReaderTerminateUnprocessableEntity struct {
Errors CreateReaderTerminateUnprocessableEntityErrors `json:"errors"`
}
Unprocessable entity
func (*CreateReaderTerminateUnprocessableEntity) Error ¶ added in v0.14.0
func (e *CreateReaderTerminateUnprocessableEntity) Error() string
type CreateReaderTerminateUnprocessableEntityErrors ¶ added in v0.14.0
CreateReaderTerminateUnprocessableEntityErrors is a schema definition.
type Currency ¶ added in v0.14.0
type Currency string
Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
const ( CurrencyBRL Currency = "BRL" CurrencyCHF Currency = "CHF" CurrencyCLP Currency = "CLP" CurrencyCZK Currency = "CZK" CurrencyCop Currency = "COP" CurrencyDKK Currency = "DKK" CurrencyEUR Currency = "EUR" CurrencyGBP Currency = "GBP" CurrencyHRK Currency = "HRK" CurrencyHUF Currency = "HUF" CurrencyNOK Currency = "NOK" CurrencyPLN Currency = "PLN" CurrencyRON Currency = "RON" CurrencySEK Currency = "SEK" CurrencyUSD Currency = "USD" )
type Customer ¶ added in v0.14.0
type Customer struct {
// Identifier you supply when creating the customer. Use an ID from your own system and retain it for subsequent customer,
// checkout, and saved-payment-instrument requests.
CustomerID string `json:"customer_id"`
// Personal details for the customer.
PersonalDetails *PersonalDetails `json:"personal_details,omitempty"`
}
Saved payer details identified by the `customer_id` supplied by your integration. A customer can have saved payment instruments for subsequent payments.
type CustomerValidationError ¶ added in v0.21.0
type CustomerValidationError struct {
// Platform code for the error.
ErrorCode string `json:"error_code"`
// Short description of the error.
ErrorMessage string `json:"error_message"`
// Unique identifier of this error occurrence.
Instance string `json:"instance"`
}
Details of a customer validation error.
type CustomersClient ¶ added in v0.14.0
type CustomersClient struct {
// contains filtered or unexported fields
}
CustomersClient provides access to the Customers API.
Customers represent payers in your integration. Create a customer with your own `customer_id` to associate their personal details and saved payment instruments with your business records.
To save a card, create a checkout for that customer with `purpose = SETUP_RECURRING_PAYMENT`, then process it with the payer's consent and mandate details. See the [tokenization guide](https://developer.sumup.com/online-payments/guides/tokenization-with-payment-sdk/).
Use the Customers endpoints to create, retrieve, or update customer details and to list or deactivate saved payment instruments. For subsequent payments, process a new checkout with the saved instrument's `token` and its associated `customer_id`.
func NewCustomersClient ¶ added in v0.14.0
func NewCustomersClient(c *client.Client) *CustomersClient
func (*CustomersClient) Create ¶ added in v0.14.0
func (c *CustomersClient) Create(ctx context.Context, body CustomersCreateParams) (*Customer, error)
Creates a customer using the `customer_id` you supply. Choose an identifier that maps to the payer in your own system and reuse it when retrieving the customer or associating checkouts and saved payment instruments with them.
func (*CustomersClient) DeactivatePaymentInstrument ¶ added in v0.14.0
func (c *CustomersClient) DeactivatePaymentInstrument(ctx context.Context, customerID string, token string) error
Deactivates an identified card payment instrument resource for a customer.
func (*CustomersClient) Get ¶ added in v0.14.0
Retrieves a saved customer using the `customer_id` you supplied when creating the customer.
func (*CustomersClient) ListPaymentInstruments ¶ added in v0.14.0
func (c *CustomersClient) ListPaymentInstruments(ctx context.Context, customerID string) (*CustomersListPaymentInstrumentsResponse, error)
Lists all payment instrument resources that are saved for an identified customer.
func (*CustomersClient) Update ¶ added in v0.14.0
func (c *CustomersClient) Update(ctx context.Context, customerID string, body CustomersUpdateParams) (*Customer, error)
Updates an identified saved customer resource's personal details.
The request only overwrites the parameters included in the request, all other parameters will remain with their initially assigned values.
type CustomersCreate400Response ¶ added in v0.15.1
type CustomersCreate400Response json.RawMessage
CustomersCreate400Response is a schema definition.
func (*CustomersCreate400Response) Error ¶ added in v0.15.1
func (e *CustomersCreate400Response) Error() string
type CustomersCreateParams ¶ added in v0.14.0
type CustomersCreateParams = Customer
type CustomersListPaymentInstrumentsResponse ¶ added in v0.14.0
type CustomersListPaymentInstrumentsResponse []PaymentInstrumentResponse
CustomersListPaymentInstrumentsResponse is a schema definition.
type CustomersUpdateParams ¶ added in v0.14.0
type CustomersUpdateParams struct {
// Personal details for the customer.
PersonalDetails *PersonalDetails `json:"personal_details,omitempty"`
}
CustomersUpdateParams is a schema definition.
type DetailsError ¶ added in v0.14.0
type DetailsError struct {
// Details of the error.
Details *string `json:"details,omitempty"`
// List of violated validation constraints.
FailedConstraints []DetailsErrorFailedConstraint `json:"failed_constraints,omitempty"`
// HTTP status code for the error.
Status *float64 `json:"status,omitempty"`
// Short title of the error.
Title *string `json:"title,omitempty"`
}
Details of a request validation error.
func (*DetailsError) Error ¶ added in v0.14.0
func (e *DetailsError) Error() string
type DetailsErrorFailedConstraint ¶ added in v0.14.0
type DetailsErrorFailedConstraint struct {
// Human-readable description of the violated constraint.
Message *string `json:"message,omitempty"`
// Name of the field that violated the constraint.
Reference *string `json:"reference,omitempty"`
}
DetailsErrorFailedConstraint is a schema definition.
type Device ¶ added in v0.15.1
type Device struct {
// Device model.
Model *string `json:"model,omitempty"`
// Device name.
Name *string `json:"name,omitempty"`
// Device OS.
SystemName *string `json:"system_name,omitempty"`
// Device OS version.
SystemVersion *string `json:"system_version,omitempty"`
// Device UUID.
UUID *string `json:"uuid,omitempty"`
}
Details of the device used to create the transaction.
type DiscountApplicationMode ¶ added in v0.22.0
type DiscountApplicationMode string
Method of applying the discount to the items or cart.
const ( DiscountApplicationModeAutomatic DiscountApplicationMode = "AUTOMATIC" DiscountApplicationModeManual DiscountApplicationMode = "MANUAL" )
type DiscountClas ¶ added in v0.22.0
type DiscountClas string
The method used to target items to discount. Must be populated for ITEM level discounts, and must be null for CART level discounts (CART level targets all
items, therefore none of these categories apply).
const ( DiscountClasBundle DiscountClas = "BUNDLE" DiscountClasBuyXGetY DiscountClas = "BUY_X_GET_Y" DiscountClasCategory DiscountClas = "CATEGORY" DiscountClasItem DiscountClas = "ITEM" DiscountClasMealDeal DiscountClas = "MEAL_DEAL" )
type DiscountLevel ¶ added in v0.22.0
type DiscountLevel string
Specifies where discount was applied by user (either merchant or consumer): - CART: Applied to the whole cart (calculated and distributed per sale item) - ITEM: Applied to specific sale item
*Accepted values:* ["ITEM", "CART"]. Min length: 4 Max length: 4
type DiscountLine ¶ added in v0.22.0
type DiscountLine struct {
// A description or reason of the discount.
// Max length: 250
Description *string `json:"description,omitempty"`
// The gross amount of the discount.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
// Format: int64
// Min: 0
GrossAmount PositiveAmount `json:"gross_amount"`
// An id used to associate a discount line with a specific discount.
// Since we can apply multiple discounts (e.g. 2x 10% whole cart off)
// we need to be able to identify which discount line belongs to which cart discount.
// Recommended to use UUID identifiers.
// Max length: 100
ID *string `json:"id,omitempty"`
// Specifies where discount was applied by user (either merchant or consumer):
// - CART: Applied to the whole cart (calculated and distributed per sale item)
// - ITEM: Applied to specific sale item
//
// *Accepted values:* ["ITEM", "CART"].
// Min length: 4
// Max length: 4
Level DiscountLevel `json:"level"`
// The net amount of the discount.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
// Format: int64
// Min: 0
NetAmount PositiveAmount `json:"net_amount"`
// The source of discount. Exactly one property must be set.
Source DiscountSource `json:"source"`
// The tax amount of the discount.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
// Format: int64
// Min: 0
TaxAmount PositiveAmount `json:"tax_amount"`
// The value type of the discount, either a percentage based or absolute monetary value.
//
// It is required that only one of the following is set:
// - absolute
// - percentage.
Value DiscountValue `json:"value"`
}
Object representing information about single discount line.
type DiscountSource ¶ added in v0.22.0
type DiscountSource struct {
// Discount created ad-hoc on device during checkout.
AdHoc *DiscountSourceAdHoc `json:"ad_hoc,omitempty"`
// Preset discount applied manually on the POS.
Basic *DiscountSourceBasic `json:"basic,omitempty"`
// Discount applied manually when entering a coupon code at checkout.
Coupon *DiscountSourceCoupon `json:"coupon,omitempty"`
// Discount applied when redeeming a reward from the merchant's loyalty scheme.
Loyalty *DiscountSourceLoyalty `json:"loyalty,omitempty"`
// Discount applied automatically when cart is updated based on preset promotions.
Offer *DiscountSourceOffer `json:"offer,omitempty"`
}
The source of discount. Exactly one property must be set.
type DiscountSourceAdHoc ¶ added in v0.22.0
type DiscountSourceAdHoc struct {
// The description of the ad-hoc discount.
// Max length: 250
Description *string `json:"description,omitempty"`
// The unique identifier of the ad-hoc discount.
// Format: uuid
ID *string `json:"id,omitempty"`
// The name of the ad-hoc discount.
// Max length: 100
Name *string `json:"name,omitempty"`
}
Discount created ad-hoc on device during checkout.
type DiscountSourceBasic ¶ added in v0.22.0
type DiscountSourceBasic struct {
// Method of applying the discount to the items or cart.
ApplicationMode DiscountApplicationMode `json:"application_mode"`
// The description of the loyalty discount.
// Max length: 250
Description *nullable.Field[string] `json:"description,omitempty"`
// The unique identifier of the basic discount.
// Format: uuid
ID string `json:"id"`
// The name of the basic discount.
// Max length: 100
Name string `json:"name"`
}
Preset discount applied manually on the POS.
type DiscountSourceCoupon ¶ added in v0.22.0
type DiscountSourceCoupon struct {
// Method of applying the discount to the items or cart.
ApplicationMode DiscountApplicationMode `json:"application_mode"`
// The coupon code.
// Max length: 100
Code string `json:"code"`
// The description of the coupon discount.
// Max length: 250
Description *nullable.Field[string] `json:"description,omitempty"`
// The method used to target items to discount.
// Must be populated for ITEM level discounts, and must be null for CART level discounts (CART level targets all
//
// items, therefore none of these categories apply).
DiscountClass *nullable.Field[DiscountClas] `json:"discount_class,omitempty"`
// The unique identifier of the coupon discount.
// Format: uuid
ID string `json:"id"`
// The name of the coupon discount.
// Max length: 100
Name string `json:"name"`
}
Discount applied manually when entering a coupon code at checkout.
type DiscountSourceLoyalty ¶ added in v0.22.0
type DiscountSourceLoyalty struct {
// Method of applying the discount to the items or cart.
ApplicationMode DiscountApplicationMode `json:"application_mode"`
// The description of the loyalty discount.
// Max length: 250
Description *nullable.Field[string] `json:"description,omitempty"`
// The method used to target items to discount.
// Must be populated for ITEM level discounts, and must be null for CART level discounts (CART level targets all
//
// items, therefore none of these categories apply).
DiscountClass *nullable.Field[DiscountClas] `json:"discount_class,omitempty"`
// The unique identifier of the promotion or reward.
// Format: uuid
ID string `json:"id"`
// The type of loyalty discount, either a promotion (e.g. new customer discount) or a reward (free coffee after
// completing stamp card).
LoyaltyType DiscountSourceLoyaltyType `json:"loyalty_type"`
// The name of the loyalty discount.
// Max length: 100
Name string `json:"name"`
// The number of points used for this loyalty discount.
// Must be a positive integer if the scheme type is POINTS.
// Must not be populated if the scheme type is STAMPS.
// Format: int64
// Min: 1
Points *nullable.Field[int64] `json:"points,omitempty"`
// The scheme type of the loyalty program.
SchemeType DiscountSourceLoyaltySchemeType `json:"scheme_type"`
}
Discount applied when redeeming a reward from the merchant's loyalty scheme.
type DiscountSourceLoyaltySchemeType ¶ added in v0.22.0
type DiscountSourceLoyaltySchemeType string
The scheme type of the loyalty program.
const ( DiscountSourceLoyaltySchemeTypePoints DiscountSourceLoyaltySchemeType = "POINTS" DiscountSourceLoyaltySchemeTypeStamps DiscountSourceLoyaltySchemeType = "STAMPS" )
type DiscountSourceLoyaltyType ¶ added in v0.22.0
type DiscountSourceLoyaltyType string
The type of loyalty discount, either a promotion (e.g. new customer discount) or a reward (free coffee after completing stamp card).
const ( DiscountSourceLoyaltyTypePromotion DiscountSourceLoyaltyType = "PROMOTION" DiscountSourceLoyaltyTypeReward DiscountSourceLoyaltyType = "REWARD" )
type DiscountSourceOffer ¶ added in v0.22.0
type DiscountSourceOffer struct {
// Method of applying the discount to the items or cart.
ApplicationMode DiscountApplicationMode `json:"application_mode"`
// The description of the offer discount.
// Max length: 250
Description *nullable.Field[string] `json:"description,omitempty"`
// The method used to target items to discount.
// Must be populated for ITEM level discounts, and must be null for CART level discounts (CART level targets all
//
// items, therefore none of these categories apply).
DiscountClass *nullable.Field[DiscountClas] `json:"discount_class,omitempty"`
// The unique identifier of the offer discount.
// Format: uuid
ID string `json:"id"`
// The name of the offer discount.
// Max length: 100
Name string `json:"name"`
}
Discount applied automatically when cart is updated based on preset promotions.
type DiscountValue ¶ added in v0.22.0
type DiscountValue struct {
// The absolute value in minor units of the currency according to the Sale.currency.scale.
// Example: 10000 = 10.00
// Format: int64
// Min: 0
Absolute *PositiveAmount `json:"absolute,omitempty"`
// The percentage in minor units (1/100000).
//
// Examples:
// - 10% -> 0.10 (decimal) = 10000 (minor units)
// - 15.5% -> 0.155 (decimal) = 15500 (minor units)
// - 0.001% -> 0.00001 (decimal) = 1 (minor units)
// Format: int64
// Min: 0
Percentage *int64 `json:"percentage,omitempty"`
}
The value type of the discount, either a percentage based or absolute monetary value.
It is required that only one of the following is set: - absolute - percentage.
type ElvCardAccount ¶ added in v0.15.1
type ElvCardAccount struct {
// ELV IBAN.
IBAN *string `json:"iban,omitempty"`
// ELV card account number last 4 digits.
Last4Digits *string `json:"last_4_digits,omitempty"`
// ELV card sequence number.
SequenceNo *int `json:"sequence_no,omitempty"`
// ELV card sort code.
SortCode *string `json:"sort_code,omitempty"`
}
Details of the ELV card account associated with the transaction.
type EntryMode ¶ added in v0.14.0
type EntryMode string
How the payment details were captured, for example `CHIP` or `CONTACTLESS` for card-present payments and `CUSTOMER_ENTRY` for card details entered by the payer. For wallet and alternative payment methods, this can identify the method, such as `APPLE_PAY` or `BLIK`.
const ( EntryModeApplePay EntryMode = "APPLE_PAY" EntryModeBancontact EntryMode = "BANCONTACT" EntryModeBlik EntryMode = "BLIK" EntryModeBoleto EntryMode = "BOLETO" EntryModeChip EntryMode = "CHIP" EntryModeContactless EntryMode = "CONTACTLESS" EntryModeContactlessMagstripe EntryMode = "CONTACTLESS_MAGSTRIPE" EntryModeCustomerEntry EntryMode = "CUSTOMER_ENTRY" EntryModeDirectDebit EntryMode = "DIRECT_DEBIT" EntryModeEps EntryMode = "EPS" EntryModeGiropay EntryMode = "GIROPAY" EntryModeGooglePay EntryMode = "GOOGLE_PAY" EntryModeIdeal EntryMode = "IDEAL" EntryModeMagstripe EntryMode = "MAGSTRIPE" EntryModeMagstripeFallback EntryMode = "MAGSTRIPE_FALLBACK" EntryModeManualEntry EntryMode = "MANUAL_ENTRY" EntryModeMoto EntryMode = "MOTO" EntryModeMybank EntryMode = "MYBANK" EntryModeNA EntryMode = "N/A" EntryModeNone EntryMode = "NONE" EntryModeP24 EntryMode = "P24" EntryModePaypal EntryMode = "PAYPAL" EntryModePix EntryMode = "PIX" EntryModeQrCodePix EntryMode = "QR_CODE_PIX" EntryModeSatispay EntryMode = "SATISPAY" EntryModeSofort EntryMode = "SOFORT" EntryModeTwint EntryMode = "TWINT" )
type Error ¶ added in v0.14.0
type Error struct {
// Platform code for the error.
ErrorCode *string `json:"error_code,omitempty"`
// Short description of the error.
Message *string `json:"message,omitempty"`
}
Details of an API error.
type ErrorExtended ¶ added in v0.14.0
type ErrorExtended struct {
// Platform code for the error.
ErrorCode *string `json:"error_code,omitempty"`
// Short description of the error.
Message *string `json:"message,omitempty"`
// Parameter name (with relative location) to which the error applies. Parameters from embedded resources are
// displayed using dot notation. For example, `card.name` refers to the `name` parameter embedded in the `card`
// object.
Param *string `json:"param,omitempty"`
}
Error payload with the invalid parameter reference.
func (*ErrorExtended) Error ¶ added in v0.14.0
func (e *ErrorExtended) Error() string
type ErrorForbidden ¶ added in v0.14.0
type ErrorForbidden struct {
// Platform code for the error.
ErrorCode *string `json:"error_code,omitempty"`
// Short description of the error.
ErrorMessage *string `json:"error_message,omitempty"`
// HTTP status code for the error.
StatusCode *string `json:"status_code,omitempty"`
}
Details of an error returned for a forbidden request.
func (*ErrorForbidden) Error ¶ added in v0.14.0
func (e *ErrorForbidden) Error() string
type Event ¶ added in v0.14.0
type Event struct {
// Amount associated with the transaction event, in major units.
Amount *float32 `json:"amount,omitempty"`
// Amount deducted from the merchant for the event, in major units.
DeductedAmount *float32 `json:"deducted_amount,omitempty"`
// Fee deducted from the merchant for the event, in major units.
DeductedFeeAmount *float32 `json:"deducted_fee_amount,omitempty"`
// Fee associated with the transaction event, in major units.
FeeAmount *float32 `json:"fee_amount,omitempty"`
// Numeric identifier of a transaction event. Use it as `tx_event_id` when requesting receipt details for a
// specific event. This is separate from the transaction ID and the transaction history pagination references.
// Format: int64
ID *TransactionEventID `json:"id,omitempty"`
// Consecutive number of the installment associated with the event.
InstallmentNumber *int `json:"installment_number,omitempty"`
// Status of the transaction event.
//
// Not every value is used for every event type.
//
// - `PENDING`: The event has been created but is not final yet. Used for events that are still being processed and
// whose final outcome is not known yet.
// - `SCHEDULED`: The event is planned for a future payout cycle but has not been executed yet. This applies to
// payout events before money is actually sent out.
// - `RECONCILED`: The underlying payment has been matched with settlement data and is ready to continue through
// payout processing, but the funds have not been paid out yet. This applies to payout events.
// - `PAID_OUT`: The payout event has been completed and the funds were included in a merchant payout.
// - `REFUNDED`: A refund event has been accepted and recorded in the refund flow. This is the status returned for
// refund events once the transaction amount is being or has been returned to the payer.
// - `SUCCESSFUL`: The event completed successfully. Use this as the generic terminal success status for event
// types that do not expose a more specific business outcome such as `PAID_OUT` or `REFUNDED`.
// - `FAILED`: The event could not be completed. Typical examples are a payout that could not be executed or
// an event that was rejected during processing.
Status *TransactionEventStatus `json:"status,omitempty"`
// The timestamp of when the transaction event occurred.
Timestamp *time.Time `json:"timestamp,omitempty"`
// Unique identifier of the transaction.
TransactionID *TransactionID `json:"transaction_id,omitempty"`
// Financial event associated with a transaction.
//
// - `PAYOUT`: Funds from the transaction being prepared for or included in a merchant payout. Check the event
// status to determine whether they have been paid out.
// - `REFUND`: Money returned to the payer.
// - `CHARGE_BACK`: A reversal of the payment following a chargeback.
// - `PAYOUT_DEDUCTION`: An amount deducted from a merchant payout, for example to cover a refund or chargeback.
Type *TransactionEventType `json:"type,omitempty"`
}
High-level transaction event details.
type EventCallback ¶ added in v0.22.0
type EventCallback func(context.Context, EventNotification) error
EventCallback handles notifications without a dedicated typed callback. The context is the caller's context. Events retain the handler's client for fetching resources. Callbacks may run concurrently and should return errors to allow delivery retries.
type EventCallbackError ¶ added in v0.22.0
type EventCallbackError struct{ Err error }
EventCallbackError distinguishes callback failures from invalid requests. HTTP receivers should return a 5xx response so failed processing can be retried.
func (*EventCallbackError) Error ¶ added in v0.22.0
func (e *EventCallbackError) Error() string
func (*EventCallbackError) Unwrap ¶ added in v0.22.0
func (e *EventCallbackError) Unwrap() error
type EventNotification ¶ added in v0.22.0
type EventNotification interface {
EventID() string
EventType() string
// contains filtered or unexported methods
}
EventNotification is a known or unknown SumUp notification. Use a type switch to access a specific event, or register typed callbacks with EventsHandler.
type EventObject ¶ added in v0.22.0
type EventObject struct {
// ID identifies the referenced resource.
ID string `json:"id"`
// Type is the resource kind, such as member or reader.
Type string `json:"type"`
// URL is the absolute API URL for fetching the resource.
URL string `json:"url"`
}
EventObject references the API resource affected by a notification.
type EventsHandler ¶ added in v0.22.0
type EventsHandler struct {
// contains filtered or unexported fields
}
EventsHandler verifies, parses, and dispatches notifications. Register typed callbacks using the generated On methods. Known events without a callback and unknown event types go to the required fallback callback.
Handling and registration are safe concurrently. Callbacks run synchronously without the registration lock held; they must synchronize their own shared state. An EventsHandler must not be copied after first use.
func NewEventsHandler ¶ added in v0.22.0
func NewEventsHandler(client *Client, secret string, fallback EventCallback) (*EventsHandler, error)
NewEventsHandler creates a verified event receiver. Client, signing secret, and fallback are required. No environment variables are read implicitly.
func (*EventsHandler) GoString ¶ added in v0.22.0
func (h *EventsHandler) GoString() string
GoString also masks secrets when the handler is formatted with %#v.
func (*EventsHandler) Handle ¶ added in v0.22.0
Handle verifies and dispatches an exact raw body. Never reserialize the body before calling this method. The caller owns reading and limiting the request body. Context cancellation propagates to the callback.
func (*EventsHandler) OnCheckoutCreated ¶ added in v0.22.0
func (h *EventsHandler) OnCheckoutCreated(callback func(context.Context, *CheckoutCreatedEvent) error) error
OnCheckoutCreated registers a callback for checkouts.created notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnCheckoutExpired ¶ added in v0.22.0
func (h *EventsHandler) OnCheckoutExpired(callback func(context.Context, *CheckoutExpiredEvent) error) error
OnCheckoutExpired registers a callback for checkouts.expired notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnCheckoutFailed ¶ added in v0.22.0
func (h *EventsHandler) OnCheckoutFailed(callback func(context.Context, *CheckoutFailedEvent) error) error
OnCheckoutFailed registers a callback for checkouts.failed notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnCheckoutPaid ¶ added in v0.22.0
func (h *EventsHandler) OnCheckoutPaid(callback func(context.Context, *CheckoutPaidEvent) error) error
OnCheckoutPaid registers a callback for checkouts.paid notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnCheckoutUpdated ¶ added in v0.22.0
func (h *EventsHandler) OnCheckoutUpdated(callback func(context.Context, *CheckoutUpdatedEvent) error) error
OnCheckoutUpdated registers a callback for checkouts.updated notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnMemberCreated ¶ added in v0.22.0
func (h *EventsHandler) OnMemberCreated(callback func(context.Context, *MemberCreatedEvent) error) error
OnMemberCreated registers a callback for members.created notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnMemberDeleted ¶ added in v0.22.0
func (h *EventsHandler) OnMemberDeleted(callback func(context.Context, *MemberDeletedEvent) error) error
OnMemberDeleted registers a callback for members.deleted notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnMemberUpdated ¶ added in v0.22.0
func (h *EventsHandler) OnMemberUpdated(callback func(context.Context, *MemberUpdatedEvent) error) error
OnMemberUpdated registers a callback for members.updated notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnReaderCreated ¶ added in v0.22.0
func (h *EventsHandler) OnReaderCreated(callback func(context.Context, *ReaderCreatedEvent) error) error
OnReaderCreated registers a callback for readers.created notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnReaderDeleted ¶ added in v0.22.0
func (h *EventsHandler) OnReaderDeleted(callback func(context.Context, *ReaderDeletedEvent) error) error
OnReaderDeleted registers a callback for readers.deleted notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnRoleCreated ¶ added in v0.22.0
func (h *EventsHandler) OnRoleCreated(callback func(context.Context, *RoleCreatedEvent) error) error
OnRoleCreated registers a callback for roles.created notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnRoleDeleted ¶ added in v0.22.0
func (h *EventsHandler) OnRoleDeleted(callback func(context.Context, *RoleDeletedEvent) error) error
OnRoleDeleted registers a callback for roles.deleted notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) OnRoleUpdated ¶ added in v0.22.0
func (h *EventsHandler) OnRoleUpdated(callback func(context.Context, *RoleUpdatedEvent) error) error
OnRoleUpdated registers a callback for roles.updated notifications. It rejects nil callbacks and duplicate registrations. Registration is safe during handling.
func (*EventsHandler) Parse ¶ added in v0.22.0
func (h *EventsHandler) Parse(payload []byte, signature string) (EventNotification, error)
Parse verifies and parses an event without invoking callbacks.
func (*EventsHandler) String ¶ added in v0.22.0
func (h *EventsHandler) String() string
String describes registered callbacks without exposing the signing secret.
type FeatureV10 ¶ added in v0.22.0
type FeatureV10 struct {
// The feature name/key.
// Max length: 100
Name string `json:"name"`
// The feature value in canonical string form, to be parsed per `value_type`
// (e.g. INTEGER -> "3", DECIMAL -> "1.50", DATE -> "2026-07-02",
// BOOLEAN -> "true"). Carrying it as a string keeps the wire format stable as
// new feature names and value types are introduced.
// Max length: 1000
Value string `json:"value"`
// The data type of a feature value. The wire `value` is always a string and is parsed
// according to this type.
ValueType FeatureValueTypeV10 `json:"value_type"`
}
A named, typed characteristic of a line. New item types add data here instead of a typed sub-object per type.
Examples by item type (illustrative, not exhaustive):
- DEPOSIT: `operation_type` = "SALE", `linked_line_id` = "line-1"
- GIFT_CARD: `gift_card_reference` = "GCMINGXPC5"
- CATALOG: `variant_name` = "Large", `item_id` / `variant_id` (TEXT), `reporting_category_id` = "cat-..."
- FEE: `fee_type` = "SHIPPING" (required); optional `fee_id`, `value_absolute` or `value_percentage`, and per-type metadata features such as `delivery_name` / `tracking_reference` (shipping), `card_type` / `scheme` (surcharge), or `policy_id` (cancellation)
- (future) SUBSCRIPTION: `billing_period` = "P1M", `renews_at` = "2026-07-02"
Conventional `FEE` feature keys:
- `fee_type` (TEXT, required): `SHIPPING`, `SURCHARGE`, `SERVICE_CHARGE`, or `CANCELLATION`
- `fee_id` (TEXT, optional): identifier of the fee definition
- `value_absolute` (INTEGER, optional): configured absolute value in minor units of the sale currency (the charged amount is on `price`)
- `value_percentage` (INTEGER, optional): configured percentage in minor units (1/100000; e.g. 10000 = 10%)
- Per-type metadata (optional, TEXT unless noted): `delivery_name`, `tracking_reference` (shipping); `card_type`, `scheme` (surcharge); `policy_id` (cancellation)
type FeatureValueTypeV10 ¶ added in v0.22.0
type FeatureValueTypeV10 string
The data type of a feature value. The wire `value` is always a string and is parsed according to this type.
const ( FeatureValueTypeV10Boolean FeatureValueTypeV10 = "BOOLEAN" FeatureValueTypeV10Date FeatureValueTypeV10 = "DATE" FeatureValueTypeV10Decimal FeatureValueTypeV10 = "DECIMAL" FeatureValueTypeV10Integer FeatureValueTypeV10 = "INTEGER" FeatureValueTypeV10Text FeatureValueTypeV10 = "TEXT" )
type FinalPriceAmounts ¶ added in v0.22.0
type FinalPriceAmounts struct {
// Discounts applied.
//
// Important:
// Discount amounts shouldn't take effect on net and gross amounts.
//
// Discount money amounts depend on where discount was applied:
// - for item level discount: whole discount money amount is applied
// - for cart level discount: only part of the whole amount is applied
// (discount money value is split on each line item)
// Max items: 1000
Discounts []DiscountLine `json:"discounts,omitempty"`
// Taxes applied on top of `total_net_amount_final` amount resulting in `total_gross_amount_final` amount.
// If no discounts are applied, it should be equal to `taxes`.
// Min items: 1
// Max items: 1000
TaxesFinal []PositiveTaxLine `json:"taxes_final"`
// The final gross amount includes discounts, modifiers, and taxes. If no discounts are applied, it should be
// equal to total_gross_amount.
// Format: int64
// Min: 0
TotalGrossAmountFinal PositiveAmount `json:"total_gross_amount_final"`
// The final net amount includes discounts and modifiers. It does NOT include taxes. If no discounts are applied,
// it should be equal to total_net_amount.
// Format: int64
// Min: 0
TotalNetAmountFinal PositiveAmount `json:"total_net_amount_final"`
}
Final price amounts after all calculations and adjustments.
type FinancialPayout ¶ added in v0.14.0
type FinancialPayout struct {
// Amount of the payout or deduction in major units.
Amount float32 `json:"amount"`
// Three-letter ISO 4217 currency code of the payout.
Currency string `json:"currency"`
// Payout date associated with the record, in `YYYY-MM-DD` format.
// Format: date
Date datetime.Date `json:"date"`
// Fee amount associated with the payout record, in major units.
Fee float32 `json:"fee"`
// Unique identifier of the payout-related record.
// Format: int64
ID int64 `json:"id"`
// Processor or payout reference associated with the record.
Reference string `json:"reference"`
// Merchant-facing outcome of the payout record.
Status FinancialPayoutStatus `json:"status"`
// Transaction code of the original sale associated with the payout or deduction.
TransactionCode string `json:"transaction_code"`
// High-level payout record category.
Type FinancialPayoutType `json:"type"`
}
A single payout-related record.
A record can represent either: - an actual payout sent to the merchant (`type = PAYOUT`) - a deduction applied against merchant funds for a refund, chargeback, direct debit return, or balance adjustment
type FinancialPayoutStatus ¶ added in v0.14.0
type FinancialPayoutStatus string
Merchant-facing outcome of the payout record.
const ( FinancialPayoutStatusFailed FinancialPayoutStatus = "FAILED" FinancialPayoutStatusSuccessful FinancialPayoutStatus = "SUCCESSFUL" )
type FinancialPayoutType ¶ added in v0.14.0
type FinancialPayoutType string
High-level payout record category.
const ( FinancialPayoutTypeBalanceDeduction FinancialPayoutType = "BALANCE_DEDUCTION" FinancialPayoutTypeChargeBackDeduction FinancialPayoutType = "CHARGE_BACK_DEDUCTION" FinancialPayoutTypeDdReturnDeduction FinancialPayoutType = "DD_RETURN_DEDUCTION" FinancialPayoutTypePayout FinancialPayoutType = "PAYOUT" FinancialPayoutTypeRefundDeduction FinancialPayoutType = "REFUND_DEDUCTION" )
type FinancialPayouts ¶ added in v0.14.0
type FinancialPayouts []FinancialPayout
Ordered list of payout and payout-deduction records.
type GetReaderCheckoutResponse ¶ added in v0.18.0
type GetReaderCheckoutResponse struct {
Data GetReaderCheckoutResponseData `json:"data"`
}
GetReaderCheckoutResponse is a schema definition.
type GetReaderCheckoutResponseData ¶ added in v0.18.0
type GetReaderCheckoutResponseData struct {
// Type of the card, or null when no card type was specified.
CardType nullable.Field[GetReaderCheckoutResponseDataCardType] `json:"card_type"`
// Unique identifier for the checkout
// Format: uuid
CheckoutID string `json:"checkout_id"`
// Client transaction identifier associated with the checkout
ClientTransactionID string `json:"client_transaction_id"`
// Checkout creation timestamp
CreatedAt time.Time `json:"created_at"`
// Number of installments for the transaction. Required for some countries.
Installments nullable.Field[int] `json:"installments"`
// Reason for the payment failure, or null when no failure reason is available.
PaymentFailureReason nullable.Field[string] `json:"payment_failure_reason"`
// Status of the payment, or null when no payment status is available.
PaymentStatus nullable.Field[string] `json:"payment_status"`
// Type of the payment. Required for some countries
PaymentType GetReaderCheckoutResponseDataPaymentType `json:"payment_type"`
// Reader firmware version
ReaderFirmwareVersion string `json:"reader_firmware_version"`
// Device serial number
ReaderSerialNumber string `json:"reader_serial_number"`
// Current status of the checkout
Status GetReaderCheckoutResponseDataStatus `json:"status"`
// 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 GetReaderCheckoutResponseDataTotalAmount `json:"total_amount"`
// Checkout last update timestamp
UpdatedAt time.Time `json:"updated_at"`
// Checkout expiration timestamp. After this time, the checkout will be automatically cancelled.
ValidUntil nullable.Field[time.Time] `json:"valid_until"`
}
GetReaderCheckoutResponseData is a schema definition.
type GetReaderCheckoutResponseDataCardType ¶ added in v0.18.0
type GetReaderCheckoutResponseDataCardType string
Type of the card, or null when no card type was specified.
const ( GetReaderCheckoutResponseDataCardTypeCredit GetReaderCheckoutResponseDataCardType = "credit" GetReaderCheckoutResponseDataCardTypeDebit GetReaderCheckoutResponseDataCardType = "debit" )
type GetReaderCheckoutResponseDataPaymentType ¶ added in v0.18.0
type GetReaderCheckoutResponseDataPaymentType string
Type of the payment. Required for some countries
const ( GetReaderCheckoutResponseDataPaymentTypeCard GetReaderCheckoutResponseDataPaymentType = "card" GetReaderCheckoutResponseDataPaymentTypePix GetReaderCheckoutResponseDataPaymentType = "pix" )
type GetReaderCheckoutResponseDataStatus ¶ added in v0.18.0
type GetReaderCheckoutResponseDataStatus string
Current status of the checkout
const ( GetReaderCheckoutResponseDataStatusCancelled GetReaderCheckoutResponseDataStatus = "cancelled" GetReaderCheckoutResponseDataStatusFailed GetReaderCheckoutResponseDataStatus = "failed" GetReaderCheckoutResponseDataStatusPending GetReaderCheckoutResponseDataStatus = "pending" GetReaderCheckoutResponseDataStatusSuccessful GetReaderCheckoutResponseDataStatus = "successful" )
type GetReaderCheckoutResponseDataTotalAmount ¶ added in v0.18.0
type GetReaderCheckoutResponseDataTotalAmount 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"`
}
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 GetReaderSettingsResponse ¶ added in v0.21.0
type GetReaderSettingsResponse struct {
Data GetReaderSettingsResponseData `json:"data"`
}
Menu lock settings reported by the reader, or the last saved settings when offline.
type GetReaderSettingsResponseData ¶ added in v0.21.0
type GetReaderSettingsResponseData struct {
// Menu lock configuration. Fields may be absent if no value is available.
MenuLock GetReaderSettingsResponseDataMenuLock `json:"menu_lock"`
}
GetReaderSettingsResponseData is a schema definition.
type GetReaderSettingsResponseDataMenuLock ¶ added in v0.21.0
type GetReaderSettingsResponseDataMenuLock struct {
// Whether menu lock is enabled.
Enabled *bool `json:"enabled,omitempty"`
// Four-digit PIN used to unlock the reader's menu.
// Format: password
// Pattern: ^[0-9]{4}$
Passcode *secret.Secret `json:"passcode,omitempty"`
}
Menu lock configuration. Fields may be absent if no value is available.
type HorizontalAccuracy ¶ added in v0.14.0
type HorizontalAccuracy float32
Indication of the precision of the geographical position received from the payment terminal.
type HostedCheckout ¶ added in v0.16.0
type HostedCheckout struct {
// Whether the checkout should include a SumUp-hosted payment page.
Enabled bool `json:"enabled"`
}
Hosted Checkout configuration. Enable it to receive a SumUp-hosted payment page URL in the checkout response.
type Invite ¶ added in v0.14.0
type Invite struct {
// Email address of the invited user.
// Format: email
Email string `json:"email"`
ExpiresAt time.Time `json:"expires_at"`
}
Pending invitation for membership.
type ItemReferencesV10 ¶ added in v0.22.0
type ItemReferencesV10 struct {
// Reference to the backing catalog entity (item variant, deposit, ...),
// typically a URN such as
// `urn:sumup:pos:variant:${MERCHANT_CODE}:${ITEM_ID}:${VARIANT_ID}` or
// `urn:sumup:pos:deposit:${MERCHANT_CODE}:${DEPOSIT_ID}`.
// Empty for ad-hoc / manual lines. Type-agnostic on purpose: a new item type
// backed by a catalog entity reuses this field instead of adding its own.
// Max length: 255
CatalogReference *string `json:"catalog_reference,omitempty"`
// The source of the catalog the line originates from.
// Default: SUMUP
CatalogSource *ItemReferencesV10CatalogSource `json:"catalog_source,omitempty"`
// An external reference id connecting this line to another system.
// Max length: 250
ExternalID *string `json:"external_id,omitempty"`
// Stock keeping unit, enriched from the Catalog when available.
// Max length: 100
Sku *string `json:"sku,omitempty"`
}
Outward identifiers and links for a line, kept in one place rather than scattered per item type.
type ItemReferencesV10CatalogSource ¶ added in v0.22.0
type ItemReferencesV10CatalogSource string
The source of the catalog the line originates from. Default: SUMUP
const ( ItemReferencesV10CatalogSourceExternal ItemReferencesV10CatalogSource = "EXTERNAL" ItemReferencesV10CatalogSourceSumup ItemReferencesV10CatalogSource = "SUMUP" )
type ItemTypeV10 ¶ added in v0.22.0
type ItemTypeV10 string
Classifies a sale line. Not a schema subclass.
Known values: `CATALOG`, `DEPOSIT`, `GIFT_CARD`, `CUSTOM`, `FEE`.
`FEE` lines represent merchant-charged fees on the sale (e.g. shipping, service charge, surcharge, cancellation). They participate in sale totals like any other line; type-specific data is carried in `features` (see `Feature` for the conventional feature keys).
This is intentionally an open string, NOT a closed enum: new values are added over time as pure data and consumers MUST tolerate unknown values, rendering the line from the generic envelope (name, quantity, price, taxes) and reading any extra information from `features`.
type Lat ¶ added in v0.14.0
type Lat float32
Latitude value from the coordinates of the payment location (as received from the payment terminal reader). Min: -90 Max: 90
type LegalType ¶ added in v0.14.0
type LegalType string
The unique legal type reference as defined in the country SDK. We do not rely on IDs as used by other services. Consumers of this API are expected to use the country SDK to map to any other IDs, translation keys, or descriptions.
Min length: 4 Max length: 64 Pattern: ^[a-z]{2}\.[a-z_]+$ The country SDK documentation for legal types.: https://developer.sumup.com/tools/glossary/merchant#legal-types
type LineItemPriceV10 ¶ added in v0.22.0
type LineItemPriceV10 struct {
// Discounts applied. Discount amounts do not affect `total_net_amount` /
// `total_gross_amount`; they are reflected in the `*_final` amounts.
// Max items: 1000
Discounts []DiscountLine `json:"discounts,omitempty"`
// Taxes applied on top of the net amount resulting in the gross amount.
// Min items: 1
// Max items: 1000
Taxes []TaxLine `json:"taxes"`
// Taxes applied on top of `total_net_amount_final` resulting in `total_gross_amount_final`. Equals `taxes` if
// no discounts apply.
// Min items: 1
// Max items: 1000
TaxesFinal []TaxLine `json:"taxes_final"`
// The gross amount (including modifiers if applied). It does NOT include discounts.
TotalGrossAmount LineItemPriceV10TotalGrossAmount `json:"total_gross_amount"`
// The final gross amount including discounts, modifiers and taxes. Equals `total_gross_amount` if no discounts apply.
TotalGrossAmountFinal LineItemPriceV10TotalGrossAmountFinal `json:"total_gross_amount_final"`
// The net amount (including modifiers if applied). It does NOT include discounts.
TotalNetAmount LineItemPriceV10TotalNetAmount `json:"total_net_amount"`
// The final net amount including discounts and modifiers. Equals `total_net_amount` if no discounts apply.
TotalNetAmountFinal LineItemPriceV10TotalNetAmountFinal `json:"total_net_amount_final"`
// The price of a single unit. If the tax_mode is GROSS it includes taxes,
// otherwise no tax is included. It does NOT include discounts.
// Format: int64
// Min: 0
UnitAmount PositiveAmount `json:"unit_amount"`
}
Pricing for a single line, valid for every item type.
Merges the standard amounts (with tax breakdown) and the final amounts (after discounts/modifiers).
Totals and tax amounts can be negative for return-like operations (for example a deposit with `operation_type` = `RETURN`).
type LineItemPriceV10TotalGrossAmount ¶ added in v0.22.0
type LineItemPriceV10TotalGrossAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
The gross amount (including modifiers if applied). It does NOT include discounts.
type LineItemPriceV10TotalGrossAmountFinal ¶ added in v0.22.0
type LineItemPriceV10TotalGrossAmountFinal struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
The final gross amount including discounts, modifiers and taxes. Equals `total_gross_amount` if no discounts apply.
type LineItemPriceV10TotalNetAmount ¶ added in v0.22.0
type LineItemPriceV10TotalNetAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
The net amount (including modifiers if applied). It does NOT include discounts.
type LineItemPriceV10TotalNetAmountFinal ¶ added in v0.22.0
type LineItemPriceV10TotalNetAmountFinal struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
The final net amount including discounts and modifiers. Equals `total_net_amount` if no discounts apply.
type Link ¶ added in v0.14.0
type Link struct {
// URL for accessing the related resource.
// Format: uri
Href *string `json:"href,omitempty"`
// Maximum amount allowed for a refund, in major units.
MaxAmount *float32 `json:"max_amount,omitempty"`
// Minimum amount allowed for a refund, in major units.
MinAmount *float32 `json:"min_amount,omitempty"`
// Relation of the linked resource to the current resource.
Rel *string `json:"rel,omitempty"`
// Media type of the linked resource.
Type *string `json:"type,omitempty"`
}
Details of a link to a related resource.
type ListPersonsResponseBody ¶ added in v0.14.0
type ListPersonsResponseBody struct {
Items []Person `json:"items"`
}
ListPersonsResponseBody is a schema definition.
type Lon ¶ added in v0.14.0
type Lon float32
Longitude value from the coordinates of the payment location (as received from the payment terminal reader). Min: -180 Max: 180
type MandatePayload ¶ added in v0.14.0
type MandatePayload struct {
// Type of mandate to create for the saved payment instrument.
Type MandatePayloadType `json:"type"`
// Browser or client user agent observed when consent was collected.
UserAgent string `json:"user_agent"`
// IP address of the payer when the mandate was accepted.
UserIP *string `json:"user_ip,omitempty"`
}
Mandate details used when a checkout should create a reusable card token for future recurring or merchant-initiated payments.
type MandatePayloadType ¶ added in v0.14.0
type MandatePayloadType string
Type of mandate to create for the saved payment instrument.
const (
MandatePayloadTypeRecurrent MandatePayloadType = "recurrent"
)
type MandateResponse ¶ added in v0.14.0
type MandateResponse struct {
// Short unique identifier for the merchant for which the mandate is valid.
MerchantCode *string `json:"merchant_code,omitempty"`
// Current lifecycle status of the mandate.
Status *MandateResponseStatus `json:"status,omitempty"`
// Type of mandate stored for the checkout or payment instrument.
Type *string `json:"type,omitempty"`
}
Details of the mandate linked to the saved payment instrument.
type MandateResponseStatus ¶ added in v0.16.0
type MandateResponseStatus string
Current lifecycle status of the mandate.
const ( MandateResponseStatusActive MandateResponseStatus = "active" MandateResponseStatusInactive MandateResponseStatus = "inactive" )
type Member ¶ added in v0.14.0
type Member struct {
// Object attributes that are modifiable only by SumUp applications.
Attributes Attributes `json:"attributes,omitempty"`
// The timestamp of when the member was created.
CreatedAt time.Time `json:"created_at"`
// ID of the member.
ID string `json:"id"`
// Pending invitation for membership.
Invite *Invite `json:"invite,omitempty"`
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,omitempty"`
// User's permissions.
// Deprecated: Permissions include only legacy permissions, please use roles instead. Member access is based on
// roles within a given resource and the permissions these roles grant.
Permissions []string `json:"permissions"`
// User's roles.
Roles []string `json:"roles"`
// The status of the membership.
Status MembershipStatus `json:"status"`
// The timestamp of when the member was last updated.
UpdatedAt time.Time `json:"updated_at"`
// Information about the user associated with the membership.
User *MembershipUser `json:"user,omitempty"`
}
A member is user within specific resource identified by resource id, resource type, and associated roles.
type MemberCreatedEvent ¶ added in v0.22.0
type MemberCreatedEvent struct{ TypedEvent[Member] }
MemberCreatedEvent is a members.created notification. FetchObject retrieves the latest Member.
type MemberDeletedEvent ¶ added in v0.22.0
type MemberDeletedEvent struct{ TypedEvent[Member] }
MemberDeletedEvent is a members.deleted notification. FetchObject retrieves the latest Member.
type MemberUpdatedEvent ¶ added in v0.22.0
type MemberUpdatedEvent struct{ TypedEvent[Member] }
MemberUpdatedEvent is a members.updated notification. FetchObject retrieves the latest Member.
type MembersClient ¶ added in v0.14.0
type MembersClient struct {
// contains filtered or unexported fields
}
MembersClient provides access to the Members API.
Endpoints to manage account members. Members are users that have membership within merchant accounts.
func NewMembersClient ¶ added in v0.14.0
func NewMembersClient(c *client.Client) *MembersClient
func (*MembersClient) Create ¶ added in v0.14.0
func (c *MembersClient) Create(ctx context.Context, merchantCode string, body MembersCreateParams) (*Member, error)
Adds a member to the merchant account with the specified roles.
By default, sends an invitation email to the provided address. The recipient must accept the invitation to join the account. When `is_managed_user` is `true`, creates a managed user with the provided password and optional nickname and assigns the roles directly, without sending an invitation.
func (*MembersClient) Get ¶ added in v0.14.0
func (c *MembersClient) Get(ctx context.Context, merchantCode string, memberID string) (*Member, error)
Retrieve a merchant member.
func (*MembersClient) List ¶ added in v0.14.0
func (c *MembersClient) List(ctx context.Context, merchantCode string, params MembersListParams) (*MembersListResponse, error)
Lists merchant members.
func (*MembersClient) Update ¶ added in v0.14.0
func (c *MembersClient) Update(ctx context.Context, merchantCode string, memberID string, body MembersUpdateParams) (*Member, error)
Updates a merchant member and returns the updated member.
Providing `roles` replaces the member's assigned roles and can grant or revoke access. Providing `metadata` replaces the entire metadata object. For managed users, `user.nickname` changes the display name and `user.password` replaces the password. Updating the password also enables the managed user account.
type MembersCreateParams ¶ added in v0.14.0
type MembersCreateParams struct {
// Object attributes that are modifiable only by SumUp applications.
Attributes Attributes `json:"attributes,omitempty"`
// Email address of the member to add.
// Format: email
// Max length: 256
Email string `json:"email"`
// True if the user is managed by the merchant. In this case, we'll created a virtual user with the provided password
// and nickname.
IsManagedUser *bool `json:"is_managed_user,omitempty"`
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,omitempty"`
// Nickname of the member to add. Only used if `is_managed_user` is true. Used for display purposes only.
// Max length: 64
Nickname *string `json:"nickname,omitempty"`
// Password of the member to add. Only used if `is_managed_user` is true. In the case of service accounts, the
// password is not used and can not be defined by the caller.
// Format: password
// Min length: 8
Password *secret.Secret `json:"password,omitempty"`
// List of roles to assign to the new member.
// Min items: 1
// Max items: 124
Roles []string `json:"roles"`
}
MembersCreateParams is a schema definition.
type MembersListParams ¶ added in v0.14.0
type MembersListParams struct {
// Filter the returned members by email address prefix.
Email *string
// Maximum number of members to return.
Limit *int
// Offset of the first member to return.
Offset *int
// Filter the returned members by role.
Roles []string
// Indicates to skip count query.
Scroll *bool
// Filter the returned members by the membership status.
Status *MembershipStatus
// Search for a member by user id.
UserID *string
}
MembersListParams are query parameters for ListMerchantMembers.
func (*MembersListParams) QueryValues ¶ added in v0.14.0
func (p *MembersListParams) QueryValues() url.Values
QueryValues converts MembersListParams into url.Values.
type MembersListResponse ¶ added in v0.14.0
type MembersListResponse struct {
Items []Member `json:"items"`
TotalCount *int `json:"total_count,omitempty"`
}
MembersListResponse is a schema definition.
type MembersUpdateParams ¶ added in v0.14.0
type MembersUpdateParams struct {
// Object attributes that are modifiable only by SumUp applications.
Attributes Attributes `json:"attributes,omitempty"`
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,omitempty"`
// Min items: 1
// Max items: 124
Roles []string `json:"roles,omitempty"`
// Allows you to update user data of managed users.
User *MembersUpdateParamsUser `json:"user,omitempty"`
}
MembersUpdateParams is a schema definition.
type MembersUpdateParamsUser ¶ added in v0.14.0
type MembersUpdateParamsUser struct {
// User's nickname. Used for display purposes only.
// Max length: 64
Nickname *string `json:"nickname,omitempty"`
// Password of the member to add. Only used if `is_managed_user` is true.
// Format: password
// Min length: 8
Password *secret.Secret `json:"password,omitempty"`
}
Allows you to update user data of managed users.
type Membership ¶ added in v0.14.0
type Membership struct {
// Object attributes that are modifiable only by SumUp applications.
Attributes Attributes `json:"attributes,omitempty"`
// The timestamp of when the membership was created.
CreatedAt time.Time `json:"created_at"`
// ID of the membership.
ID string `json:"id"`
// Pending invitation for membership.
Invite *Invite `json:"invite,omitempty"`
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,omitempty"`
// User's permissions.
// Deprecated: Permissions include only legacy permissions, please use roles instead. Member access is based on
// their roles within a given resource and the permissions these roles grant.
Permissions []string `json:"permissions"`
// Information about the resource the membership is in.
Resource MembershipResource `json:"resource"`
// ID of the resource the membership is in.
ResourceID string `json:"resource_id"`
// User's roles.
Roles []string `json:"roles"`
// The status of the membership.
Status MembershipStatus `json:"status"`
// The type of the membership resource.
// Possible values are:
// * `merchant` - merchant account(s)
// * `organization` - organization(s)
Type ResourceType `json:"type"`
// The timestamp of when the membership was last updated.
UpdatedAt time.Time `json:"updated_at"`
}
A membership associates a user with a resource, memberships is defined by user, resource, resource type, and associated roles.
type MembershipResource ¶ added in v0.14.0
type MembershipResource struct {
// Object attributes that are modifiable only by SumUp applications.
Attributes Attributes `json:"attributes,omitempty"`
// The timestamp of when the membership resource was created.
CreatedAt time.Time `json:"created_at"`
// ID of the resource the membership is in.
ID string `json:"id"`
// Logo fo the resource.
// Format: uri
// Max length: 256
Logo *string `json:"logo,omitempty"`
// Display name of the resource.
Name string `json:"name"`
// The type of the membership resource.
// Possible values are:
// * `merchant` - merchant account(s)
// * `organization` - organization(s)
Type ResourceType `json:"type"`
// The timestamp of when the membership resource was last updated.
UpdatedAt time.Time `json:"updated_at"`
}
Information about the resource the membership is in.
type MembershipStatus ¶ added in v0.14.0
type MembershipStatus string
The status of the membership.
const ( MembershipStatusAccepted MembershipStatus = "accepted" MembershipStatusDisabled MembershipStatus = "disabled" MembershipStatusExpired MembershipStatus = "expired" MembershipStatusPending MembershipStatus = "pending" MembershipStatusUnknown MembershipStatus = "unknown" )
type MembershipUser ¶ added in v0.14.0
type MembershipUser struct {
// Classic identifiers of the user.
// Deprecated: this operation is deprecated
Classic *MembershipUserClassic `json:"classic,omitempty"`
// Time when the user has been disabled. Applies only to virtual users (`virtual_user: true`).
DisabledAt *time.Time `json:"disabled_at,omitempty"`
// End-User's preferred e-mail address. Its value MUST conform to the RFC 5322 [RFC5322] addr-spec syntax. The
// RP MUST NOT rely upon this value being unique, for unique identification use ID instead.
Email string `json:"email"`
// Identifier for the End-User (also called Subject).
ID string `json:"id"`
// True if the user has enabled MFA on login.
MfaOnLoginEnabled bool `json:"mfa_on_login_enabled"`
// User's nickname. Used for display purposes only.
Nickname *string `json:"nickname,omitempty"`
// URL of the End-User's profile picture. This URL refers to an image file (for example, a PNG, JPEG, or GIF
// image file), rather than to a Web page containing an image.
// Format: uri
Picture *string `json:"picture,omitempty"`
// True if the user is a service account.
// Deprecated: Rely on `type` instead.
ServiceAccountUser bool `json:"service_account_user"`
// Type of the user account.
Type UserType `json:"type"`
// True if the user is a virtual user (operator).
// Deprecated: Rely on `type` instead.
VirtualUser bool `json:"virtual_user"`
}
Information about the user associated with the membership.
type MembershipUserClassic ¶ added in v0.14.0
type MembershipUserClassic struct {
// Min: 0
// Max: 2.147483647e+09
UserID int `json:"user_id"`
}
Classic identifiers of the user. Deprecated: this operation is deprecated
type MembershipsClient ¶ added in v0.14.0
type MembershipsClient struct {
// contains filtered or unexported fields
}
MembershipsClient provides access to the Memberships API.
Endpoints to manage user's memberships. Memberships are used to connect the user to merchant accounts and to grant them access to the merchant's resources via roles.
func NewMembershipsClient ¶ added in v0.14.0
func NewMembershipsClient(c *client.Client) *MembershipsClient
func (*MembershipsClient) List ¶ added in v0.14.0
func (c *MembershipsClient) List(ctx context.Context, params MembershipsListParams) (*MembershipsListResponse, error)
List memberships of the current user.
type MembershipsListParams ¶ added in v0.14.0
type MembershipsListParams struct {
// Filter memberships by resource kind.
Kind *ResourceType
// Maximum number of members to return.
Limit *int
// Offset of the first member to return.
Offset *int
// Filter memberships by the sandbox status of the resource the membership is in.
ResourceAttributesSandbox *bool
// Filter memberships by the ID of the resource the membership is in.
ResourceID *string
// Filter memberships by the name of the resource the membership is in.
ResourceName *string
// Filter memberships by the parent of the resource the membership is in.
// Omit both `resource.parent.id` and `resource.parent.type` to skip parent filtering. When filtering by parent,
// both parameters must be present. To select resources without a parent, set each parameter to an empty value.
// Otherwise, both parameters must identify a parent.
ResourceParentID *string
// Filter memberships by the parent of the resource the membership is in.
// Omit both `resource.parent.id` and `resource.parent.type` to skip parent filtering. When filtering by parent,
// both parameters must be present. To select resources without a parent, set each parameter to an empty value.
// Otherwise, both parameters must identify a parent.
ResourceParentType *ResourceType
// Filter memberships by resource kind.
ResourceType *ResourceType
// Filter the returned memberships by role.
Roles []string
// Filter the returned memberships by the membership status.
Status *MembershipStatus
}
MembershipsListParams are query parameters for ListMemberships.
func (*MembershipsListParams) QueryValues ¶ added in v0.14.0
func (p *MembershipsListParams) QueryValues() url.Values
QueryValues converts MembershipsListParams into url.Values.
type MembershipsListResponse ¶ added in v0.14.0
type MembershipsListResponse struct {
Items []Membership `json:"items"`
TotalCount int `json:"total_count"`
}
MembershipsListResponse is a schema definition.
type Merchant ¶ added in v0.14.0
type Merchant struct {
// A user-facing name of the merchant account for use in dashboards and other user-facing applications. For
// customer-facing business name see `merchant.business_profile`.
Alias *string `json:"alias,omitempty"`
// A user-facing small-format logo for use in dashboards and other user-facing applications. For customer-facing branding
// see `merchant.business_profile.branding`.
// Format: uri
Avatar *string `json:"avatar,omitempty"`
// Business information about the merchant. This information will be visible to the merchant's customers.
BusinessProfile *BusinessProfile `json:"business_profile,omitempty"`
// The business type.
// * `sole_trader`: The business is run by an self-employed individual.
// * `company`: The business is run as a company with one or more shareholders
// * `partnership`: The business is run as a company with two or more shareholders that can be also other legal
// entities
// * `non_profit`: The business is run as a nonprofit organization that operates for public or social benefit
// * `government_entity`: The business is state owned and operated
BusinessType *string `json:"business_type,omitempty"`
// Reflects the status of changes submitted through the `PATCH` endpoints for the Merchant or Persons. If some
// changes have not been applied yet, the status will be `pending`. If all changes have been applied, the status
// `done`.
// The status is only returned after write operations or on read endpoints when the `version` query parameter is
// provided.
// Read only
ChangeStatus *ChangeStatus `json:"change_status,omitempty"`
Classic *ClassicMerchantIdentifiers `json:"classic,omitempty"`
// Information about the company or business. This is legal information that is used for verification.
// Company documentation: https://developer.sumup.com/tools/glossary/merchant#company
Company *Company `json:"company,omitempty"`
// An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
// country code. This definition users `oneOf` with a two-character string
// type to allow for support of future countries in client code.
// Min length: 2
// Max length: 2
// Pattern: ^[A-Z]{2}$
Country CountryCode `json:"country"`
// The date and time when the resource was created. This is a string as defined in [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6).
// Read only
CreatedAt time.Time `json:"created_at"`
// Three-letter [ISO currency code](https://en.wikipedia.org/wiki/ISO_4217) representing the default currency for
// the account.
// Read only
// Min length: 3
// Max length: 3
DefaultCurrency string `json:"default_currency"`
// Merchant's default locale, represented as a BCP47 [RFC5646](https://datatracker.ietf.org/doc/html/rfc5646) language
// tag. This is typically an ISO 639-1 Alpha-2 [ISO639‑1](https://www.iso.org/iso-639-language-code) language code
// in lowercase and an ISO 3166-1 Alpha-2 [ISO3166‑1](https://www.iso.org/iso-3166-country-codes.html) country
// code in uppercase, separated by a dash. For example, en-US or fr-CA.
// In multilingual countries this is the merchant's preferred locale out of those, that are officially spoken in
// the country. In a countries with a single official language this will match the official language.
// Min length: 2
// Max length: 5
DefaultLocale string `json:"default_locale"`
// Short unique identifier for the merchant.
// Read only
MerchantCode string `json:"merchant_code"`
// 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 Meta `json:"meta,omitempty"`
// ID of the organization the merchant belongs to (if any).
OrganizationID *string `json:"organization_id,omitempty"`
// True if the merchant is a sandbox for testing.
Sandbox *bool `json:"sandbox,omitempty"`
// The date and time when the resource was last updated. This is a string as defined in [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6).
//
// Read only
UpdatedAt time.Time `json:"updated_at"`
// The version of the resource. The version reflects a specific change submitted to the API via one of the `PATCH`
// endpoints.
Version *Version `json:"version,omitempty"`
}
Merchant is a schema definition. Merchant documentation: https://developer.sumup.com/tools/glossary/merchant
type MerchantsClient ¶ added in v0.14.0
type MerchantsClient struct {
// contains filtered or unexported fields
}
MerchantsClient provides access to the Merchants API.
A Merchant represents a single business which can use SumUp products like payment processing.
func NewMerchantsClient ¶ added in v0.14.0
func NewMerchantsClient(c *client.Client) *MerchantsClient
func (*MerchantsClient) Get ¶ added in v0.14.0
Returns a Merchant for a valid Merchant code. Merchant documentation: https://developer.sumup.com/tools/models/merchant
func (*MerchantsClient) GetPerson ¶ added in v0.14.0
func (c *MerchantsClient) GetPerson(ctx context.Context, merchantCode string, personID string) (*Person, error)
Returns a single Person related to a Merchant. Persons documentation: https://developer.sumup.com/tools/models/merchant#persons
func (*MerchantsClient) ListPersons ¶ added in v0.14.0
func (c *MerchantsClient) ListPersons(ctx context.Context, merchantCode string) (*ListPersonsResponseBody, error)
Returns the Persons related to a Merchant. Persons documentation: https://developer.sumup.com/tools/models/merchant#persons
type Meta ¶ added in v0.14.0
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.
type Metadata ¶ added in v0.14.0
Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always submit whole metadata. Maximum of 64 parameters are allowed in the object. Max properties: 64
type ModifierItem ¶ added in v0.22.0
type ModifierItem = json.RawMessage
Modifiers are reported under line items and can be build from Item Catalog objects. Modifiers has to be attached to an item and can't be sold and refunded alone.
type ModifierSet ¶ added in v0.22.0
type ModifierSet struct {
// The id of the modifier set that modifier belongs to.
// Max length: 100
ID string `json:"id"`
// The name of the modifier set that the modifier belongs to.
// Min length: 1
// Max length: 150
Name string `json:"name"`
}
Modifier set attached to an item.
type NotFound ¶ added in v0.14.0
type NotFound struct {
Errors NotFoundErrors `json:"errors"`
}
404 Not Found
type NotFoundErrors ¶ added in v0.14.0
type NotFoundErrors struct {
// Fuller message giving context to error
Detail string `json:"detail"`
}
NotFoundErrors is a schema definition.
type Operator ¶ added in v0.14.0
type Operator struct {
AccountType OperatorAccountType `json:"account_type"`
// The timestamp of when the operator was created.
CreatedAt time.Time `json:"created_at"`
Disabled bool `json:"disabled"`
// Format: int32
ID int32 `json:"id"`
Nickname *nullable.Field[string] `json:"nickname,omitempty"`
// Permissions assigned to an operator or user.
Permissions Permissions `json:"permissions"`
// The timestamp of when the operator was last updated.
UpdatedAt time.Time `json:"updated_at"`
Username string `json:"username"`
}
Operator account for a merchant.
type OperatorAccountType ¶ added in v0.14.0
type OperatorAccountType string
OperatorAccountType is a schema definition.
const ( OperatorAccountTypeNormal OperatorAccountType = "normal" OperatorAccountTypeOperator OperatorAccountType = "operator" )
type Ownership ¶ added in v0.14.0
type Ownership struct {
// the relationship `owner` can have ownership.
// Format: int32
// Min: 25000
// Max: 100000
Share int32 `json:"share"`
}
Ownership is a schema definition.
type PaymentInstrumentResponse ¶ added in v0.14.0
type PaymentInstrumentResponse struct {
// Indicates whether the payment instrument is active and can be used for payments. To deactivate it, send a
// `DELETE` request to the resource endpoint.
// Read only
// Default: true
Active *bool `json:"active,omitempty"`
// Details of the payment card.
Card *PaymentInstrumentResponseCard `json:"card,omitempty"`
// The timestamp of when the payment instrument was created.
CreatedAt *time.Time `json:"created_at,omitempty"`
// Details of the mandate linked to the saved payment instrument.
Mandate *MandateResponse `json:"mandate,omitempty"`
// Token identifying the customer's saved payment card. Pass it as `token`, together with the associated `customer_id`
// and `payment_type = card`, when processing a checkout with this instrument.
// Read only
Token *string `json:"token,omitempty"`
// Type of the payment instrument.
Type *PaymentInstrumentResponseType `json:"type,omitempty"`
}
Details of a saved payment instrument.
type PaymentInstrumentResponseCard ¶ added in v0.14.0
type PaymentInstrumentResponseCard struct {
// Last 4 digits of the payment card number.
// Read only
// Min length: 4
// Max length: 4
Last4Digits *string `json:"last_4_digits,omitempty"`
// Issuing card network of the payment card used for the transaction.
Type *CardType `json:"type,omitempty"`
}
Details of the payment card.
type PaymentInstrumentResponseType ¶ added in v0.14.0
type PaymentInstrumentResponseType string
Type of the payment instrument.
const (
PaymentInstrumentResponseTypeCard PaymentInstrumentResponseType = "card"
)
type PaymentStatusFilterV10 ¶ added in v0.22.0
type PaymentStatusFilterV10 string
Payment outcome filter value. Multi-select uses **OR** within this field; combined with other filters using **AND**. Only fully-paid closed sales are exposed. Refunded original sales remain searchable as `PAID`; refunds are separate negative sales, not a `REFUNDED` sale-search outcome.
const ( PaymentStatusFilterV10ChargedBack PaymentStatusFilterV10 = "CHARGED_BACK" PaymentStatusFilterV10Paid PaymentStatusFilterV10 = "PAID" )
type PaymentType ¶ added in v0.14.0
type PaymentType string
Payment category recorded on a transaction, for example `POS` for a point-of-sale card payment, `ECOM` for an online card payment, or `RECURRING` for a recurring card payment. These reporting values are separate from the lowercase `payment_type` values used to process checkouts.
const ( PaymentTypeApm PaymentType = "APM" PaymentTypeBalance PaymentType = "BALANCE" PaymentTypeBitcoin PaymentType = "BITCOIN" PaymentTypeBoleto PaymentType = "BOLETO" PaymentTypeCash PaymentType = "CASH" PaymentTypeDirectDebit PaymentType = "DIRECT_DEBIT" PaymentTypeEcom PaymentType = "ECOM" PaymentTypeMoto PaymentType = "MOTO" PaymentTypePOS PaymentType = "POS" PaymentTypeRecurring PaymentType = "RECURRING" PaymentTypeUnknown PaymentType = "UNKNOWN" )
type PayoutsClient ¶ added in v0.14.0
type PayoutsClient struct {
// contains filtered or unexported fields
}
PayoutsClient provides access to the Payouts API.
The Payouts model will allow you to track funds you’ve received from SumUp.
You can receive a detailed payouts list with information like dates, fees, references and statuses, using the `List payouts` endpoint.
func NewPayoutsClient ¶ added in v0.14.0
func NewPayoutsClient(c *client.Client) *PayoutsClient
func (*PayoutsClient) List ¶ added in v0.14.0
func (c *PayoutsClient) List(ctx context.Context, merchantCode string, params PayoutsListParams) (*FinancialPayouts, error)
Lists payout and payout-deduction records for the specified merchant account within the requested date range.
The response can include: - regular payouts (`type = PAYOUT`) - deduction records for refunds, chargebacks, direct debit returns, or balance adjustments
Results are sorted by payout date in the requested `order`.
type PayoutsList400Response ¶ added in v0.15.1
type PayoutsList400Response []ErrorExtended
PayoutsList400Response is a schema definition.
func (*PayoutsList400Response) Error ¶ added in v0.15.1
func (e *PayoutsList400Response) Error() string
type PayoutsListFormat ¶ added in v0.15.2
type PayoutsListFormat string
PayoutsListFormat is a schema definition. Default: json
const ( PayoutsListFormatCSV PayoutsListFormat = "csv" PayoutsListFormatJSON PayoutsListFormat = "json" )
type PayoutsListOrder ¶ added in v0.15.2
type PayoutsListOrder string
PayoutsListOrder is a schema definition. Default: asc
const ( PayoutsListOrderASC PayoutsListOrder = "asc" PayoutsListOrderDESC PayoutsListOrder = "desc" )
type PayoutsListParams ¶ added in v0.14.0
type PayoutsListParams struct {
// End date of the payout period filter, inclusive, in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) `date`
// format (`YYYY-MM-DD`). Must be greater than or equal to `start_date`.
EndDate datetime.Date
// Response format for the payout list.
Format *PayoutsListFormat
// Maximum number of payout records to return.
Limit *int
// Sort direction for the returned payouts.
Order *PayoutsListOrder
// Start date of the payout period filter, inclusive, in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) `date`
// format (`YYYY-MM-DD`).
StartDate datetime.Date
}
PayoutsListParams are query parameters for ListPayoutsV1.
func (*PayoutsListParams) QueryValues ¶ added in v0.14.0
func (p *PayoutsListParams) QueryValues() url.Values
QueryValues converts PayoutsListParams into url.Values.
type Permissions ¶ added in v0.14.0
type Permissions struct {
Admin bool `json:"admin"`
CreateMotoPayments bool `json:"create_moto_payments"`
CreateReferral bool `json:"create_referral"`
FullTransactionHistoryView bool `json:"full_transaction_history_view"`
RefundTransactions bool `json:"refund_transactions"`
}
Permissions assigned to an operator or user.
type Person ¶ added in v0.14.0
type Person struct {
// An address somewhere in the world. The address fields used depend on the country conventions. For example, in
// Great Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addresses
// is `state`, whereas in Chile it's `region`.
// Whether an address is valid or not depends on whether the locally required fields are present. Fields not
// supported in a country will be ignored.
// Address documentation: https://developer.sumup.com/tools/glossary/address
Address *Address `json:"address,omitempty"`
// The date of birth of the individual, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format.
// Format: date
Birthdate *datetime.Date `json:"birthdate,omitempty"`
// Reflects the status of changes submitted through the `PATCH` endpoints for the Merchant or Persons. If some
// changes have not been applied yet, the status will be `pending`. If all changes have been applied, the status
// `done`.
// The status is only returned after write operations or on read endpoints when the `version` query parameter is
// provided.
// Read only
ChangeStatus *ChangeStatus `json:"change_status,omitempty"`
// An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
// country code. This definition users `oneOf` with a two-character string
// type to allow for support of future countries in client code.
// Min length: 2
// Max length: 2
// Pattern: ^[A-Z]{2}$
Citizenship *CountryCode `json:"citizenship,omitempty"`
// An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code representing the country
// where the Person resides.
// Pattern: ^[A-Z]{2}$
CountryOfResidence *nullable.Field[string] `json:"country_of_residence,omitempty"`
// The last name(s) of the individual.
// Min length: 1
// Max length: 60
FamilyName *string `json:"family_name,omitempty"`
// The first name(s) of the individual.
// Min length: 1
// Max length: 60
GivenName *string `json:"given_name,omitempty"`
// The unique identifier for the Person. This is a [typeid](https://github.com/sumup/typeid).
// Read only
ID string `json:"id"`
// A list of country-specific personal identifiers.
// Max items: 32
Identifiers PersonalIdentifiers `json:"identifiers,omitempty"`
// The Person's nationality. May be an [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country
// code, but legacy data may not conform to this standard.
// Pattern: ^[A-Z]{2}$
Nationality *nullable.Field[string] `json:"nationality,omitempty"`
Ownership *Ownership `json:"ownership,omitempty"`
// A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format.
// Max length: 16
PhoneNumber *PhoneNumber `json:"phone_number,omitempty"`
// A list of roles the Person has in the Merchant or towards SumUp. A Merchant must have at least one Person with
// the relationship `representative`.
// Min items: 1
// Max items: 1
Relationships []string `json:"relationships,omitempty"`
// A corresponding identity user ID for the Person, if they have a user account.
UserID *string `json:"user_id,omitempty"`
// The version of the resource. The version reflects a specific change submitted to the API via one of the `PATCH`
// endpoints.
Version *Version `json:"version,omitempty"`
}
Person is a schema definition.
type PersonalDetails ¶ added in v0.14.0
type PersonalDetails struct {
// Profile's personal address information.
Address *AddressLegacy `json:"address,omitempty"`
// Date of birth of the customer in `YYYY-MM-DD` format, without a time or timezone.
// Format: date
BirthDate *datetime.Date `json:"birth_date,omitempty"`
// Email address of the customer.
Email *string `json:"email,omitempty"`
// First name of the customer.
FirstName *string `json:"first_name,omitempty"`
// Last name of the customer.
LastName *string `json:"last_name,omitempty"`
// Phone number of the customer.
Phone *string `json:"phone,omitempty"`
// Identification number used for tax purposes, such as a CPF in Brazil.
// Max length: 255
TaxID *string `json:"tax_id,omitempty"`
}
Personal details for the customer.
type PersonalIdentifier ¶ added in v0.14.0
type PersonalIdentifier struct {
// The unique reference for the personal identifier type.
// Max length: 32
Ref string `json:"ref"`
// The personal identifier value.
// Max length: 128
Value string `json:"value"`
}
PersonalIdentifier is a schema definition.
type PersonalIdentifiers ¶ added in v0.17.1
type PersonalIdentifiers []PersonalIdentifier
A list of country-specific personal identifiers. Max items: 32
type PhoneNumber ¶ added in v0.14.0
type PhoneNumber string
A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format.
Max length: 16
type PositiveAmount ¶ added in v0.22.0
type PositiveAmount int64
The value of the amount in minor units of the currency according to the Sale.currency.scale. `value` can get large for some currencies and applications. Use Long type or a similar data type when parsing `value`. Format: int64 Min: 0
type PositivePriceAmounts ¶ added in v0.22.0
type PositivePriceAmounts struct {
// The gross amount (including modifiers if applied). It does NOT include discounts.
TotalGrossAmount PositivePriceAmountsTotalGrossAmount `json:"total_gross_amount"`
// The net amount (including modifiers if applied). It does NOT include discounts.
TotalNetAmount PositivePriceAmountsTotalNetAmount `json:"total_net_amount"`
// The price of a single unit.
// If the tax_mode is GROSS, it includes taxes, otherwise no tax included.
// It doesn't include discounts.
// Format: int64
// Min: 0
UnitAmount PositiveAmount `json:"unit_amount"`
}
Price information for items with positive amounts only.
type PositivePriceAmountsTotalGrossAmount ¶ added in v0.22.0
type PositivePriceAmountsTotalGrossAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
The gross amount (including modifiers if applied). It does NOT include discounts.
type PositivePriceAmountsTotalNetAmount ¶ added in v0.22.0
type PositivePriceAmountsTotalNetAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
The net amount (including modifiers if applied). It does NOT include discounts.
type PositivePriceWithTaxes ¶ added in v0.22.0
type PositivePriceWithTaxes struct {
// Taxes applied on top of net amount resulting in gross amount.
// Min items: 1
// Max items: 1000
Taxes []PositiveTaxLine `json:"taxes"`
}
Price information with positive amounts and detailed tax breakdown.
type PositiveTaxLine ¶ added in v0.22.0
type PositiveTaxLine struct {
// Gross amount after applying the tax.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
GrossAmount PositiveTaxLineGrossAmount `json:"gross_amount"`
// Tax ID from the Tax Service (External Id)
// Max length: 100
ID string `json:"id"`
// Tax name, e.g. "MwSt."
// Max length: 255
Name *string `json:"name,omitempty"`
// Net amount before applying the tax.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
NetAmount PositiveTaxLineNetAmount `json:"net_amount"`
// The tax rate percentage in minor units (1/100000). For example 19000 = 19%.
// Format: int64
// Min: 0
Percentage *TaxRate `json:"percentage,omitempty"`
// Amount of tax.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
TaxAmount PositiveTaxLineTaxAmount `json:"tax_amount"`
}
Tax line with positive amounts only. Information about tax together with amounts before and after its application such as:
- net amount: taxable net amount, scoped by this tax
- gross amount: amount after applying the tax
The numbers here can't be negative.
type PositiveTaxLineGrossAmount ¶ added in v0.22.0
type PositiveTaxLineGrossAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Gross amount after applying the tax. The value of the amount in minor units of the currency according to the Sale.currency.scale.
type PositiveTaxLineNetAmount ¶ added in v0.22.0
type PositiveTaxLineNetAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Net amount before applying the tax. The value of the amount in minor units of the currency according to the Sale.currency.scale.
type PositiveTaxLineTaxAmount ¶ added in v0.22.0
type PositiveTaxLineTaxAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Amount of tax. The value of the amount in minor units of the currency according to the Sale.currency.scale.
type PriceAmounts ¶ added in v0.22.0
type PriceAmounts struct {
// The gross amount (including modifiers if applied). It does NOT include discounts.
TotalGrossAmount PriceAmountsTotalGrossAmount `json:"total_gross_amount"`
// The net amount (including modifiers if applied). It does NOT include discounts.
TotalNetAmount PriceAmountsTotalNetAmount `json:"total_net_amount"`
// The price of a single unit.
// If the tax_mode is GROSS, it includes taxes, otherwise no tax included.
// It doesn't include discounts.
// Format: int64
// Min: 0
UnitAmount PositiveAmount `json:"unit_amount"`
}
Base price information for items including unit amount and totals.
type PriceAmountsTotalGrossAmount ¶ added in v0.22.0
type PriceAmountsTotalGrossAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
The gross amount (including modifiers if applied). It does NOT include discounts.
type PriceAmountsTotalNetAmount ¶ added in v0.22.0
type PriceAmountsTotalNetAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
The net amount (including modifiers if applied). It does NOT include discounts.
type Problem ¶ added in v0.14.0
type Problem struct {
// A human-readable explanation specific to this occurrence of the problem.
Detail *string `json:"detail,omitempty"`
// A URI reference that identifies the specific occurrence of the problem.
// Format: uri
Instance *string `json:"instance,omitempty"`
// The HTTP status code generated by the origin server for this occurrence of the problem.
Status *int `json:"status,omitempty"`
// A short, human-readable summary of the problem type.
Title *string `json:"title,omitempty"`
// A URI reference that identifies the problem type.
// Format: uri
Type string `json:"type"`
}
A RFC 9457 problem details object.
Additional properties specific to the problem type may be present.
type ProblemV10 ¶ added in v0.22.0
type ProblemV10 struct {
// A human-readable explanation specific to this occurrence of the problem.
Detail *string `json:"detail,omitempty"`
// A URI reference that identifies the specific occurrence of the problem.
// Format: uri
Instance *string `json:"instance,omitempty"`
// The HTTP status code generated by the origin server for this occurrence of the problem.
Status *int `json:"status,omitempty"`
// A short, human-readable summary of the problem type.
Title *string `json:"title,omitempty"`
// A URI reference that identifies the problem type.
// Format: uri
Type string `json:"type"`
}
A RFC 9457 problem details object.
Additional properties specific to the problem type may be present.
func (*ProblemV10) Error ¶ added in v0.22.0
func (e *ProblemV10) Error() string
type ProcessCheckout ¶ added in v0.14.0
type ProcessCheckout struct {
// Raw payment token object received from Apple Pay. Send the Apple Pay response payload as-is.
ApplePay *json.RawMessage `json:"apple_pay,omitempty"`
// __Required when payment type is `card`.__ Details of the payment card.
Card *Card `json:"card,omitempty"`
// Customer identifier associated with the saved payment instrument. Required when `token` is provided.
CustomerID *string `json:"customer_id,omitempty"`
// Raw `PaymentData` object received from Google Pay. Send the Google Pay response payload as-is.
GooglePay *json.RawMessage `json:"google_pay,omitempty"`
// Number of installments for deferred payments. Available only to merchant users in Brazil.
// Min: 1
// Max: 12
Installments *int `json:"installments,omitempty"`
// Mandate details used when a checkout should create a reusable card token for future recurring or merchant-initiated payments.
Mandate *MandatePayload `json:"mandate,omitempty"`
// Payment method used for this processing attempt. It determines which additional request fields are required.
PaymentType ProcessCheckoutPaymentType `json:"payment_type"`
// Personal details for the customer.
PersonalDetails *PersonalDetails `json:"personal_details,omitempty"`
// Token of a saved payment instrument returned by checkout processing or the customer's payment-instruments endpoint.
// To charge a saved card, set `payment_type` to `card` and provide both this `token` and the associated `customer_id`
// instead of raw card details.
Token *string `json:"token,omitempty"`
}
Request body for attempting payment on an existing checkout. The required companion fields depend on the selected `payment_type`, for example card details, saved-card data, or payer information required by a specific payment method.
type ProcessCheckoutPaymentType ¶ added in v0.14.0
type ProcessCheckoutPaymentType string
Payment method used for this processing attempt. It determines which additional request fields are required.
const ( ProcessCheckoutPaymentTypeApplePay ProcessCheckoutPaymentType = "apple_pay" ProcessCheckoutPaymentTypeBancontact ProcessCheckoutPaymentType = "bancontact" ProcessCheckoutPaymentTypeBlik ProcessCheckoutPaymentType = "blik" ProcessCheckoutPaymentTypeBoleto ProcessCheckoutPaymentType = "boleto" ProcessCheckoutPaymentTypeCard ProcessCheckoutPaymentType = "card" ProcessCheckoutPaymentTypeGooglePay ProcessCheckoutPaymentType = "google_pay" ProcessCheckoutPaymentTypeIdeal ProcessCheckoutPaymentType = "ideal" )
type Product ¶ added in v0.14.0
type Product struct {
// Product name.
Name *string `json:"name,omitempty"`
// Product price.
// Format: decimal
Price *float64 `json:"price,omitempty"`
// Human-readable label for the product price.
PriceLabel *string `json:"price_label,omitempty"`
// Product price including VAT.
// Format: decimal
PriceWithVAT *float64 `json:"price_with_vat,omitempty"`
// Product quantity.
Quantity *int `json:"quantity,omitempty"`
// VAT amount for a single product.
// Format: decimal
SingleVATAmount *float64 `json:"single_vat_amount,omitempty"`
// Total price calculated as the product price multiplied by the quantity.
// Format: decimal
TotalPrice *float64 `json:"total_price,omitempty"`
// Total product price including VAT.
// Format: decimal
TotalWithVAT *float64 `json:"total_with_vat,omitempty"`
// Total VAT amount for the product quantity.
// Format: decimal
VATAmount *float64 `json:"vat_amount,omitempty"`
// VAT rate as a decimal fraction, for example `0.19` for 19%.
// Format: decimal
VATRate *float64 `json:"vat_rate,omitempty"`
}
Product details associated with a transaction.
type PublicApmType ¶ added in v0.22.0
type PublicApmType string
Alternative payment method type when `method` is `apm`. Gift card is not an APM on this API. Input is case-insensitive; the canonical form is lowercase snake_case. **VALUES**: [qr_code_pix, sepa_dd, paypal, sumup_pay, twint, iris]. Max length: 20
type PublicCardV10 ¶ added in v0.22.0
type PublicCardV10 struct {
// The brand of the card.
// Input is case-insensitive; the canonical form is lowercase snake_case.
// **VALUES**: [amex, cup, diners, discover, elo, elv, hipercard, jcb, maestro, mastercard, visa, visa_electron,
// visa_vpay, vr, eftpos, conecs, swile, girocard, interac, sumup, bancomat].
// Max length: 20
Brand Brand `json:"brand"`
// The last 4 digits of the card used for the payment.
// Min length: 4
// Max length: 4
// Pattern: ^\d{4}$
Last4Digits string `json:"last_4_digits"`
// Credit or debit processing choice, not brand or funding.
// `unknown` when unavailable; prepaid/voucher are not processing types.
Type PublicCardV10Type `json:"type"`
}
Card brand, credit/debit processing type, and last four digits.
type PublicCardV10Type ¶ added in v0.22.0
type PublicCardV10Type string
Credit or debit processing choice, not brand or funding. `unknown` when unavailable; prepaid/voucher are not processing types.
const ( PublicCardV10TypeCredit PublicCardV10Type = "credit" PublicCardV10TypeDebit PublicCardV10Type = "debit" PublicCardV10TypeUnknown PublicCardV10Type = "unknown" )
type PublicGiftCardPayment ¶ added in v0.22.0
type PublicGiftCardPayment struct {
// Gift card identifier. Format "GC" followed by 9 alphanumeric characters
// (e.g. GCZ3NTMB1V).
ID string `json:"id"`
}
Gift card used for this payment. Present when `method` is `gift_card` and the gift card id is known. Gift card IDs use the format "GC" followed by 9 alphanumeric characters (e.g. GCZ3NTMB1V).
type PublicPaymentMethod ¶ added in v0.22.0
type PublicPaymentMethod string
Payment method on public sales read API v1.0. Digital wallets are first-class methods. Gift card payments use `gift_card`, not `apm`. Input is case-insensitive; the canonical form is lowercase snake_case. **VALUES**: [card, cash, apm, external, apple_pay, google_pay, whatsapp_pay, gift_card]. Max length: 20
type PublicPaymentV10 ¶ added in v0.22.0
type PublicPaymentV10 struct {
// The amount of the payment including tips.
// The value of the amount in minor units of `Sale.currency`.
// Format: int64
// Min: 0
Amount PositiveAmount `json:"amount"`
// Alternative payment method type when `method` is `apm`.
// Gift card is not an APM on this API.
// Input is case-insensitive; the canonical form is lowercase snake_case.
// **VALUES**: [qr_code_pix, sepa_dd, paypal, sumup_pay, twint, iris].
// Max length: 20
ApmType *PublicApmType `json:"apm_type,omitempty"`
// Card brand, credit/debit processing type, and last four digits.
Card *PublicCardV10 `json:"card,omitempty"`
// Gift card used for this payment. Present when `method` is `gift_card` and the gift card
// id is known.
// Gift card IDs use the format "GC" followed by 9 alphanumeric characters
// (e.g. GCZ3NTMB1V).
GiftCard *PublicGiftCardPayment `json:"gift_card,omitempty"`
// Payment method on public sales read API v1.0.
// Digital wallets are first-class methods. Gift card payments use `gift_card`, not `apm`.
// Input is case-insensitive; the canonical form is lowercase snake_case.
// **VALUES**: [card, cash, apm, external, apple_pay, google_pay, whatsapp_pay, gift_card].
// Max length: 20
Method PublicPaymentMethod `json:"method"`
// UTC date-time when SumUp recorded this payment’s exposed `status` (successful, failed,
// or canceled). Server processed time when available; otherwise the payment provider’s
// transaction time. Not the device clock.
ProcessedAt time.Time `json:"processed_at"`
// The reference to the actual payment used for this sale, e.g. the sumup transaction code.
// Max length: 50
Reference Reference `json:"reference"`
// The status of the payment.
Status PublicPaymentV10Status `json:"status"`
// Payment operation type.
// This is distinct from the payment instrument in `method`.
// Input is case-insensitive; the canonical form is lowercase snake_case.
// **VALUES**: [purchase, unreferenced_refund]
// Defaults to "purchase" if unspecified. Either a normal purchase or an unreferenced refund for negative
// sales like deposit returns.
// Default: purchase
Type string `json:"type"`
}
Payment on a closed sale, for bookkeeping and reconciliation.
Acquirer/processing cost is not on this object. Merchant-charged fees (shipping, service charge, etc.) appear as `type: "FEE"` item lines in `Sale.items`.
type PublicPaymentV10Status ¶ added in v0.22.0
type PublicPaymentV10Status string
The status of the payment.
const ( PublicPaymentV10StatusCanceled PublicPaymentV10Status = "CANCELED" PublicPaymentV10StatusFailed PublicPaymentV10Status = "FAILED" PublicPaymentV10StatusSuccessful PublicPaymentV10Status = "SUCCESSFUL" )
type Quantity ¶ added in v0.22.0
type Quantity float64
The numerical value representing the quantity in the specified unit. Format: double Min: 0
type Reader ¶ added in v0.14.0
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 reader that the payment is initiated on.
// Min length: 30
// Max length: 30
ID ReaderID `json:"id"`
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,omitempty"`
// Custom human-readable, user-defined name for easier identification of the reader.
// Max length: 500
Name ReaderName `json:"name"`
// Identifier of the system-managed service account associated with this reader.
// Present only for readers that are already paired.
// This field is currently in beta and may change.
// Format: uuid
ServiceAccountID *string `json:"service_account_id,omitempty"`
// 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"`
}
A physical card reader device that can accept in-person payments.
type ReaderCreatedEvent ¶ added in v0.22.0
type ReaderCreatedEvent struct{ TypedEvent[Reader] }
ReaderCreatedEvent is a readers.created notification. FetchObject retrieves the latest Reader.
type ReaderDeletedEvent ¶ added in v0.22.0
type ReaderDeletedEvent struct{ TypedEvent[Reader] }
ReaderDeletedEvent is a readers.deleted notification. FetchObject retrieves the latest Reader.
type ReaderDevice ¶ added in v0.14.0
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"`
}
Information about the underlying physical device.
type ReaderDeviceModel ¶ added in v0.14.0
type ReaderDeviceModel string
Identifier of the model of the device.
const ( ReaderDeviceModelSolo ReaderDeviceModel = "solo" ReaderDeviceModelVirtualSolo ReaderDeviceModel = "virtual-solo" )
type ReaderID ¶ added in v0.14.0
type ReaderID string
Unique identifier of the reader that the payment is initiated on. Min length: 30 Max length: 30
type ReaderName ¶ added in v0.14.0
type ReaderName string
Custom human-readable, user-defined name for easier identification of the reader. Max length: 500
type ReaderPairingCode ¶ added in v0.14.0
type ReaderPairingCode string
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 ReaderPaymentRequestParams ¶ added in v0.18.0
type ReaderPaymentRequestParams struct {
Affiliate *ReaderPaymentRequestParamsAffiliate `json:"affiliate,omitempty"`
// Caller-supplied correlation identifier, used as the idempotency key.
ClientTransactionID string `json:"client_transaction_id"`
// Portion of total_amount that is a tip, in minor units.
TipAmount *int `json:"tip_amount,omitempty"`
TotalAmount ReaderPaymentRequestParamsTotalAmount `json:"total_amount"`
}
ReaderPaymentRequestParams is a schema definition.
type ReaderPaymentRequestParamsAffiliate ¶ added in v0.21.0
type ReaderPaymentRequestParamsAffiliate struct {
AppID string `json:"app_id"`
Key string `json:"key"`
}
ReaderPaymentRequestParamsAffiliate is a schema definition.
type ReaderPaymentRequestParamsTotalAmount ¶ added in v0.21.0
type ReaderPaymentRequestParamsTotalAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
ReaderPaymentRequestParamsTotalAmount is a schema definition.
type ReaderPaymentResponse ¶ added in v0.18.0
type ReaderPaymentResponse struct {
Data *ReaderPaymentResponseData `json:"data,omitempty"`
}
ReaderPaymentResponse is a schema definition.
type ReaderPaymentResponseData ¶ added in v0.18.0
type ReaderPaymentResponseData struct {
// Caller-supplied correlation identifier that was provided in the request.
ClientTransactionID *string `json:"client_transaction_id,omitempty"`
// Transaction code returned by the acquirer/processing entity after processing the transaction.
TransactionCode *string `json:"transaction_code,omitempty"`
}
ReaderPaymentResponseData is a schema definition.
type ReaderStatus ¶ added in v0.14.0
type ReaderStatus string
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 ReadersClient ¶ added in v0.14.0
type ReadersClient struct {
// contains filtered or unexported fields
}
ReadersClient provides access to the Readers API.
A reader represents a device that accepts payments. You can use the SumUp Solo to accept in-person payments.
func NewReadersClient ¶ added in v0.14.0
func NewReadersClient(c *client.Client) *ReadersClient
func (*ReadersClient) Create ¶ added in v0.14.0
func (c *ReadersClient) Create(ctx context.Context, merchantCode string, body ReadersCreateParams) (*Reader, error)
Create a new Reader for the merchant account.
func (*ReadersClient) CreateCheckout ¶ added in v0.14.0
func (c *ReadersClient) CreateCheckout(ctx context.Context, merchantCode string, readerID string, body ReadersCreateCheckoutParams) (*CreateReaderCheckoutResponse, error)
Creates a Checkout for a Reader.
This process is asynchronous and the actual transaction may take some time to be started 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.
Optionally include an `affiliate` object to attach integrator metadata to the payment. Provide both `app_id` and `key` when including this object.
func (*ReadersClient) CreateGoCheckout ¶ added in v0.18.0
func (c *ReadersClient) CreateGoCheckout(ctx context.Context, merchantCode string, readerID ReaderID, body ReadersCreateGoCheckoutParams) (*ReaderPaymentResponse, error)
Initiates a payment on the SumUp Go terminal identified by the reader ID.
Use `client_transaction_id` as an idempotency key: retrying the request with the same value returns the result of the original payment instead of creating a duplicate.
func (*ReadersClient) Get ¶ added in v0.14.0
func (c *ReadersClient) Get(ctx context.Context, merchantCode string, readerID ReaderID, params ReadersGetParams) (*Reader, error)
Retrieve a Reader.
func (*ReadersClient) GetCheckout ¶ added in v0.18.0
func (c *ReadersClient) GetCheckout(ctx context.Context, merchantCode string, readerID string, checkoutID string) (*GetReaderCheckoutResponse, error)
Get a Checkout for a Reader.
func (*ReadersClient) GetReaderSettings ¶ added in v0.21.0
func (c *ReadersClient) GetReaderSettings(ctx context.Context, merchantCode string, readerID string) (*GetReaderSettingsResponse, error)
Returns the menu lock settings for a Solo reader.
For an online reader, returns the current settings. For an offline reader, returns the last saved settings, which may differ from its current configuration. Returns `404` if the reader is offline and no saved settings are available.
The response may include the menu lock PIN.
func (*ReadersClient) GetStatus ¶ added in v0.14.0
func (c *ReadersClient) GetStatus(ctx context.Context, merchantCode string, readerID string) (*StatusResponse, error)
Provides the last known status for a Reader.
This endpoint allows you to retrieve updates from the connected card reader, including the current screen being displayed during the payment process and the device status (battery level, connectivity, and update state).
Supported States ¶
* `IDLE` – Reader ready for next transaction * `SELECTING_TIP` – Waiting for tip input * `WAITING_FOR_CARD` – Awaiting card insert/tap * `WAITING_FOR_PIN` – Waiting for PIN entry * `WAITING_FOR_SIGNATURE` – Waiting for customer signature * `UPDATING_FIRMWARE` – Firmware update in progress
Device Status ¶
* `ONLINE` – Device connected and operational * `OFFLINE` – Device disconnected (last state persisted)
**Note**: If the target device is a Solo, it must be in version 3.3.39.0 or higher.
func (*ReadersClient) List ¶ added in v0.14.0
func (c *ReadersClient) List(ctx context.Context, merchantCode string) (*ReadersListResponse, error)
List all readers of the merchant.
func (*ReadersClient) TerminateCheckout ¶ added in v0.14.0
func (c *ReadersClient) TerminateCheckout(ctx context.Context, merchantCode string, readerID string) error
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 (*ReadersClient) Update ¶ added in v0.14.0
func (c *ReadersClient) Update(ctx context.Context, merchantCode string, readerID ReaderID, body ReadersUpdateParams) (*Reader, error)
Updates a reader's name or metadata and returns the updated reader.
Providing `metadata` replaces the entire metadata object; include all entries that should be retained. Omitted fields remain unchanged.
func (*ReadersClient) UpdateReaderSettings ¶ added in v0.21.0
func (c *ReadersClient) UpdateReaderSettings(ctx context.Context, merchantCode string, readerID string, body ReadersUpdateReaderSettingsParams) (*UpdateReaderSettingsResponse, error)
Updates the menu lock settings for a Solo reader. The reader must be online. A successful response confirms that the reader applied the update.
Include at least one of `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The response contains only the settings included in the request.
When enabling menu lock for a reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request.
type ReadersCreateCheckoutParams ¶ added in v0.14.0
type ReadersCreateCheckoutParams = CreateCheckoutRequest
type ReadersCreateGoCheckoutParams ¶ added in v0.18.0
type ReadersCreateGoCheckoutParams = ReaderPaymentRequestParams
type ReadersCreateParams ¶ added in v0.14.0
type ReadersCreateParams struct {
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,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"`
}
ReadersCreateParams is a schema definition.
type ReadersGetParams ¶ added in v0.14.0
type ReadersGetParams 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
}
ReadersGetParams are query parameters for GetReader.
func (*ReadersGetParams) QueryValues ¶ added in v0.14.0
func (p *ReadersGetParams) QueryValues() url.Values
QueryValues converts ReadersGetParams into url.Values.
type ReadersListResponse ¶ added in v0.14.0
type ReadersListResponse struct {
Items []Reader `json:"items"`
}
ReadersListResponse is a schema definition.
type ReadersUpdateParams ¶ added in v0.14.0
type ReadersUpdateParams struct {
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,omitempty"`
// Custom human-readable, user-defined name for easier identification of the reader.
// Max length: 500
Name *ReaderName `json:"name,omitempty"`
}
ReadersUpdateParams is a schema definition.
type ReadersUpdateReaderSettingsParams ¶ added in v0.21.0
type ReadersUpdateReaderSettingsParams = UpdateReaderSettingsRequest
type Receipt ¶ added in v0.14.0
type Receipt struct {
// Acquirer-specific metadata related to the card authorization.
AcquirerData *ReceiptAcquirerData `json:"acquirer_data,omitempty"`
// EMV-specific metadata returned for card-present payments.
EmvData *json.RawMessage `json:"emv_data,omitempty"`
// Merchant details displayed on a transaction receipt.
MerchantData *ReceiptMerchantData `json:"merchant_data,omitempty"`
// Transaction details displayed on a receipt.
TransactionData *ReceiptTransaction `json:"transaction_data,omitempty"`
}
Structured receipt details for a transaction. The transaction's `amount`, `vat_amount`, and `tip_amount`, as well as event amounts, are returned as decimal strings in major currency units, for example `"10.10"` for EUR 10.10.
type ReceiptAcquirerData ¶ added in v0.14.0
type ReceiptAcquirerData struct {
// Authorization code returned by the acquirer.
AuthorizationCode *string `json:"authorization_code,omitempty"`
// Local timestamp of the card authorization.
LocalTime *string `json:"local_time,omitempty"`
// Return code reported by the acquirer.
ReturnCode *string `json:"return_code,omitempty"`
// Identifier of the terminal used for the authorization.
Tid *string `json:"tid,omitempty"`
}
Acquirer-specific metadata related to the card authorization.
type ReceiptCard ¶ added in v0.14.0
type ReceiptCard struct {
// Last four digits of the payment card number.
Last4Digits *string `json:"last_4_digits,omitempty"`
// Issuing card network of the payment card.
Type *string `json:"type,omitempty"`
}
Payment card details displayed on the receipt.
type ReceiptEvent ¶ added in v0.14.0
type ReceiptEvent struct {
// Amount associated with the transaction event, in major units.
// Format: double
Amount *json.Number `json:"amount,omitempty"`
// Numeric identifier of a transaction event. Use it as `tx_event_id` when requesting receipt details for a
// specific event. This is separate from the transaction ID and the transaction history pagination references.
// Format: int64
ID *TransactionEventID `json:"id,omitempty"`
// Receipt number associated with the event.
ReceiptNo *string `json:"receipt_no,omitempty"`
// Status of the transaction event.
//
// Not every value is used for every event type.
//
// - `PENDING`: The event has been created but is not final yet. Used for events that are still being processed and
// whose final outcome is not known yet.
// - `SCHEDULED`: The event is planned for a future payout cycle but has not been executed yet. This applies to
// payout events before money is actually sent out.
// - `RECONCILED`: The underlying payment has been matched with settlement data and is ready to continue through
// payout processing, but the funds have not been paid out yet. This applies to payout events.
// - `PAID_OUT`: The payout event has been completed and the funds were included in a merchant payout.
// - `REFUNDED`: A refund event has been accepted and recorded in the refund flow. This is the status returned for
// refund events once the transaction amount is being or has been returned to the payer.
// - `SUCCESSFUL`: The event completed successfully. Use this as the generic terminal success status for event
// types that do not expose a more specific business outcome such as `PAID_OUT` or `REFUNDED`.
// - `FAILED`: The event could not be completed. Typical examples are a payout that could not be executed or
// an event that was rejected during processing.
Status *TransactionEventStatus `json:"status,omitempty"`
// The timestamp of when the transaction event occurred.
Timestamp *time.Time `json:"timestamp,omitempty"`
// Unique identifier of the transaction.
TransactionID *TransactionID `json:"transaction_id,omitempty"`
// Financial event associated with a transaction.
//
// - `PAYOUT`: Funds from the transaction being prepared for or included in a merchant payout. Check the event
// status to determine whether they have been paid out.
// - `REFUND`: Money returned to the payer.
// - `CHARGE_BACK`: A reversal of the payment following a chargeback.
// - `PAYOUT_DEDUCTION`: An amount deducted from a merchant payout, for example to cover a refund or chargeback.
Type *TransactionEventType `json:"type,omitempty"`
}
Transaction event details as rendered on the receipt.
type ReceiptMerchantData ¶ added in v0.14.0
type ReceiptMerchantData struct {
// Locale used for rendering localized receipt fields.
Locale *string `json:"locale,omitempty"`
// Merchant profile details displayed on the receipt.
MerchantProfile *ReceiptMerchantDataMerchantProfile `json:"merchant_profile,omitempty"`
}
Merchant details displayed on a transaction receipt.
type ReceiptMerchantDataMerchantProfile ¶ added in v0.14.0
type ReceiptMerchantDataMerchantProfile struct {
// Business address of the merchant.
Address *ReceiptMerchantDataMerchantProfileAddress `json:"address,omitempty"`
// Business name of the merchant.
BusinessName *string `json:"business_name,omitempty"`
// Company registration number of the merchant.
CompanyRegistrationNumber *string `json:"company_registration_number,omitempty"`
// Email address of the merchant.
Email *string `json:"email,omitempty"`
// Language configured for the merchant profile.
Language *string `json:"language,omitempty"`
// Short unique identifier for the merchant.
MerchantCode *string `json:"merchant_code,omitempty"`
// VAT identification number of the merchant.
VATID *string `json:"vat_id,omitempty"`
// Website of the merchant.
Website *string `json:"website,omitempty"`
}
Merchant profile details displayed on the receipt.
type ReceiptMerchantDataMerchantProfileAddress ¶ added in v0.14.0
type ReceiptMerchantDataMerchantProfileAddress struct {
// First line of the merchant address.
AddressLine1 *string `json:"address_line_1,omitempty"`
// Second line of the merchant address.
AddressLine2 *string `json:"address_line_2,omitempty"`
// City of the merchant address.
City *string `json:"city,omitempty"`
// Two-letter ISO 3166-1 alpha-2 country code of the merchant address.
Country *string `json:"country,omitempty"`
// English name of the country in the merchant address.
CountryEnName *string `json:"country_en_name,omitempty"`
// Localized name of the country in the merchant address.
CountryNativeName *string `json:"country_native_name,omitempty"`
// Landline phone number of the merchant.
Landline *string `json:"landline,omitempty"`
// Postal code of the merchant address.
PostCode *string `json:"post_code,omitempty"`
// Region or state of the merchant address.
RegionName *string `json:"region_name,omitempty"`
}
Business address of the merchant.
type ReceiptReader ¶ added in v0.15.2
type ReceiptReader struct {
// Unique identifier of the physical card reader.
Code *string `json:"code,omitempty"`
// Model of the physical card reader.
Type *string `json:"type,omitempty"`
}
Card reader details displayed on the receipt.
type ReceiptTransaction ¶ added in v0.14.0
type ReceiptTransaction struct {
// Total transaction amount, in major units.
Amount *string `json:"amount,omitempty"`
// Payment card details displayed on the receipt.
Card *ReceiptCard `json:"card,omitempty"`
// Card reader details displayed on the receipt.
CardReader *ReceiptReader `json:"card_reader,omitempty"`
// Three-letter ISO 4217 currency code of the transaction.
Currency *string `json:"currency,omitempty"`
// Entry mode of the payment details.
EntryMode *string `json:"entry_mode,omitempty"`
// Transaction events displayed on the receipt.
Events []ReceiptEvent `json:"events,omitempty"`
// Number of installments.
InstallmentsCount *int `json:"installments_count,omitempty"`
// Short unique identifier for the merchant.
MerchantCode *string `json:"merchant_code,omitempty"`
// Payment type used for the transaction.
PaymentType *string `json:"payment_type,omitempty"`
// Whether the transaction was processed as credit or debit.
ProcessAs *ReceiptTransactionProcessA `json:"process_as,omitempty"`
// Products associated with the transaction.
Products []ReceiptTransactionProduct `json:"products,omitempty"`
// Receipt number associated with the transaction.
ReceiptNo *string `json:"receipt_no,omitempty"`
// Current processing status of the transaction.
Status *string `json:"status,omitempty"`
// The timestamp of when the transaction was created.
Timestamp *time.Time `json:"timestamp,omitempty"`
// Tip included in the transaction amount, in major units.
TipAmount *string `json:"tip_amount,omitempty"`
// Transaction code returned after processing the transaction.
TransactionCode *string `json:"transaction_code,omitempty"`
// Unique identifier of the transaction.
TransactionID *TransactionID `json:"transaction_id,omitempty"`
// VAT included in the transaction amount, in major units.
VATAmount *string `json:"vat_amount,omitempty"`
// VAT breakdown for the transaction.
VATRates []ReceiptTransactionVATRate `json:"vat_rates,omitempty"`
// Cardholder verification method.
VerificationMethod *string `json:"verification_method,omitempty"`
}
Transaction details displayed on a receipt.
type ReceiptTransactionProcessA ¶ added in v0.15.2
type ReceiptTransactionProcessA string
Whether the transaction was processed as credit or debit.
const ( ReceiptTransactionProcessACredit ReceiptTransactionProcessA = "CREDIT" ReceiptTransactionProcessADebit ReceiptTransactionProcessA = "DEBIT" )
type ReceiptTransactionProduct ¶ added in v0.14.0
type ReceiptTransactionProduct struct {
// Product description.
Description *string `json:"description,omitempty"`
// Product name.
Name *string `json:"name,omitempty"`
// Product price.
// Format: double
Price *json.Number `json:"price,omitempty"`
// Product price including VAT.
// Format: double
PriceWithVAT *json.Number `json:"price_with_vat,omitempty"`
// Product quantity.
// Format: int64
Quantity *int64 `json:"quantity,omitempty"`
// VAT amount for a single product.
// Format: double
SingleVATAmount *json.Number `json:"single_vat_amount,omitempty"`
// Total price calculated as the product price multiplied by the quantity.
// Format: double
TotalPrice *json.Number `json:"total_price,omitempty"`
// Total product price including VAT.
// Format: double
TotalWithVAT *json.Number `json:"total_with_vat,omitempty"`
// Total VAT amount for the product quantity.
// Format: double
VATAmount *json.Number `json:"vat_amount,omitempty"`
// VAT rate.
// Format: double
VATRate *json.Number `json:"vat_rate,omitempty"`
}
ReceiptTransactionProduct is a schema definition.
type ReceiptTransactionVATRate ¶ added in v0.14.0
type ReceiptTransactionVATRate struct {
// Gross amount to which the VAT rate applies.
Gross *float32 `json:"gross,omitempty"`
// Net amount to which the VAT rate applies.
Net *float32 `json:"net,omitempty"`
// VAT rate applied to the transaction amount.
Rate *float32 `json:"rate,omitempty"`
// VAT amount included in the gross amount.
VAT *float32 `json:"vat,omitempty"`
}
ReceiptTransactionVATRate is a schema definition.
type ReceiptsClient ¶ added in v0.14.0
type ReceiptsClient struct {
// contains filtered or unexported fields
}
ReceiptsClient provides access to the Receipts API.
Retrieve structured receipt data for a transaction, including payment, merchant, and acquirer details. Use this data to display a receipt in your application. The response is JSON, rather than a rendered receipt document.
func NewReceiptsClient ¶ added in v0.14.0
func NewReceiptsClient(c *client.Client) *ReceiptsClient
func (*ReceiptsClient) Get ¶ added in v0.14.0
func (c *ReceiptsClient) Get(ctx context.Context, transactionID string, params ReceiptsGetParams) (*Receipt, error)
Retrieves structured receipt data for a transaction belonging to the merchant specified by `mid`. The path accepts either the SumUp transaction ID or transaction code. Provide `tx_event_id` to include a specific transaction event, such as a refund, on the receipt.
type ReceiptsGetParams ¶ added in v0.14.0
type ReceiptsGetParams struct {
// Short unique identifier for the merchant.
Mid string
// Unique identifier of the transaction event to include on the receipt.
TxEventID *int
}
ReceiptsGetParams are query parameters for GetReceipt.
func (*ReceiptsGetParams) QueryValues ¶ added in v0.14.0
func (p *ReceiptsGetParams) QueryValues() url.Values
QueryValues converts ReceiptsGetParams into url.Values.
type Reference ¶ added in v0.22.0
type Reference string
The reference to the actual payment used for this sale, e.g. the sumup transaction code. Max length: 50
type ResourceType ¶ added in v0.14.0
type ResourceType string
The type of the membership resource. Possible values are: * `merchant` - merchant account(s) * `organization` - organization(s)
type Role ¶ added in v0.14.0
type Role struct {
// The timestamp of when the role was created.
CreatedAt time.Time `json:"created_at"`
// User-defined description of the role.
Description *string `json:"description,omitempty"`
// Unique identifier of the role.
ID string `json:"id"`
// True if the role is provided by SumUp.
IsPredefined bool `json:"is_predefined"`
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,omitempty"`
// User-defined name of the role.
Name string `json:"name"`
// List of permission granted by this role.
// Max items: 100
Permissions []string `json:"permissions"`
// The timestamp of when the role was last updated.
UpdatedAt time.Time `json:"updated_at"`
}
A custom role that can be used to assign set of permissions to members.
type RoleCreatedEvent ¶ added in v0.22.0
type RoleCreatedEvent struct{ TypedEvent[Role] }
RoleCreatedEvent is a roles.created notification. FetchObject retrieves the latest Role.
type RoleDeletedEvent ¶ added in v0.22.0
type RoleDeletedEvent struct{ TypedEvent[Role] }
RoleDeletedEvent is a roles.deleted notification. FetchObject retrieves the latest Role.
type RoleUpdatedEvent ¶ added in v0.22.0
type RoleUpdatedEvent struct{ TypedEvent[Role] }
RoleUpdatedEvent is a roles.updated notification. FetchObject retrieves the latest Role.
type RolesClient ¶ added in v0.14.0
type RolesClient struct {
// contains filtered or unexported fields
}
RolesClient provides access to the Roles API.
Endpoints to manage custom roles. Custom roles allow you to tailor roles from individual permissions to match your needs. Once created, you can assign your custom roles to your merchant account members using the memberships.
func NewRolesClient ¶ added in v0.14.0
func NewRolesClient(c *client.Client) *RolesClient
func (*RolesClient) Create ¶ added in v0.14.0
func (c *RolesClient) Create(ctx context.Context, merchantCode string, body RolesCreateParams) (*Role, error)
Create a custom role for the merchant. Roles are defined by the set of permissions that they grant to the members that they are assigned to.
func (*RolesClient) List ¶ added in v0.14.0
func (c *RolesClient) List(ctx context.Context, merchantCode string) (*RolesListResponse, error)
List merchant's custom roles.
func (*RolesClient) Update ¶ added in v0.14.0
func (c *RolesClient) Update(ctx context.Context, merchantCode string, roleID string, body RolesUpdateParams) (*Role, error)
Updates a custom role's name, description, or permissions and returns the updated role.
Providing `permissions` replaces the role's permission list and changes the access granted to members assigned to that role. Omitted fields remain unchanged.
type RolesCreateParams ¶ added in v0.14.0
type RolesCreateParams struct {
// User-defined description of the role.
Description *string `json:"description,omitempty"`
// Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always
// submit whole metadata. Maximum of 64 parameters are allowed in the object.
// Max properties: 64
Metadata Metadata `json:"metadata,omitempty"`
// User-defined name of the role.
Name string `json:"name"`
// User's permissions.
// Min items: 1
// Max items: 100
Permissions []string `json:"permissions"`
}
RolesCreateParams is a schema definition.
type RolesListResponse ¶ added in v0.14.0
type RolesListResponse struct {
Items []Role `json:"items"`
}
RolesListResponse is a schema definition.
type RolesUpdateParams ¶ added in v0.14.0
type RolesUpdateParams struct {
// User-defined description of the role.
Description *string `json:"description,omitempty"`
// User-defined name of the role.
Name *string `json:"name,omitempty"`
// User's permissions.
// Min items: 1
// Max items: 100
Permissions []string `json:"permissions,omitempty"`
}
RolesUpdateParams is a schema definition.
type Sale ¶ added in v0.22.0
type Sale struct {
// Instant when the sale was closed. Always present: non-finalised sales are never returned.
ClosedAt time.Time `json:"closed_at"`
// Instant when the sale was created.
CreatedAt time.Time `json:"created_at"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency Currency `json:"currency"`
// The ID of the sale.
ID string `json:"id"`
// The lines sold in this sale, in the order they were added to the cart.
// Includes merchant fees (`type: "FEE"`) when present; fee details are in `features`.
// Min items: 1
// Max items: 1000
Items []SaleLineItemV10 `json:"items"`
// Human-readable name of the sale (not unique, not the sale id).
// Max length: 160
Name *string `json:"name,omitempty"`
// Optional note attached to the sale, visible on receipts and the UI.
// Max length: 300
Note *string `json:"note,omitempty"`
// Payments on this sale, in the order they were recorded.
// Max items: 1000
Payments []PublicPaymentV10 `json:"payments"`
// Sale-level pricing aggregate, parallel to `LineItemPrice` on each `SaleLineItem`.
//
// Line-level breakdown (unit price, line discounts, per-line taxes) lives on
// `items[].price`. This object holds the rolled-up totals and cart-level
// adjustments that consumers use for receipts and payment reconciliation.
Price SalePriceV10 `json:"price"`
// Information about the source of the sale.
Source SaleSource `json:"source"`
// Lifecycle state of the sale.
// Non-finalised sales are never returned; only fully-paid sales.
State SaleStateV10 `json:"state"`
// The tax mode used by merchant for displaying prices and calculating taxes:
// - NO_TAX: The prices don't contain any taxes, merchant don't report taxes
// - GROSS: The prices used by merchant already include taxes (common in EU), the tax is calculated from the
// gross price
// - NET: The prices used by merchant don't include taxes (common in US), the tax is calculated from the net
// price
// Since tax values can be different for the same net price depending if the tax
// was calculated from gross or net price, this info is necessary to be able to reconcile tax calculations.
TaxMode TaxMode `json:"tax_mode"`
// Identity UUID of the cashier who processed the sale. Omitted when the cashier
// identity is unknown.
// Format: uuid
UserID *string `json:"user_id,omitempty"`
}
Core model of the Sales API. Returned by `GET /sales` and `GET /sales/{sale_id}`.
Non-finalised sales are never returned; only fully-paid sales.
Item lines are `SaleLineItem`. Merchant fees appear as `type: "FEE"` lines; extra fee data is in `features`.
type SaleLineItemV10 ¶ added in v0.22.0
type SaleLineItemV10 struct {
// Categories the line belongs to. A shared optional structure available to any
// line; not a per-type field.
// Max items: 1000
Categories []CategoryV10 `json:"categories,omitempty"`
// Named, typed, type-specific data. New item types add their data here as
// features instead of new schema variants. See `Feature` for per-type examples.
// Max items: 100
Features []FeatureV10 `json:"features,omitempty"`
// Stable identifier of the line within the sale. Used for linking (e.g. deposits).
// Max length: 100
ID string `json:"id"`
// Modifiers customise a line (e.g. "oat milk" on a cappuccino). A shared
// optional structure available to any line; not a per-type field.
// Max items: 50
Modifiers []ModifierItem `json:"modifiers,omitempty"`
// Display name of the line.
// Max length: 250
Name string `json:"name"`
// Optional free-text note attached to the line, visible on receipts.
// Max length: 300
Note *string `json:"note,omitempty"`
// Pricing for a single line, valid for every item type.
//
// Merges the standard amounts (with tax breakdown) and the final amounts (after
// discounts/modifiers).
//
// Totals and tax amounts can be negative for return-like operations (for example
// a deposit with `operation_type` = `RETURN`).
Price LineItemPriceV10 `json:"price"`
// The numerical value representing the quantity in the specified unit.
// Format: double
// Min: 0
Quantity Quantity `json:"quantity"`
// Outward identifiers and links for a line, kept in one place rather than scattered
// per item type.
References *ItemReferencesV10 `json:"references,omitempty"`
// The type of service for this line.
ServiceType *SaleLineItemV10ServiceType `json:"service_type,omitempty"`
// Classifies a sale line. Not a schema subclass.
//
// Known values: `CATALOG`, `DEPOSIT`, `GIFT_CARD`, `CUSTOM`, `FEE`.
//
// `FEE` lines represent merchant-charged fees on the sale (e.g. shipping, service
// charge, surcharge, cancellation). They participate in sale totals like any other
// line; type-specific data is carried in `features` (see `Feature` for the
// conventional feature keys).
//
// This is intentionally an open string, NOT a closed enum: new values are added
// over time as pure data and consumers MUST tolerate unknown values, rendering the
// line from the generic envelope (name, quantity, price, taxes) and reading any
// extra information from `features`.
Type ItemTypeV10 `json:"type"`
// The unit of measure of the item.
UnitOfMeasure UnitOfMeasure `json:"unit_of_measure"`
}
A single line of a sale.
The envelope (id, type, name, quantity, unit_of_measure, price) is stable and type-agnostic: any consumer can render and total a line from these fields alone. Type-specific data is in `features`. There is no per-type object and no discriminator, so a new item type does not change this schema.
type SaleLineItemV10ServiceType ¶ added in v0.22.0
type SaleLineItemV10ServiceType string
The type of service for this line.
const ( SaleLineItemV10ServiceTypeInHouse SaleLineItemV10ServiceType = "IN_HOUSE" SaleLineItemV10ServiceTypeTakeAway SaleLineItemV10ServiceType = "TAKE_AWAY" )
type SalePage ¶ added in v0.22.0
type SalePage struct {
Items []Sale `json:"items"`
// Pagination token for subsequent requests. Should only be set by clients if they have
// received a token in the previous response, and this request is an immediate follow-up
// request to that response to load the subsequent page. Clients should treat this as an
// opaque token and should not attempt to parse it in any way.
PaginationToken *string `json:"pagination_token,omitempty"`
}
Paginated list of `Sale` objects. Results are ordered **newest first** by the newest activity recorded for each sale. See `ListSalesV10`.
type SalePriceV10 ¶ added in v0.22.0
type SalePriceV10 struct {
// Discounts applied at cart level. Item-level discounts remain on
// `items[].price.discounts`.
// Max items: 1000
CartDiscounts []DiscountLine `json:"cart_discounts,omitempty"`
// Final gross total for the sale: sum of `items[].price.total_gross_amount_final`
// after cart-level discounts (tips excluded).
// Same value as search `total_amount`, in minor units according to `Sale.currency.scale`.
// Payment amounts include tips and can therefore differ from this gross total.
GrossAmount SalePriceV10GrossAmount `json:"gross_amount"`
// Final net total for the sale: sum of `items[].price.total_net_amount_final`
// after cart-level discounts (tips excluded).
// In minor units according to `Sale.currency.scale`.
NetAmount SalePriceV10NetAmount `json:"net_amount"`
// Tax lines aggregated across the sale (after cart-level discounts).
// Per-line tax detail remains on `items[].price.taxes` / `taxes_final`.
// Min items: 1
// Max items: 1000
Taxes []TaxLine `json:"taxes"`
}
Sale-level pricing aggregate, parallel to `LineItemPrice` on each `SaleLineItem`.
Line-level breakdown (unit price, line discounts, per-line taxes) lives on `items[].price`. This object holds the rolled-up totals and cart-level adjustments that consumers use for receipts and payment reconciliation.
type SalePriceV10GrossAmount ¶ added in v0.22.0
type SalePriceV10GrossAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Final gross total for the sale: sum of `items[].price.total_gross_amount_final` after cart-level discounts (tips excluded). Same value as search `total_amount`, in minor units according to `Sale.currency.scale`. Payment amounts include tips and can therefore differ from this gross total.
type SalePriceV10NetAmount ¶ added in v0.22.0
type SalePriceV10NetAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Final net total for the sale: sum of `items[].price.total_net_amount_final` after cart-level discounts (tips excluded). In minor units according to `Sale.currency.scale`.
type SaleSearchItem ¶ added in v0.22.0
type SaleSearchItem struct {
// Instant when the sale was closed. Always present: non-finalised sales are never returned.
ClosedAt time.Time `json:"closed_at"`
// Instant when the sale was created.
CreatedAt time.Time `json:"created_at"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency Currency `json:"currency"`
// Sale identifier.
ID string `json:"id"`
// Display name of the sale when set; otherwise a concatenation of item names with
// quantities. Omitted when neither is available.
Name *string `json:"name,omitempty"`
// Lifecycle state of the sale.
// Non-finalised sales are never returned; only fully-paid sales.
State SaleStateV10 `json:"state"`
// Checkout tax mode for the sale. Same values as `Sale.tax_mode`.
TaxMode TaxMode `json:"tax_mode"`
// Final sale gross total after discounts and taxes, excluding tips.
// Same value as `Sale.price.gross_amount`, in minor units according to `currency.scale`.
// Payment amounts include tips and can therefore differ from this total.
TotalAmount SaleSearchItemTotalAmount `json:"total_amount"`
// Identity UUID of the cashier who processed the sale. Omitted when the cashier
// identity is unknown.
// Format: uuid
UserID *string `json:"user_id,omitempty"`
}
Summary row for a sale in search results. Use `GET /sales/{sale_id}` for the full `Sale`.
type SaleSearchItemTotalAmount ¶ added in v0.22.0
type SaleSearchItemTotalAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Final sale gross total after discounts and taxes, excluding tips. Same value as `Sale.price.gross_amount`, in minor units according to `currency.scale`. Payment amounts include tips and can therefore differ from this total.
type SaleSearchRequest ¶ added in v0.22.0
type SaleSearchRequest struct {
// Sale created **on or before** this instant (inclusive).
EndDate *time.Time `json:"end_date,omitempty"`
// Maximum number of results per page.
// Default: 10
// Min: 1
// Max: 25
PaginationLimit *int `json:"pagination_limit,omitempty"`
// Opaque pagination token from a previous search response. Not interchangeable with tokens
// from `GET /sales`.
PaginationToken *string `json:"pagination_token,omitempty"`
// Filters rows by payment outcome. Multiple values match any of them (**OR**). The search
// row does not echo this value.
PaymentStatuses []PaymentStatusFilterV10 `json:"payment_statuses,omitempty"`
// Filters rows by sale lifecycle (`state`). Multiple values match any of them (**OR**).
// Uses the same values as `Sale.state`. Non-finalised sales are never returned; only
// fully-paid sales.
SaleStatuses []SaleStateV10 `json:"sale_statuses,omitempty"`
// Sales channel filter. Multiple values match any of them (**OR**).
SalesChannels []SalesChannelFilterV10 `json:"sales_channels,omitempty"`
// Sale created **on or after** this instant (inclusive).
StartDate *time.Time `json:"start_date,omitempty"`
}
Filter and pagination criteria for `POST /sales/search`. Filters from different categories stack with **logical AND**; multiple values in one array field stack with **logical OR**. Results cover the merchant’s **last two years** of sales (narrow further with `start_date` / `end_date`). Results are sorted **newest first** by sale close date.
type SaleSearchResponse ¶ added in v0.22.0
type SaleSearchResponse struct {
Items []SaleSearchItem `json:"items"`
// Opaque token for the next page of search results.
PaginationToken *string `json:"pagination_token,omitempty"`
}
Search hits and an optional pagination token. Results are ordered **newest first** by sale close date.
type SaleSource ¶ added in v0.22.0
type SaleSource struct {
// The sale_channel is field that indicates the channel through
// which the sale was made. For example, if the sale was made in the merchant app,
// the sale_channel could be POS. If the sale was made on a kiosk, the
// sale_channel is KIOSK.
//
// *Accepted values:* ["POS", "KIOSK", "ONLINE_STORE", "SOLO", "ORDER_AND_PAY", "INVOICE", "BOOKINGS", "ORDER_AGGREGATOR", "SUBSCRIPTIONS",
// "UNKNOWN"].
Channel SalesChannel `json:"channel"`
// An external reference ID for connecting orders/sales between products
// Max length: 250
ExternalID *string `json:"external_id,omitempty"`
// An external reference ID for the sub-channel.
// For example, when channel is BOOKINGS and sub_channel is POS,
// this can hold the OMS order ID while external_id holds the appointment ID.
// Max length: 250
ExternalSubChannelID *string `json:"external_sub_channel_id,omitempty"`
// The sub_channel is an optional field that can be used to provide more
// information about the sale_channel. For example, if the sale_channel is
// ONLINE_PAYMENTS, the sub_channel could be "WIX" or "QR_CODE" or "WOOCOMMERCE".
// Max length: 50
SubChannel *string `json:"sub_channel,omitempty"`
}
Information about the source of the sale.
type SaleStateV10 ¶ added in v0.22.0
type SaleStateV10 string
Lifecycle state of the sale. Non-finalised sales are never returned; only fully-paid sales.
const (
SaleStateV10Closed SaleStateV10 = "CLOSED"
)
type SalesChannel ¶ added in v0.22.0
type SalesChannel string
The sale_channel is field that indicates the channel through which the sale was made. For example, if the sale was made in the merchant app, the sale_channel could be POS. If the sale was made on a kiosk, the sale_channel is KIOSK.
*Accepted values:* ["POS", "KIOSK", "ONLINE_STORE", "SOLO", "ORDER_AND_PAY", "INVOICE", "BOOKINGS", "ORDER_AGGREGATOR", "SUBSCRIPTIONS", "UNKNOWN"].
type SalesChannelFilterV10 ¶ added in v0.22.0
type SalesChannelFilterV10 string
Sale channel filter value. Multi-select uses **OR** within this field.
const ( SalesChannelFilterV10Bookings SalesChannelFilterV10 = "BOOKINGS" SalesChannelFilterV10Invoice SalesChannelFilterV10 = "INVOICE" SalesChannelFilterV10Kiosk SalesChannelFilterV10 = "KIOSK" SalesChannelFilterV10OnlinePayments SalesChannelFilterV10 = "ONLINE_PAYMENTS" SalesChannelFilterV10OnlineStore SalesChannelFilterV10 = "ONLINE_STORE" SalesChannelFilterV10OrderAggregator SalesChannelFilterV10 = "ORDER_AGGREGATOR" SalesChannelFilterV10OrderAndPay SalesChannelFilterV10 = "ORDER_AND_PAY" SalesChannelFilterV10POS SalesChannelFilterV10 = "POS" SalesChannelFilterV10Solo SalesChannelFilterV10 = "SOLO" SalesChannelFilterV10Subscriptions SalesChannelFilterV10 = "SUBSCRIPTIONS" SalesChannelFilterV10Unknown SalesChannelFilterV10 = "UNKNOWN" )
type SalesClient ¶ added in v0.22.0
type SalesClient struct {
// contains filtered or unexported fields
}
SalesClient provides access to the Sales API.
Operations related to reading sales data.
func NewSalesClient ¶ added in v0.22.0
func NewSalesClient(c *client.Client) *SalesClient
func (*SalesClient) GetSaleV10 ¶ added in v0.22.0
func (c *SalesClient) GetSaleV10(ctx context.Context, merchantCode string, saleID string) (*Sale, error)
Returns `Sale` for `sale_id`, including item lines and `payments[]`. Non-finalised sales are never returned; only fully-paid sales.
func (*SalesClient) ListSalesV10 ¶ added in v0.22.0
func (c *SalesClient) ListSalesV10(ctx context.Context, merchantCode string, params SalesListSalesV10Params) (*SalePage, error)
Returns a paginated list of `Sale` objects. Results are sorted **newest first** by the **newest event** recorded for each sale. Pagination tokens follow that order.
Covers the merchant’s **last two years** of sales. Non-finalised sales are never returned; only fully-paid sales. Use `POST /sales/search` for filtered queries.
func (*SalesClient) SearchSalesV10 ¶ added in v0.22.0
func (c *SalesClient) SearchSalesV10(ctx context.Context, merchantCode string, body SalesSearchSalesV10Params) (*SaleSearchResponse, error)
Returns a paginated list of `SaleSearchItem` rows matching filter criteria. Results are sorted **newest first** by **sale close date**.
Filters from different categories stack with **logical AND**; multiple values in one array field stack with **logical OR**. Results cover the merchant’s **last two years** of sales (narrow further with `start_date` / `end_date`). Pagination tokens are not interchangeable with `GET /sales`.
type SalesListSalesV10Params ¶ added in v0.22.0
type SalesListSalesV10Params struct {
// Maximum number of results per page.
PaginationLimit *int
// Pagination token for subsequent requests. Should only be set by clients if they have
// received a token in the previous response, and this request is an immediate follow-up
// request to that response to load the subsequent page. Clients should treat this as an
// opaque token and should not attempt to parse it in any way.
PaginationToken *string
}
SalesListSalesV10Params are query parameters for ListSalesV10.
func (*SalesListSalesV10Params) QueryValues ¶ added in v0.22.0
func (p *SalesListSalesV10Params) QueryValues() url.Values
QueryValues converts SalesListSalesV10Params into url.Values.
type SalesSearchSalesV10Params ¶ added in v0.22.0
type SalesSearchSalesV10Params = SaleSearchRequest
type StatusResponse ¶ added in v0.14.0
type StatusResponse struct {
Data StatusResponseData `json:"data"`
}
Status of a device
type StatusResponseData ¶ added in v0.14.0
type StatusResponseData struct {
// Battery level percentage
// Min: 0
// Max: 100
BatteryLevel *float32 `json:"battery_level,omitempty"`
// Battery temperature in Celsius
BatteryTemperature *int `json:"battery_temperature,omitempty"`
// Type of connection used by the device
ConnectionType *StatusResponseDataConnectionType `json:"connection_type,omitempty"`
// Firmware version of the device
FirmwareVersion *string `json:"firmware_version,omitempty"`
// Timestamp of the last activity from the device
LastActivity *time.Time `json:"last_activity,omitempty"`
// Latest state of the device
State *StatusResponseDataState `json:"state,omitempty"`
// Status of a device
Status StatusResponseDataStatus `json:"status"`
}
StatusResponseData is a schema definition.
type StatusResponseDataConnectionType ¶ added in v0.14.0
type StatusResponseDataConnectionType string
Type of connection used by the device
const ( StatusResponseDataConnectionTypeBtle StatusResponseDataConnectionType = "btle" StatusResponseDataConnectionTypeEdge StatusResponseDataConnectionType = "edge" StatusResponseDataConnectionTypeGprs StatusResponseDataConnectionType = "gprs" StatusResponseDataConnectionTypeLte StatusResponseDataConnectionType = "lte" StatusResponseDataConnectionTypeUmts StatusResponseDataConnectionType = "umts" StatusResponseDataConnectionTypeUsb StatusResponseDataConnectionType = "usb" StatusResponseDataConnectionTypeWiFi StatusResponseDataConnectionType = "Wi-Fi" )
type StatusResponseDataState ¶ added in v0.14.0
type StatusResponseDataState string
Latest state of the device
const ( StatusResponseDataStateIdle StatusResponseDataState = "IDLE" StatusResponseDataStateSelectingTip StatusResponseDataState = "SELECTING_TIP" StatusResponseDataStateUpdatingFirmware StatusResponseDataState = "UPDATING_FIRMWARE" StatusResponseDataStateWaitingForCard StatusResponseDataState = "WAITING_FOR_CARD" StatusResponseDataStateWaitingForPIN StatusResponseDataState = "WAITING_FOR_PIN" StatusResponseDataStateWaitingForSignature StatusResponseDataState = "WAITING_FOR_SIGNATURE" )
type StatusResponseDataStatus ¶ added in v0.14.0
type StatusResponseDataStatus string
Status of a device
const ( StatusResponseDataStatusOffline StatusResponseDataStatus = "OFFLINE" StatusResponseDataStatusOnline StatusResponseDataStatus = "ONLINE" )
type SubaccountsClient ¶ added in v0.14.0
type SubaccountsClient struct {
// contains filtered or unexported fields
}
SubaccountsClient provides access to the Subaccounts API.
Endpoints for managing merchant sub-accounts (operators).
func NewSubaccountsClient ¶ added in v0.14.0
func NewSubaccountsClient(c *client.Client) *SubaccountsClient
func (*SubaccountsClient) CompatGetOperator ¶ added in v0.14.0
func (c *SubaccountsClient) CompatGetOperator(ctx context.Context, operatorID int32) (*Operator, error)
Returns specific operator. Deprecated: Subaccounts API is deprecated, to get a user that's a member of your merchant account please use [Get member](https://developer.sumup.com/api/members/get) instead.
func (*SubaccountsClient) CreateSubAccount ¶ added in v0.14.0
func (c *SubaccountsClient) CreateSubAccount(ctx context.Context, body SubaccountsCreateSubAccountParams) (*Operator, error)
Creates new operator for currently authorized users' merchant. Deprecated: Subaccounts API is deprecated, to create a user in your merchant account please use [Create member](https://developer.sumup.com/api/members/create) instead.
func (*SubaccountsClient) ListSubAccounts ¶ added in v0.14.0
func (c *SubaccountsClient) ListSubAccounts(ctx context.Context, params SubaccountsListSubAccountsParams) (*SubaccountsListSubAccountsResponse, error)
Returns list of operators for currently authorized user's merchant. Deprecated: Subaccounts API is deprecated, to list users in your merchant account please use [List members](https://developer.sumup.com/api/members/list) instead.
func (*SubaccountsClient) UpdateSubAccount ¶ added in v0.14.0
func (c *SubaccountsClient) UpdateSubAccount(ctx context.Context, operatorID int32, body SubaccountsUpdateSubAccountParams) (*Operator, error)
Updates operator. If the operator was disabled and their password is updated they will be unblocked. Deprecated: Subaccounts API is deprecated, to update a user that's a member of your merchant account please use [Update member](https://developer.sumup.com/api/members/update) instead.
type SubaccountsCreateSubAccountParams ¶ added in v0.14.0
type SubaccountsCreateSubAccountParams struct {
Nickname *string `json:"nickname,omitempty"`
// Min length: 8
Password string `json:"password"`
Permissions *SubaccountsCreateSubAccountParamsPermissions `json:"permissions,omitempty"`
// Format: email
Username string `json:"username"`
}
SubaccountsCreateSubAccountParams is a schema definition.
type SubaccountsCreateSubAccountParamsPermissions ¶ added in v0.14.0
type SubaccountsCreateSubAccountParamsPermissions struct {
CreateMotoPayments *bool `json:"create_moto_payments,omitempty"`
CreateReferral *bool `json:"create_referral,omitempty"`
FullTransactionHistoryView *bool `json:"full_transaction_history_view,omitempty"`
RefundTransactions *bool `json:"refund_transactions,omitempty"`
}
SubaccountsCreateSubAccountParamsPermissions is a schema definition.
type SubaccountsListSubAccountsParams ¶ added in v0.14.0
type SubaccountsListSubAccountsParams struct {
// If true the list of operators will include also the primary user.
IncludePrimary *bool
// Search query used to filter users that match given query term.
//
// Current implementation allow querying only over the email address.
// All operators whos email address contains the query string are returned.
Query *string
}
SubaccountsListSubAccountsParams are query parameters for ListSubAccounts.
func (*SubaccountsListSubAccountsParams) QueryValues ¶ added in v0.14.0
func (p *SubaccountsListSubAccountsParams) QueryValues() url.Values
QueryValues converts SubaccountsListSubAccountsParams into url.Values.
type SubaccountsListSubAccountsResponse ¶ added in v0.14.0
type SubaccountsListSubAccountsResponse []Operator
SubaccountsListSubAccountsResponse is a schema definition.
type SubaccountsUpdateSubAccountParams ¶ added in v0.14.0
type SubaccountsUpdateSubAccountParams struct {
Disabled *bool `json:"disabled,omitempty"`
Nickname *string `json:"nickname,omitempty"`
// Min length: 8
Password *string `json:"password,omitempty"`
Permissions *SubaccountsUpdateSubAccountParamsPermissions `json:"permissions,omitempty"`
// Format: email
// Max length: 256
Username *string `json:"username,omitempty"`
}
SubaccountsUpdateSubAccountParams is a schema definition.
type SubaccountsUpdateSubAccountParamsPermissions ¶ added in v0.14.0
type SubaccountsUpdateSubAccountParamsPermissions struct {
CreateMotoPayments *bool `json:"create_moto_payments,omitempty"`
CreateReferral *bool `json:"create_referral,omitempty"`
FullTransactionHistoryView *bool `json:"full_transaction_history_view,omitempty"`
RefundTransactions *bool `json:"refund_transactions,omitempty"`
}
SubaccountsUpdateSubAccountParamsPermissions is a schema definition.
type TaxLine ¶ added in v0.22.0
type TaxLine struct {
// Gross amount after applying the tax.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
GrossAmount TaxLineGrossAmount `json:"gross_amount"`
// Tax ID from the Tax Service (External Id)
// Max length: 100
ID string `json:"id"`
// Tax name, e.g. "MwSt."
// Max length: 255
Name *string `json:"name,omitempty"`
// Net amount before applying the tax.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
NetAmount TaxLineNetAmount `json:"net_amount"`
// The tax rate percentage in minor units (1/100000). For example 19000 = 19%.
// Format: int64
// Min: 0
Percentage *TaxRate `json:"percentage,omitempty"`
// Amount of tax.
// The value of the amount in minor units of the currency according to the Sale.currency.scale.
TaxAmount TaxLineTaxAmount `json:"tax_amount"`
}
Information about tax together with amounts before and after its application such as:
- net amount: taxable net amount, scoped by this tax
- gross amount: amount after applying the tax.
type TaxLineGrossAmount ¶ added in v0.22.0
type TaxLineGrossAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Gross amount after applying the tax. The value of the amount in minor units of the currency according to the Sale.currency.scale.
type TaxLineNetAmount ¶ added in v0.22.0
type TaxLineNetAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Net amount before applying the tax. The value of the amount in minor units of the currency according to the Sale.currency.scale.
type TaxLineTaxAmount ¶ added in v0.22.0
type TaxLineTaxAmount struct {
// Currency ISO 4217 code
Currency string `json:"currency"`
// Amount in minor units (e.g. cents).
Value int `json:"value"`
}
Amount of tax. The value of the amount in minor units of the currency according to the Sale.currency.scale.
type TaxMode ¶ added in v0.22.0
type TaxMode string
The tax mode used by merchant for displaying prices and calculating taxes: - NO_TAX: The prices don't contain any taxes, merchant don't report taxes - GROSS: The prices used by merchant already include taxes (common in EU), the tax is calculated from the gross price - NET: The prices used by merchant don't include taxes (common in US), the tax is calculated from the net price Since tax values can be different for the same net price depending if the tax was calculated from gross or net price, this info is necessary to be able to reconcile tax calculations.
type TaxRate ¶ added in v0.22.0
type TaxRate int64
The tax rate percentage in minor units (1/100000). For example 19000 = 19%. Format: int64 Min: 0
type Timestamps ¶ added in v0.14.0
type Timestamps struct {
// The date and time when the resource was created. This is a string as defined in [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6).
// Read only
CreatedAt time.Time `json:"created_at"`
// The date and time when the resource was last updated. This is a string as defined in [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6).
//
// Read only
UpdatedAt time.Time `json:"updated_at"`
}
Timestamps is a schema definition.
type Token ¶ added in v0.21.0
type Token struct {
// Secret token to pass to the SDK. Treat this value as an opaque string; do not parse it or depend on its format.
AccessToken string `json:"access_token"`
// Remaining lifetime of the token in seconds when the response is created. Tokens expire 15 minutes after creation.
// Request a new token when needed.
// Min: 0
ExpiresIn int `json:"expires_in"`
// Authentication scheme used by the token. Always Bearer.
TokenType TokenTokenType `json:"token_type"`
}
A short-lived credential for the requested merchant account and actions. Pass access_token to a SumUp SDK that supports merchant tokens.
type TokenTokenType ¶ added in v0.21.0
type TokenTokenType string
Authentication scheme used by the token. Always Bearer.
const (
TokenTokenTypeBearer TokenTokenType = "Bearer"
)
type TokensClient ¶ added in v0.21.0
type TokensClient struct {
// contains filtered or unexported fields
}
TokensClient provides access to the Tokens API.
Merchant tokens let your application accept card-present payments with SumUp SDKs that support token-based authentication. Use them when you want users to sign in to your application with your own authentication, then accept payments for a SumUp merchant account.
Create tokens on your backend using one of the [supported authentication methods](https://developer.sumup.com/api/authentication). Keep your authentication credentials on your backend. Return only the short-lived merchant token to your application and pass its `access_token` to the SDK.
Before returning a token, authenticate the user in your application and check that they can accept payments for the requested merchant account. A merchant token is limited to that account and the requested actions, and does not grant permissions beyond those of the identity that created it.
Tokens expire 15 minutes after creation. Use `expires_in` to determine the remaining lifetime and create a new token when needed. This endpoint does not return a refresh token. Treat merchant tokens as secrets: send them over HTTPS and keep them out of URLs, logs, and source code.
func NewTokensClient ¶ added in v0.21.0
func NewTokensClient(c *client.Client) *TokensClient
func (*TokensClient) Create ¶ added in v0.21.0
func (c *TokensClient) Create(ctx context.Context, merchantCode string, body TokensCreateParams) (*Token, error)
Creates a short-lived token for the merchant account identified by `merchant_code` and the requested actions.
Call this endpoint from your backend using a [supported authentication method](https://developer.sumup.com/api/authentication). You must have access to the merchant account. Before returning the token, check that the user signed in to your application is allowed to accept payments for that account.
Pass the returned `access_token` to the SDK. The token expires 15 minutes after creation; use `expires_in` for its remaining lifetime. To continue after it expires, create a new token through this endpoint.
type TokensCreateParams ¶ added in v0.21.0
type TokensCreateParams struct {
// Actions the token allows for this merchant account.
// Unique items only
// Min items: 1
Actions []TokensCreateParamsAction `json:"actions"`
}
TokensCreateParams is a schema definition.
type TokensCreateParamsAction ¶ added in v0.21.0
type TokensCreateParamsAction string
TokensCreateParamsAction is a schema definition.
const (
TokensCreateParamsActionCheckout TokensCreateParamsAction = "checkout"
)
type TransactionBase ¶ added in v0.14.0
type TransactionBase struct {
// Total amount of the transaction in major units of `currency`, for example `10.1` for EUR 10.10.
Amount *float32 `json:"amount,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// Unique identifier of the transaction.
ID *string `json:"id,omitempty"`
// Number of installments for a deferred payment.
// Min: 1
InstallmentsCount *int `json:"installments_count,omitempty"`
// Payment category recorded on a transaction, for example `POS` for a point-of-sale card payment, `ECOM` for
// an online card payment, or `RECURRING` for a recurring card payment. These reporting values are separate from
// the lowercase `payment_type` values used to process checkouts.
PaymentType *PaymentType `json:"payment_type,omitempty"`
// Current status of the transaction.
//
// - `PENDING`: The transaction has been created but its final outcome is not known yet.
// - `SUCCESSFUL`: The transaction completed successfully.
// - `CANCELLED`: The transaction was cancelled or otherwise reversed before completion.
// - `FAILED`: The transaction attempt did not complete successfully.
// - `REFUNDED`: The transaction was refunded in full or in part.
Status *TransactionStatus `json:"status,omitempty"`
// The timestamp of when the transaction was created.
Timestamp *time.Time `json:"timestamp,omitempty"`
// SumUp transaction code, for example `TEENSK4W2K`. Use it to look up the transaction with the `transaction_code` query
// parameter. This is separate from the transaction's `id` and the card issuer's `auth_code`.
TransactionCode *string `json:"transaction_code,omitempty"`
}
Core details shared by transaction resources.
type TransactionCheckoutInfo ¶ added in v0.14.0
type TransactionCheckoutInfo struct {
// Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments.
AuthCode *string `json:"auth_code,omitempty"`
// How the payment details were captured, for example `CHIP` or `CONTACTLESS` for card-present payments and
// `CUSTOMER_ENTRY` for card details entered by the payer. For wallet and alternative payment methods, this can
// identify the method, such as `APPLE_PAY` or `BLIK`.
EntryMode *EntryMode `json:"entry_mode,omitempty"`
// Unique code of the registered merchant to whom the payment is made.
MerchantCode *string `json:"merchant_code,omitempty"`
// Tip included in the total transaction amount, in major units of the transaction's currency.
TipAmount *float32 `json:"tip_amount,omitempty"`
// VAT included in the total transaction amount, in major units of the transaction's currency.
VATAmount *float32 `json:"vat_amount,omitempty"`
}
Checkout-specific fields associated with a transaction.
type TransactionEvent ¶ added in v0.14.0
type TransactionEvent struct {
// Amount of the event in major units of the associated transaction's currency.
// Format: decimal
Amount *float64 `json:"amount,omitempty"`
// Date when the transaction event occurred.
// Format: date
Date *datetime.Date `json:"date,omitempty"`
// Date when the transaction event is due to occur.
// Format: date
DueDate *datetime.Date `json:"due_date,omitempty"`
// Financial event associated with a transaction.
//
// - `PAYOUT`: Funds from the transaction being prepared for or included in a merchant payout. Check the event
// status to determine whether they have been paid out.
// - `REFUND`: Money returned to the payer.
// - `CHARGE_BACK`: A reversal of the payment following a chargeback.
// - `PAYOUT_DEDUCTION`: An amount deducted from a merchant payout, for example to cover a refund or chargeback.
EventType *TransactionEventType `json:"event_type,omitempty"`
// Numeric identifier of a transaction event. Use it as `tx_event_id` when requesting receipt details for a
// specific event. This is separate from the transaction ID and the transaction history pagination references.
// Format: int64
ID *TransactionEventID `json:"id,omitempty"`
// Consecutive number of the installment that is paid. Applicable only to payout events, i.e. `event_type =
// PAYOUT`.
InstallmentNumber *int `json:"installment_number,omitempty"`
// Status of the transaction event.
//
// Not every value is used for every event type.
//
// - `PENDING`: The event has been created but is not final yet. Used for events that are still being processed and
// whose final outcome is not known yet.
// - `SCHEDULED`: The event is planned for a future payout cycle but has not been executed yet. This applies to
// payout events before money is actually sent out.
// - `RECONCILED`: The underlying payment has been matched with settlement data and is ready to continue through
// payout processing, but the funds have not been paid out yet. This applies to payout events.
// - `PAID_OUT`: The payout event has been completed and the funds were included in a merchant payout.
// - `REFUNDED`: A refund event has been accepted and recorded in the refund flow. This is the status returned for
// refund events once the transaction amount is being or has been returned to the payer.
// - `SUCCESSFUL`: The event completed successfully. Use this as the generic terminal success status for event
// types that do not expose a more specific business outcome such as `PAID_OUT` or `REFUNDED`.
// - `FAILED`: The event could not be completed. Typical examples are a payout that could not be executed or
// an event that was rejected during processing.
Status *TransactionEventStatus `json:"status,omitempty"`
// Date and time of the transaction event.
Timestamp *time.Time `json:"timestamp,omitempty"`
}
Detailed information about a transaction event.
type TransactionEventID ¶ added in v0.17.1
type TransactionEventID int64
Numeric identifier of a transaction event. Use it as `tx_event_id` when requesting receipt details for a specific event. This is separate from the transaction ID and the transaction history pagination references. Format: int64
type TransactionEventStatus ¶ added in v0.17.1
type TransactionEventStatus string
Status of the transaction event.
Not every value is used for every event type.
- `PENDING`: The event has been created but is not final yet. Used for events that are still being processed and whose final outcome is not known yet. - `SCHEDULED`: The event is planned for a future payout cycle but has not been executed yet. This applies to payout events before money is actually sent out. - `RECONCILED`: The underlying payment has been matched with settlement data and is ready to continue through payout processing, but the funds have not been paid out yet. This applies to payout events. - `PAID_OUT`: The payout event has been completed and the funds were included in a merchant payout. - `REFUNDED`: A refund event has been accepted and recorded in the refund flow. This is the status returned for refund events once the transaction amount is being or has been returned to the payer. - `SUCCESSFUL`: The event completed successfully. Use this as the generic terminal success status for event types that do not expose a more specific business outcome such as `PAID_OUT` or `REFUNDED`. - `FAILED`: The event could not be completed. Typical examples are a payout that could not be executed or an event that was rejected during processing.
const ( TransactionEventStatusFailed TransactionEventStatus = "FAILED" TransactionEventStatusPaidOut TransactionEventStatus = "PAID_OUT" TransactionEventStatusPending TransactionEventStatus = "PENDING" TransactionEventStatusReconciled TransactionEventStatus = "RECONCILED" TransactionEventStatusRefunded TransactionEventStatus = "REFUNDED" TransactionEventStatusScheduled TransactionEventStatus = "SCHEDULED" TransactionEventStatusSuccessful TransactionEventStatus = "SUCCESSFUL" )
type TransactionEventType ¶ added in v0.17.1
type TransactionEventType string
Financial event associated with a transaction.
- `PAYOUT`: Funds from the transaction being prepared for or included in a merchant payout. Check the event status to determine whether they have been paid out. - `REFUND`: Money returned to the payer. - `CHARGE_BACK`: A reversal of the payment following a chargeback. - `PAYOUT_DEDUCTION`: An amount deducted from a merchant payout, for example to cover a refund or chargeback.
const ( TransactionEventTypeChargeBack TransactionEventType = "CHARGE_BACK" TransactionEventTypePayout TransactionEventType = "PAYOUT" TransactionEventTypePayoutDeduction TransactionEventType = "PAYOUT_DEDUCTION" TransactionEventTypeRefund TransactionEventType = "REFUND" )
type TransactionFull ¶ added in v0.14.0
type TransactionFull struct {
// Total amount of the transaction in major units of `currency`, for example `10.1` for EUR 10.10.
Amount *float32 `json:"amount,omitempty"`
// Authorization code for the transaction sent by the payment card issuer or bank. Applicable only to card payments.
AuthCode *string `json:"auth_code,omitempty"`
// Details of the payment card.
Card *CardResponse `json:"card,omitempty"`
// Client-supplied identifier of the transaction.
ClientTransactionID *string `json:"client_transaction_id,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// Details of the device used to create the transaction.
DeviceInfo *Device `json:"device_info,omitempty"`
// Details of the ELV card account associated with the transaction.
ElvAccount *ElvCardAccount `json:"elv_account,omitempty"`
// How the payment details were captured, for example `CHIP` or `CONTACTLESS` for card-present payments and
// `CUSTOMER_ENTRY` for card details entered by the payer. For wallet and alternative payment methods, this can
// identify the method, such as `APPLE_PAY` or `BLIK`.
EntryMode *EntryMode `json:"entry_mode,omitempty"`
// Compact list of events related to the transaction.
Events []Event `json:"events,omitempty"`
// Total SumUp transaction fee in major units of the transaction's currency.
// Format: decimal
FeeAmount *float64 `json:"fee_amount,omitempty"`
// External transaction identifier supplied by the client.
ForeignTransactionID *string `json:"foreign_transaction_id,omitempty"`
// Indication of the precision of the geographical position received from the payment terminal.
HorizontalAccuracy *HorizontalAccuracy `json:"horizontal_accuracy,omitempty"`
// Unique identifier of the transaction.
ID *string `json:"id,omitempty"`
// Number of installments for a deferred payment.
// Min: 1
InstallmentsCount *int `json:"installments_count,omitempty"`
// Latitude value from the coordinates of the payment location (as received from the payment terminal reader).
// Min: -90
// Max: 90
Lat *Lat `json:"lat,omitempty"`
// List of hyperlinks for accessing related resources.
Links []Link `json:"links,omitempty"`
// Local timestamp of when the transaction was created.
LocalTime *time.Time `json:"local_time,omitempty"`
// Details of the payment location as received from the payment terminal.
Location *TransactionFullLocation `json:"location,omitempty"`
// Longitude value from the coordinates of the payment location (as received from the payment terminal reader).
// Min: -180
// Max: 180
Lon *Lon `json:"lon,omitempty"`
// Unique code of the registered merchant to whom the payment is made.
MerchantCode *string `json:"merchant_code,omitempty"`
// Internal SumUp identifier of the merchant.
// Format: int64
MerchantID *int64 `json:"merchant_id,omitempty"`
// Payment category recorded on a transaction, for example `POS` for a point-of-sale card payment, `ECOM` for
// an online card payment, or `RECURRING` for a recurring card payment. These reporting values are separate from
// the lowercase `payment_type` values used to process checkouts.
PaymentType *PaymentType `json:"payment_type,omitempty"`
// The date of the payout.
// Format: date
PayoutDate *datetime.Date `json:"payout_date,omitempty"`
// Payout plan of the registered user at the time when the transaction was made.
PayoutPlan *TransactionFullPayoutPlan `json:"payout_plan,omitempty"`
// Payout type for the transaction.
PayoutType *TransactionFullPayoutType `json:"payout_type,omitempty"`
// Number of payouts that are made to the registered user specified in the `user` property.
PayoutsReceived *int `json:"payouts_received,omitempty"`
// Total number of payouts to the registered user specified in the `user` property.
PayoutsTotal *int `json:"payouts_total,omitempty"`
// Whether the transaction was processed as credit or debit.
ProcessAs *TransactionFullProcessA `json:"process_as,omitempty"`
// Short description of the payment. The value is taken from the `description` property of the related checkout resource.
ProductSummary *string `json:"product_summary,omitempty"`
// List of products from the merchant's catalogue for which the transaction serves as a payment.
Products []Product `json:"products,omitempty"`
// Simple name of the payment type.
SimplePaymentType *TransactionFullSimplePaymentType `json:"simple_payment_type,omitempty"`
// High-level status of the transaction from the merchant's perspective.
//
// - `PENDING`: The payment has been initiated and is still being processed. A final outcome is not available yet.
//
// - `SUCCESSFUL`: The payment was completed successfully.
// - `PAID_OUT`: The payment was completed successfully and the funds have already been included in a payout to
// the merchant.
// - `FAILED`: The payment did not complete successfully.
// - `CANCELLED`: The payment was cancelled or reversed and is no longer payable or payable to the merchant.
// - `CANCEL_FAILED`: An attempt to cancel or reverse the payment was not completed successfully.
// - `REFUNDED`: The payment was refunded in full or in part.
// - `REFUND_FAILED`: An attempt to refund the payment was not completed successfully.
// - `CHARGEBACK`: The payment was subject to a chargeback.
// - `NON_COLLECTION`: The amount could not be collected from the merchant after a chargeback or related adjustment.
SimpleStatus *TransactionFullSimpleStatus `json:"simple_status,omitempty"`
// Current status of the transaction.
//
// - `PENDING`: The transaction has been created but its final outcome is not known yet.
// - `SUCCESSFUL`: The transaction completed successfully.
// - `CANCELLED`: The transaction was cancelled or otherwise reversed before completion.
// - `FAILED`: The transaction attempt did not complete successfully.
// - `REFUNDED`: The transaction was refunded in full or in part.
Status *TransactionStatus `json:"status,omitempty"`
// Indicates whether tax deduction is enabled for the transaction.
TaxEnabled *bool `json:"tax_enabled,omitempty"`
// The timestamp of when the transaction was created.
Timestamp *time.Time `json:"timestamp,omitempty"`
// Tip included in the total transaction amount, in major units of the transaction's currency.
TipAmount *float32 `json:"tip_amount,omitempty"`
// SumUp transaction code, for example `TEENSK4W2K`. Use it to look up the transaction with the `transaction_code` query
// parameter. This is separate from the transaction's `id` and the card issuer's `auth_code`.
TransactionCode *string `json:"transaction_code,omitempty"`
// Detailed list of events related to the transaction.
TransactionEvents []TransactionEvent `json:"transaction_events,omitempty"`
// Email address of the registered user (merchant) to whom the payment is made.
// Format: email
Username *string `json:"username,omitempty"`
// VAT included in the total transaction amount, in major units of the transaction's currency.
VATAmount *float32 `json:"vat_amount,omitempty"`
// List of VAT rates applicable to the transaction.
VATRates []TransactionFullVATRate `json:"vat_rates,omitempty"`
// Verification method used for the transaction.
VerificationMethod *TransactionFullVerificationMethod `json:"verification_method,omitempty"`
}
Full transaction resource with checkout, payout, and event details.
type TransactionFullLocation ¶ added in v0.14.0
type TransactionFullLocation struct {
// Indication of the precision of the geographical position received from the payment terminal.
HorizontalAccuracy *HorizontalAccuracy `json:"horizontal_accuracy,omitempty"`
// Latitude value from the coordinates of the payment location (as received from the payment terminal reader).
// Min: -90
// Max: 90
Lat *Lat `json:"lat,omitempty"`
// Longitude value from the coordinates of the payment location (as received from the payment terminal reader).
// Min: -180
// Max: 180
Lon *Lon `json:"lon,omitempty"`
}
Details of the payment location as received from the payment terminal.
type TransactionFullPayoutPlan ¶ added in v0.14.0
type TransactionFullPayoutPlan string
Payout plan of the registered user at the time when the transaction was made.
const ( TransactionFullPayoutPlanAcceleratedInstallment TransactionFullPayoutPlan = "ACCELERATED_INSTALLMENT" TransactionFullPayoutPlanSinglePayment TransactionFullPayoutPlan = "SINGLE_PAYMENT" TransactionFullPayoutPlanTrueInstallment TransactionFullPayoutPlan = "TRUE_INSTALLMENT" )
type TransactionFullPayoutType ¶ added in v0.14.0
type TransactionFullPayoutType string
Payout type for the transaction.
const ( TransactionFullPayoutTypeBankAccount TransactionFullPayoutType = "BANK_ACCOUNT" TransactionFullPayoutTypePrepaidCard TransactionFullPayoutType = "PREPAID_CARD" )
type TransactionFullProcessA ¶ added in v0.15.1
type TransactionFullProcessA string
Whether the transaction was processed as credit or debit.
const ( TransactionFullProcessACredit TransactionFullProcessA = "CREDIT" TransactionFullProcessADebit TransactionFullProcessA = "DEBIT" )
type TransactionFullSimplePaymentType ¶ added in v0.14.0
type TransactionFullSimplePaymentType string
Simple name of the payment type.
const ( TransactionFullSimplePaymentTypeApm TransactionFullSimplePaymentType = "APM" TransactionFullSimplePaymentTypeBalance TransactionFullSimplePaymentType = "BALANCE" TransactionFullSimplePaymentTypeBitcoin TransactionFullSimplePaymentType = "BITCOIN" TransactionFullSimplePaymentTypeBoleto TransactionFullSimplePaymentType = "BOLETO" TransactionFullSimplePaymentTypeCard TransactionFullSimplePaymentType = "CARD" TransactionFullSimplePaymentTypeCash TransactionFullSimplePaymentType = "CASH" TransactionFullSimplePaymentTypeCcCustomerEntered TransactionFullSimplePaymentType = "CC_CUSTOMER_ENTERED" TransactionFullSimplePaymentTypeCcSignature TransactionFullSimplePaymentType = "CC_SIGNATURE" TransactionFullSimplePaymentTypeElv TransactionFullSimplePaymentType = "ELV" TransactionFullSimplePaymentTypeElvWithoutSignature TransactionFullSimplePaymentType = "ELV_WITHOUT_SIGNATURE" TransactionFullSimplePaymentTypeEmv TransactionFullSimplePaymentType = "EMV" TransactionFullSimplePaymentTypeManualEntry TransactionFullSimplePaymentType = "MANUAL_ENTRY" TransactionFullSimplePaymentTypeMoto TransactionFullSimplePaymentType = "MOTO" TransactionFullSimplePaymentTypeRecurring TransactionFullSimplePaymentType = "RECURRING" )
type TransactionFullSimpleStatus ¶ added in v0.14.0
type TransactionFullSimpleStatus string
High-level status of the transaction from the merchant's perspective.
- `PENDING`: The payment has been initiated and is still being processed. A final outcome is not available yet.
- `SUCCESSFUL`: The payment was completed successfully. - `PAID_OUT`: The payment was completed successfully and the funds have already been included in a payout to the merchant. - `FAILED`: The payment did not complete successfully. - `CANCELLED`: The payment was cancelled or reversed and is no longer payable or payable to the merchant. - `CANCEL_FAILED`: An attempt to cancel or reverse the payment was not completed successfully. - `REFUNDED`: The payment was refunded in full or in part. - `REFUND_FAILED`: An attempt to refund the payment was not completed successfully. - `CHARGEBACK`: The payment was subject to a chargeback. - `NON_COLLECTION`: The amount could not be collected from the merchant after a chargeback or related adjustment.
const ( TransactionFullSimpleStatusCancelFailed TransactionFullSimpleStatus = "CANCEL_FAILED" TransactionFullSimpleStatusCancelled TransactionFullSimpleStatus = "CANCELLED" TransactionFullSimpleStatusChargeback TransactionFullSimpleStatus = "CHARGEBACK" TransactionFullSimpleStatusFailed TransactionFullSimpleStatus = "FAILED" TransactionFullSimpleStatusNonCollection TransactionFullSimpleStatus = "NON_COLLECTION" TransactionFullSimpleStatusPaidOut TransactionFullSimpleStatus = "PAID_OUT" TransactionFullSimpleStatusPending TransactionFullSimpleStatus = "PENDING" TransactionFullSimpleStatusRefundFailed TransactionFullSimpleStatus = "REFUND_FAILED" TransactionFullSimpleStatusRefunded TransactionFullSimpleStatus = "REFUNDED" TransactionFullSimpleStatusSuccessful TransactionFullSimpleStatus = "SUCCESSFUL" )
type TransactionFullVATRate ¶ added in v0.15.1
type TransactionFullVATRate struct {
// Gross amount of products having this VAT rate applied.
// Format: decimal
Gross *float64 `json:"gross,omitempty"`
// NET amount of products having this VAT rate applied.
// Format: decimal
Net *float64 `json:"net,omitempty"`
// VAT rate.
// Format: decimal
Rate *float64 `json:"rate,omitempty"`
// VAT amount of this rate applied.
// Format: decimal
VAT *float64 `json:"vat,omitempty"`
}
TransactionFullVATRate is a schema definition.
type TransactionFullVerificationMethod ¶ added in v0.14.0
type TransactionFullVerificationMethod string
Verification method used for the transaction.
const ( TransactionFullVerificationMethodNa TransactionFullVerificationMethod = "na" TransactionFullVerificationMethodNone TransactionFullVerificationMethod = "none" TransactionFullVerificationMethodOfflinePIN TransactionFullVerificationMethod = "offline PIN" TransactionFullVerificationMethodOfflinePINSignature TransactionFullVerificationMethod = "offline PIN + signature" TransactionFullVerificationMethodOnlinePIN TransactionFullVerificationMethod = "online PIN" TransactionFullVerificationMethodSignature TransactionFullVerificationMethod = "signature" )
type TransactionHistory ¶ added in v0.14.0
type TransactionHistory struct {
// Total amount of the transaction in major units of `currency`, for example `10.1` for EUR 10.10.
Amount *float32 `json:"amount,omitempty"`
// Issuing card network of the payment card used for the transaction.
CardType *CardType `json:"card_type,omitempty"`
// Client-supplied identifier of the transaction.
ClientTransactionID *string `json:"client_transaction_id,omitempty"`
// Three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the amount.
Currency *Currency `json:"currency,omitempty"`
// Unique identifier of the transaction.
ID *string `json:"id,omitempty"`
// Number of installments for a deferred payment.
// Min: 1
InstallmentsCount *int `json:"installments_count,omitempty"`
// Payment category recorded on a transaction, for example `POS` for a point-of-sale card payment, `ECOM` for
// an online card payment, or `RECURRING` for a recurring card payment. These reporting values are separate from
// the lowercase `payment_type` values used to process checkouts.
PaymentType *PaymentType `json:"payment_type,omitempty"`
// Payout date (if paid out at once).
// Format: date
PayoutDate *datetime.Date `json:"payout_date,omitempty"`
// Payout plan of the registered user at the time when the transaction was made.
PayoutPlan *TransactionHistoryPayoutPlan `json:"payout_plan,omitempty"`
// Payout type.
PayoutType *TransactionHistoryPayoutType `json:"payout_type,omitempty"`
// Number of payouts that are made to the registered user specified in the `user` property.
PayoutsReceived *int `json:"payouts_received,omitempty"`
// Total number of payouts to the registered user specified in the `user` property.
PayoutsTotal *int `json:"payouts_total,omitempty"`
// Short description of the payment. The value is taken from the `description` property of the related checkout resource.
ProductSummary *string `json:"product_summary,omitempty"`
// Total amount refunded for this transaction, in major units of the transaction's currency.
// Format: decimal
RefundedAmount *float64 `json:"refunded_amount,omitempty"`
// Current status of the transaction.
//
// - `PENDING`: The transaction has been created but its final outcome is not known yet.
// - `SUCCESSFUL`: The transaction completed successfully.
// - `CANCELLED`: The transaction was cancelled or otherwise reversed before completion.
// - `FAILED`: The transaction attempt did not complete successfully.
// - `REFUNDED`: The transaction was refunded in full or in part.
Status *TransactionStatus `json:"status,omitempty"`
// The timestamp of when the transaction was created.
Timestamp *time.Time `json:"timestamp,omitempty"`
// SumUp transaction code, for example `TEENSK4W2K`. Use it to look up the transaction with the `transaction_code` query
// parameter. This is separate from the transaction's `id` and the card issuer's `auth_code`.
TransactionCode *string `json:"transaction_code,omitempty"`
// Unique identifier of the transaction.
TransactionID *TransactionID `json:"transaction_id,omitempty"`
// Type of the transaction for the registered user specified in the `user` property.
Type *TransactionHistoryType `json:"type,omitempty"`
// Email address of the registered user (merchant) to whom the payment is made.
// Format: email
User *string `json:"user,omitempty"`
}
Transaction entry returned in history listing responses.
type TransactionHistoryPayoutPlan ¶ added in v0.14.0
type TransactionHistoryPayoutPlan string
Payout plan of the registered user at the time when the transaction was made.
const ( TransactionHistoryPayoutPlanAcceleratedInstallment TransactionHistoryPayoutPlan = "ACCELERATED_INSTALLMENT" TransactionHistoryPayoutPlanSinglePayment TransactionHistoryPayoutPlan = "SINGLE_PAYMENT" TransactionHistoryPayoutPlanTrueInstallment TransactionHistoryPayoutPlan = "TRUE_INSTALLMENT" )
type TransactionHistoryPayoutType ¶ added in v0.15.1
type TransactionHistoryPayoutType string
Payout type.
const ( TransactionHistoryPayoutTypeBankAccount TransactionHistoryPayoutType = "BANK_ACCOUNT" TransactionHistoryPayoutTypePrepaidCard TransactionHistoryPayoutType = "PREPAID_CARD" )
type TransactionHistoryType ¶ added in v0.14.0
type TransactionHistoryType string
Type of the transaction for the registered user specified in the `user` property.
const ( TransactionHistoryTypeChargeBack TransactionHistoryType = "CHARGE_BACK" TransactionHistoryTypePayment TransactionHistoryType = "PAYMENT" TransactionHistoryTypeRefund TransactionHistoryType = "REFUND" )
type TransactionID ¶ added in v0.14.0
type TransactionID string
Unique identifier of the transaction.
type TransactionMixinHistory ¶ added in v0.14.0
type TransactionMixinHistory struct {
// Payout plan of the registered user at the time when the transaction was made.
PayoutPlan *TransactionMixinHistoryPayoutPlan `json:"payout_plan,omitempty"`
// Number of payouts that are made to the registered user specified in the `user` property.
PayoutsReceived *int `json:"payouts_received,omitempty"`
// Total number of payouts to the registered user specified in the `user` property.
PayoutsTotal *int `json:"payouts_total,omitempty"`
// Short description of the payment. The value is taken from the `description` property of the related checkout resource.
ProductSummary *string `json:"product_summary,omitempty"`
}
Additional transaction fields used by history and detailed views.
type TransactionMixinHistoryPayoutPlan ¶ added in v0.14.0
type TransactionMixinHistoryPayoutPlan string
Payout plan of the registered user at the time when the transaction was made.
const ( TransactionMixinHistoryPayoutPlanAcceleratedInstallment TransactionMixinHistoryPayoutPlan = "ACCELERATED_INSTALLMENT" TransactionMixinHistoryPayoutPlanSinglePayment TransactionMixinHistoryPayoutPlan = "SINGLE_PAYMENT" TransactionMixinHistoryPayoutPlanTrueInstallment TransactionMixinHistoryPayoutPlan = "TRUE_INSTALLMENT" )
type TransactionStatus ¶ added in v0.17.0
type TransactionStatus string
Current status of the transaction.
- `PENDING`: The transaction has been created but its final outcome is not known yet. - `SUCCESSFUL`: The transaction completed successfully. - `CANCELLED`: The transaction was cancelled or otherwise reversed before completion. - `FAILED`: The transaction attempt did not complete successfully. - `REFUNDED`: The transaction was refunded in full or in part.
const ( TransactionStatusCancelled TransactionStatus = "CANCELLED" TransactionStatusFailed TransactionStatus = "FAILED" TransactionStatusPending TransactionStatus = "PENDING" TransactionStatusRefunded TransactionStatus = "REFUNDED" TransactionStatusSuccessful TransactionStatus = "SUCCESSFUL" )
type TransactionsClient ¶ added in v0.14.0
type TransactionsClient struct {
// contains filtered or unexported fields
}
TransactionsClient provides access to the Transactions API.
Transactions represent completed or attempted payment operations processed for a merchant account. A transaction contains the core payment result, such as the amount, currency, payment method, creation time, and current high-level status.
In addition to the main payment outcome, a transaction can contain related events that describe what happened after the original payment attempt. These events provide visibility into the financial lifecycle of the transaction, for example: - `PAYOUT`: the payment being prepared for payout or included in a payout to the merchant - `REFUND`: money returned to the payer - `CHARGE_BACK`: money reversed after the original payment - `PAYOUT_DEDUCTION`: an amount deducted from a payout to cover a refund or chargeback
From an integrator's perspective, transactions are the authoritative record of payment outcomes. Use this tag to: - list transactions for reporting, reconciliation, and customer support workflows - retrieve a single transaction when you need the latest payment details - inspect `simple_status` for the current merchant-facing outcome of the payment - inspect `events` or `transaction_events` when you need refund, payout, or chargeback history
Typical workflow: - create and process payments through the Checkouts endpoints - use the Transactions endpoints to read the resulting payment records - use the returned statuses and events to update your own order, accounting, or support systems
func NewTransactionsClient ¶ added in v0.14.0
func NewTransactionsClient(c *client.Client) *TransactionsClient
func (*TransactionsClient) Get ¶ added in v0.14.0
func (c *TransactionsClient) Get(ctx context.Context, merchantCode string, params TransactionsGetParams) (*TransactionFull, error)
Retrieves the full details of an identified transaction. The transaction resource is identified by a query parameter and *one* of following parameters is required: - `id` - `transaction_code` - `foreign_transaction_id` - `client_transaction_id`
func (*TransactionsClient) List ¶ added in v0.14.0
func (c *TransactionsClient) List(ctx context.Context, merchantCode string, params TransactionsListParams) (*TransactionsListResponse, error)
Lists transaction history for the merchant, with optional filters for payment type, status, and date range. The response contains the current page in `items` and pagination query strings in `links`.
To request another page, use the query string from the relevant link's `href` with this history endpoint. Use `changes_since` when retrieving transactions modified since a previous synchronization, including transactions created earlier whose status has changed.
func (*TransactionsClient) Refund ¶ added in v0.14.0
func (c *TransactionsClient) Refund(ctx context.Context, merchantCode string, transactionID string, body TransactionsRefundParams) (*TransactionsRefundResponse, error)
Refunds a transaction identified by its SumUp transaction ID. Omit the request body to request a full refund, or provide `amount` for a partial refund in the transaction's currency.
Retrieve the transaction afterwards to inspect its refunded amount and refund events. The transaction must be eligible for a refund; see the error responses for invalid amounts, permissions, and processing failures.
type TransactionsGetParams ¶ added in v0.14.0
type TransactionsGetParams struct {
// Client-supplied identifier of the transaction.
ClientTransactionID *string
// External transaction identifier supplied by the client.
ForeignTransactionID *string
// Retrieves the transaction resource with the specified transaction ID (the `id` parameter in the transaction resource).
ID *string
// Retrieves the transaction resource with the specified transaction code.
TransactionCode *string
}
TransactionsGetParams are query parameters for GetTransactionV2.1.
func (*TransactionsGetParams) QueryValues ¶ added in v0.14.0
func (p *TransactionsGetParams) QueryValues() url.Values
QueryValues converts TransactionsGetParams into url.Values.
type TransactionsHistoryLink ¶ added in v0.15.1
type TransactionsHistoryLink struct {
// Query string to use with the transaction history endpoint when requesting the linked page. Preserve the returned
// pagination references and query parameters.
Href string `json:"href"`
// Pagination relation indicating which page the link retrieves, for example `next`.
Rel string `json:"rel"`
}
Hypermedia link used for transaction history pagination.
type TransactionsListOrder ¶ added in v0.15.2
type TransactionsListOrder string
TransactionsListOrder is a schema definition. Default: ascending
const ( TransactionsListOrderAscending TransactionsListOrder = "ascending" TransactionsListOrderDescending TransactionsListOrder = "descending" )
type TransactionsListParams ¶ added in v0.14.0
type TransactionsListParams struct {
// Filters the results by the latest modification time of resources and returns only transactions that are modified
// *at or after* the specified timestamp (in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format).
ChangesSince *time.Time
// Filters the returned results by the specified list of entry modes.
EntryModes []EntryMode
// Maximum number of transactions per page. Must be a positive integer. Defaults to `10` when omitted; a page
// can contain fewer results.
Limit *int
// Pagination reference that returns results before the specified reference. Use the value from a returned pagination
// link rather than constructing it yourself. This parameter takes precedence over `newest_time` when both are
// provided.
NewestRef *string
// Filters the results by the creation time of resources and returns only transactions that are created *before*
// the specified timestamp (in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format).
NewestTime *time.Time
// Pagination reference that returns results after the specified reference. Use the value from a returned pagination
// link rather than constructing it yourself. This parameter takes precedence over `oldest_time` when both are
// provided.
OldestRef *string
// Filters the results by the creation time of resources and returns only transactions that are created *at
// or after* the specified timestamp (in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format).
OldestTime *time.Time
// Sort direction for the transaction history. Use `ascending` or `descending`; the default is `ascending`.
Order *TransactionsListOrder
// Filters the returned results by the specified list of payment types used for the transactions.
PaymentTypes []PaymentType
// Filters transactions by the listed final statuses. For multiple values, repeat the query parameter, for example
// `statuses[]=SUCCESSFUL&statuses[]=REFUNDED`.
Statuses []TransactionsListStatusesItem
// Retrieves the transaction resource with the specified transaction code.
TransactionCode *string
// Filters the returned results by the specified list of transaction types.
Types []TransactionsListTypesItem
// Filters transactions by user email. For multiple values, repeat the query parameter, for example `users[]=first@example.com&users[]=second@example.com`.
Users []string
}
TransactionsListParams are query parameters for ListTransactionsV2.1.
func (*TransactionsListParams) QueryValues ¶ added in v0.14.0
func (p *TransactionsListParams) QueryValues() url.Values
QueryValues converts TransactionsListParams into url.Values.
type TransactionsListResponse ¶ added in v0.14.0
type TransactionsListResponse struct {
// Transactions in the current result page.
Items []TransactionHistory `json:"items,omitempty"`
// Pagination links for navigating the transaction history.
Links []TransactionsHistoryLink `json:"links,omitempty"`
}
TransactionsListResponse is a schema definition.
type TransactionsListStatusesItem ¶ added in v0.15.2
type TransactionsListStatusesItem string
TransactionsListStatusesItem is a schema definition.
const ( TransactionsListStatusesItemCancelled TransactionsListStatusesItem = "CANCELLED" TransactionsListStatusesItemChargeBack TransactionsListStatusesItem = "CHARGE_BACK" TransactionsListStatusesItemFailed TransactionsListStatusesItem = "FAILED" TransactionsListStatusesItemRefunded TransactionsListStatusesItem = "REFUNDED" TransactionsListStatusesItemSuccessful TransactionsListStatusesItem = "SUCCESSFUL" )
type TransactionsListTypesItem ¶ added in v0.15.2
type TransactionsListTypesItem string
TransactionsListTypesItem is a schema definition.
const ( TransactionsListTypesItemChargeBack TransactionsListTypesItem = "CHARGE_BACK" TransactionsListTypesItemPayment TransactionsListTypesItem = "PAYMENT" TransactionsListTypesItemRefund TransactionsListTypesItem = "REFUND" )
type TransactionsRefundParams ¶ added in v0.14.0
type TransactionsRefundParams struct {
// Amount to refund in major units of the transaction's currency, for example `5` for EUR 5.00. It must be
// greater than zero and cannot exceed the amount eligible for a refund. Eligibility depends on the transaction and
// country/currency rules. If omitted, the system requests a full refund.
Amount *float32 `json:"amount,omitempty"`
}
Optional amount for partial refunds of transactions.
type TransactionsRefundResponse ¶ added in v0.17.2
type TransactionsRefundResponse = json.RawMessage
TransactionsRefundResponse is a schema definition.
type TypedEvent ¶ added in v0.22.0
type TypedEvent[T any] struct { // ID identifies this notification, including across retries. ID string `json:"id"` // Type is the wire event name, such as members.updated. Type string `json:"type"` // CreatedAt is the time when the event was created. CreatedAt time.Time `json:"created_at"` // Object references the affected API resource. Object EventObject `json:"object"` // contains filtered or unexported fields }
TypedEvent contains common notification fields and fetches its resource as T. Concrete event types are generated from the OpenAPI webhooks. Notifications may be retried or arrive out of order: make processing idempotent and fetch the latest resource when reconciling local state.
func (TypedEvent[T]) EventID ¶ added in v0.22.0
func (e TypedEvent[T]) EventID() string
EventID returns the notification identifier.
func (TypedEvent[T]) EventType ¶ added in v0.22.0
func (e TypedEvent[T]) EventType() string
EventType returns the wire event name.
func (TypedEvent[T]) FetchObject ¶ added in v0.22.0
func (e TypedEvent[T]) FetchObject(ctx context.Context) (*T, error)
FetchObject retrieves the latest resource using the client that parsed the notification.
The URL must have the SumUp API origin. Its path and query are resolved against the client's configured base URL; URL credentials and fragments are ignored. Requests use the client's authentication and transport, with redirects disabled. API failures return an *APIError, which may wrap a *Problem for deleted resources.
type Unauthorized ¶ added in v0.14.0
type Unauthorized struct {
}
401 Unauthorized
func (*Unauthorized) Error ¶ added in v0.14.0
func (e *Unauthorized) Error() string
type UnauthorizedErrors ¶ added in v0.14.0
type UnauthorizedErrors struct {
Detail string `json:"detail"`
// for generic unauthorized responses.
Type *UnauthorizedErrorsType `json:"type,omitempty"`
}
UnauthorizedErrors is a schema definition.
type UnauthorizedErrorsType ¶ added in v0.14.0
type UnauthorizedErrorsType string
Key indicating type of error. Present only for typed 401 responses (e.g. invalid token, invalid password). Absent for generic unauthorized responses.
const ( )
type UnitOfMeasure ¶ added in v0.22.0
type UnitOfMeasure struct {
// The group of the unit of measure.
// Max length: 100
GroupID string `json:"group_id"`
// The specific unit of measure within the group.
// Max length: 100
UnitID string `json:"unit_id"`
// The ratio of the specified unit to the base unit of the group.
// Format: double
UnitRatio float64 `json:"unit_ratio"`
}
The unit of measure of the item.
type UnknownEvent ¶ added in v0.22.0
type UnknownEvent struct{ TypedEvent[json.RawMessage] }
UnknownEvent preserves notifications not yet recognized by this SDK. FetchObject returns the resource as raw JSON.
type UpdateReaderSettingsError ¶ added in v0.21.0
type UpdateReaderSettingsError struct {
Errors UpdateReaderSettingsErrorErrors `json:"errors"`
}
Details of a failed reader settings request.
func (*UpdateReaderSettingsError) Error ¶ added in v0.21.0
func (e *UpdateReaderSettingsError) Error() string
type UpdateReaderSettingsErrorErrors ¶ added in v0.21.0
type UpdateReaderSettingsErrorErrors struct {
// Error message
Detail string `json:"detail"`
// Error code
Type *string `json:"type,omitempty"`
}
UpdateReaderSettingsErrorErrors is a schema definition.
type UpdateReaderSettingsRequest ¶ added in v0.21.0
type UpdateReaderSettingsRequest struct {
// Menu lock configuration. Provide at least one of `enabled` or `passcode`.
// Min properties: 1
MenuLock UpdateReaderSettingsRequestMenuLock `json:"menu_lock"`
}
Menu lock settings to update for a Solo reader.
type UpdateReaderSettingsRequestMenuLock ¶ added in v0.21.0
type UpdateReaderSettingsRequestMenuLock struct {
// Whether menu lock is enabled.
Enabled *bool `json:"enabled,omitempty"`
// Four-digit PIN used to unlock the reader's menu.
// Format: password
// Pattern: ^[0-9]{4}$
Passcode *secret.Secret `json:"passcode,omitempty"`
}
Menu lock configuration. Provide at least one of `enabled` or `passcode`. Min properties: 1
type UpdateReaderSettingsResponse ¶ added in v0.21.0
type UpdateReaderSettingsResponse struct {
Data UpdateReaderSettingsResponseData `json:"data"`
}
Menu lock settings applied to the reader.
type UpdateReaderSettingsResponseData ¶ added in v0.21.0
type UpdateReaderSettingsResponseData struct {
// Settings included in the update. Omitted fields are not returned.
MenuLock UpdateReaderSettingsResponseDataMenuLock `json:"menu_lock"`
// Indicates that the reader applied the settings update.
Status UpdateReaderSettingsResponseDataStatus `json:"status"`
}
UpdateReaderSettingsResponseData is a schema definition.
type UpdateReaderSettingsResponseDataMenuLock ¶ added in v0.21.0
type UpdateReaderSettingsResponseDataMenuLock struct {
// Whether menu lock is enabled.
Enabled *bool `json:"enabled,omitempty"`
// Four-digit PIN used to unlock the reader's menu.
// Format: password
// Pattern: ^[0-9]{4}$
Passcode *secret.Secret `json:"passcode,omitempty"`
}
Settings included in the update. Omitted fields are not returned.
type UpdateReaderSettingsResponseDataStatus ¶ added in v0.21.0
type UpdateReaderSettingsResponseDataStatus string
Indicates that the reader applied the settings update.
const (
UpdateReaderSettingsResponseDataStatusApplied UpdateReaderSettingsResponseDataStatus = "applied"
)
type UpdateReaderSettingsUnprocessableEntity ¶ added in v0.21.0
type UpdateReaderSettingsUnprocessableEntity struct {
Errors UpdateReaderSettingsUnprocessableEntityErrors `json:"errors"`
}
The reader cannot complete the settings request, or the settings are invalid.
func (*UpdateReaderSettingsUnprocessableEntity) Error ¶ added in v0.21.0
func (e *UpdateReaderSettingsUnprocessableEntity) Error() string
type UpdateReaderSettingsUnprocessableEntityErrors ¶ added in v0.21.0
UpdateReaderSettingsUnprocessableEntityErrors is a schema definition.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package datetime provides custom date and time types with JSON marshaling support.
|
Package datetime provides custom date and time types with JSON marshaling support. |
|
example
module
|
|
|
events
command
Receive signed SumUp events with typed callbacks.
|
Receive signed SumUp events with typed callbacks. |
|
full
command
This example demonstrates a complete checkout flow with the SumUp payment widget.
|
This example demonstrates a complete checkout flow with the SumUp payment widget. |
|
oauth2
command
OAuth 2.0 Authorization Code flow with SumUp
|
OAuth 2.0 Authorization Code flow with SumUp |
|
simple
command
|
|
|
cmd/codegen
module
|
|