Documentation ¶
Overview ¶
Package adyen is Adyen API Library for GO
Index ¶
- Constants
- Variables
- func WithCurrency(c string) func(*Adyen)
- func WithTimeout(d time.Duration) func(*Adyen)
- func WithTransport(transport http.RoundTripper) func(*Adyen)
- type APIError
- type AdditionalData
- type Address
- type AdjustAuthorisation
- type AdjustAuthorisationResponse
- type Adyen
- type Amount
- type Authorise
- type Authorise3D
- type AuthoriseEncrypted
- type AuthoriseResponse
- type BrowserInfo
- type Cancel
- type CancelOrRefundResponse
- type CancelResponse
- type Capture
- type CaptureResponse
- type Card
- type CheckoutGateway
- type DirectoryLookupRequest
- type DirectoryLookupResponse
- type Environment
- type ModificationGateway
- func (a *ModificationGateway) AdjustAuthorisation(req *AdjustAuthorisation) (*AdjustAuthorisationResponse, error)
- func (a *ModificationGateway) Cancel(req *Cancel) (*CancelResponse, error)
- func (a *ModificationGateway) CancelOrRefund(req *Cancel) (*CancelOrRefundResponse, error)
- func (a *ModificationGateway) Capture(req *Capture) (*CaptureResponse, error)
- func (a *ModificationGateway) Refund(req *Refund) (*RefundResponse, error)
- func (a *ModificationGateway) TechnicalCancel(req *TechnicalCancel) (*TechnicalCancelResponse, error)
- type Name
- type NotificationRequest
- type NotificationRequestItem
- type NotificationRequestItemData
- type OneClickPaymentMethodDetails
- type Option
- type PaymentGateway
- func (a *PaymentGateway) Authorise(req *Authorise) (*AuthoriseResponse, error)
- func (a *PaymentGateway) Authorise3D(req *Authorise3D) (*AuthoriseResponse, error)
- func (a *PaymentGateway) AuthoriseEncrypted(req *AuthoriseEncrypted) (*AuthoriseResponse, error)
- func (a *PaymentGateway) DirectoryLookup(req *DirectoryLookupRequest) (*DirectoryLookupResponse, error)
- func (a *PaymentGateway) GetHPPRedirectURL(req *SkipHppRequest) (string, error)
- type PaymentMethod
- type PaymentMethodCard
- type PaymentMethodDetails
- type PaymentMethodDetailsInfo
- type PaymentMethodItems
- type PaymentMethodStoredDetails
- type PaymentMethodTypes
- type PaymentMethods
- type PaymentMethodsResponse
- type Recurring
- type RecurringDetail
- type RecurringDetailsRequest
- type RecurringDetailsResult
- type RecurringDisableRequest
- type RecurringDisableResponse
- type RecurringGateway
- type Refund
- type RefundResponse
- type Response
- type SkipHppRequest
- type StringBool
- type TechnicalCancel
- type TechnicalCancelResponse
Constants ¶
const ( // DefaultCurrency is the default currency for transactions DefaultCurrency = "EUR" // DefaultClientTimeout is the default timeout used when making // HTTP requests to Adyen. DefaultClientTimeout = time.Second * 10 // PaymentAPIVersion - API version of current payment API PaymentAPIVersion = "v30" // RecurringAPIVersion - API version of current recurring API RecurringAPIVersion = "v25" // PaymentService is used to identify the standard payment workflow. PaymentService = "Payment" // RecurringService is used to identify the recurring payment workflow. RecurringService = "Recurring" // CheckoutAPIVersion - API version of current checkout API CheckoutAPIVersion = "v32" )
const ( DelayedCharge = "DelayedCharge" NoShow = "NoShow" )
Adjust authorisation reasons
const ( RecurringPaymentOneClick = "ONECLICK" RecurringPaymentRecurring = "RECURRING" ShopperInteractionContAuth = "ContAuth" SelectRecurringDetailReferenceLatests = "LATEST" )
One-click functionality gives the shopper the option to store their payment details with the merchant, within the Adyen environment.
In this type of transaction, the shopper needs to enter the CVC code for the transaction to get through.
Link: https://docs.adyen.com/developers/api-reference/payments-api#recurring
const ( // Male to indicate "male" gender Male = "MALE" // Female to indicate "female" gender Female = "FEMALE" // Unknown to indicate "unknown" gender Unknown = "UNKNOWN" )
Variables ¶
var ( // DefaultCurrencyDecimals - default currency decimals DefaultCurrencyDecimals uint = 2 // CurrencyDecimals - https://docs.adyen.com/developers/currency-codes // currencies with 2 decimals stripped out CurrencyDecimals = map[string]uint{ "BHD": 3, "CVE": 0, "DJF": 0, "GNF": 0, "IDR": 0, "JOD": 3, "JPY": 0, "KMF": 0, "KRW": 0, "KWD": 3, "LYD": 3, "OMR": 3, "PYG": 0, "RWF": 0, "TND": 3, "UGX": 0, "VND": 0, "VUV": 0, "XAF": 0, "XOF": 0, "XPF": 0, } )
var Production = Environment{ // contains filtered or unexported fields }
Production - instance of production environment
var Testing = Environment{ // contains filtered or unexported fields }
Testing - instance of testing environment
Functions ¶
func WithCurrency ¶
WithCurrency allows for custom currencies to be provided to the Adyen.
func WithTimeout ¶
WithTimeout allows for a custom timeout to be provided to the underlying HTTP client that's used to communicate with Adyen.
func WithTransport ¶
func WithTransport(transport http.RoundTripper) func(*Adyen)
WithTransport allows customer HTTP transports to be provider to the Adyen
Types ¶
type APIError ¶
type APIError struct { ErrorType string `json:"errorType"` ErrorCode string `json:"errorCode"` Message string `json:"message"` Status int32 `json:"status"` }
APIError - handle error (non 200 status) response from Adyen
type AdditionalData ¶
type AdditionalData struct { Content string `json:"card.encrypted.json,omitempty"` AliasType string `json:"aliasType,omitempty"` Alias string `json:"alias,omitempty"` ExpiryDate string `json:"expiryDate,omitempty"` CardBin string `json:"cardBin,omitempty"` CardSummary string `json:"cardSummary,omitempty"` CardHolderName string `json:"cardHolderName,omitempty"` PaymentMethod string `json:"paymentMethod,omitempty"` CardPaymentMethod string `json:"cardPaymentMethod,omitempty"` CardIssuingCountry string `json:"cardIssuingCountry,omitempty"` RecurringDetailReference string `json:"recurring.recurringDetailReference,omitempty"` ExecuteThreeD *StringBool `json:"executeThreeD,omitempty"` FundingSource string `json:"fundingSource,omitempty"` CustomRoutingFlag string `json:"customRoutingFlag,omitempty"` RequestedTestAcquirerResponseCode int `json:"RequestedTestAcquirerResponseCode,omitempty"` //Used for trigger error from adyen }
AdditionalData stores encrypted information about customer's credit card
type Address ¶
type Address struct { City string `json:"city"` Country string `json:"country"` HouseNumberOrName string `json:"houseNumberOrName"` PostalCode string `json:"postalCode,omitempty"` StateOrProvince string `json:"stateOrProvince,omitempty"` Street string `json:"street"` }
Address - base address type for customer billing and delivery addresses
Link - https://docs.adyen.com/developers/api-reference/common-api#address
type AdjustAuthorisation ¶
type AdjustAuthorisation struct { ModificationAmount *Amount `json:"modificationAmount"` Reference string `json:"reference"` MerchantAccount string `json:"merchantAccount"` OriginalReference string `json:"originalReference"` AdditionalData struct { IndustryUsage string `json:"industryUsage"` } `json:"additionalData,omitempty"` }
AdjustAuthorisation structure for adjusting previously authorised amount
type AdjustAuthorisationResponse ¶
type AdjustAuthorisationResponse struct { PspReference string `json:"pspReference"` Response string `json:"response"` }
AdjustAuthorisationResponse is a response for AdjustAuthorisation request
type Adyen ¶
type Adyen struct { Credentials apiCredentials Currency string MerchantAccount string // contains filtered or unexported fields }
Adyen - base structure with configuration options
- Credentials instance of API creditials to connect to Adyen API
- Currency is a default request currency. Request data overrides this setting
- MerchantAccount is default merchant account to be used. Request data overrides this setting
- client is http client instance
Currency and MerchantAccount should be used only to store the data and be able to use it later. Requests won't be automatically populated with given values
func New ¶
func New(env Environment, username, password string, opts ...Option) *Adyen
New - creates Adyen instance
Description:
- env - Environment for next API calls
- username - API username for authentication
- password - API password for authentication
- opts - an optional collection of functions that allow you to tweak configurations.
You can create new API user there: https://ca-test.adyen.com/ca/ca/config/users.shtml
func NewWithCredentials ¶
func NewWithCredentials(env Environment, creds apiCredentials, opts ...Option) *Adyen
NewWithCredentials - create new Adyen instance with pre-configured credentials.
Description:
- env - Environment for next API calls
- credentials - configured apiCredentials to use when interacting with Adyen.
- opts - an optional collection of functions that allow you to tweak configurations.
New skin can be created there https://ca-test.adyen.com/ca/ca/skin/skins.shtml
func NewWithHMAC ¶
func NewWithHMAC(env Environment, username, password, hmac string, opts ...Option) *Adyen
NewWithHMAC - create new Adyen instance with HPP credentials
Use this constructor when you need to use Adyen HPP API.
Description:
- env - Environment for next API calls
- username - API username for authentication
- password - API password for authentication
- hmac - is generated when new Skin is created in Adyen Customer Area
- opts - an optional collection of functions that allow you to tweak configurations.
New skin can be created there https://ca-test.adyen.com/ca/ca/skin/skins.shtml
func (*Adyen) Checkout ¶
func (a *Adyen) Checkout() *CheckoutGateway
Checkout - returns CheckoutGateway
func (*Adyen) ClientURL ¶
ClientURL - returns URl, that need to loaded in UI, to encrypt Credit Card information
- clientID - Used to load external JS files from Adyen, to encrypt client requests
func (*Adyen) Modification ¶
func (a *Adyen) Modification() *ModificationGateway
Modification - returns ModificationGateway
func (*Adyen) Recurring ¶
func (a *Adyen) Recurring() *RecurringGateway
Recurring - returns RecurringGateway
type Authorise ¶
type Authorise struct { AdditionalData *AdditionalData `json:"additionalData,omitempty"` Card *Card `json:"card,omitempty"` Amount *Amount `json:"amount"` BillingAddress *Address `json:"billingAddress,omitempty"` DeliveryAddress *Address `json:"deliveryAddress,omitempty"` Reference string `json:"reference"` MerchantAccount string `json:"merchantAccount"` ShopperReference string `json:"shopperReference,omitempty"` // Mandatory for recurring payment Recurring *Recurring `json:"recurring,omitempty"` ShopperEmail string `json:"shopperEmail,omitempty"` ShopperInteraction string `json:"shopperInteraction,omitempty"` ShopperIP string `json:"shopperIP,omitempty"` ShopperLocale string `json:"shopperLocale,omitempty"` ShopperName *Name `json:"shopperName,omitempty"` SelectedRecurringDetailReference string `json:"selectedRecurringDetailReference,omitempty"` BrowserInfo *BrowserInfo `json:"browserInfo,omitempty"` // Required for a 3DS process CaptureDelayHours *int `json:"captureDelayHours,omitempty"` }
Authorise structure for Authorisation request (card is not encrypted)
Link - https://docs.adyen.com/developers/api-reference/payments-api#paymentrequest
type Authorise3D ¶
type Authorise3D struct { BillingAddress *Address `json:"billingAddress,omitempty"` DeliveryAddress *Address `json:"deliveryAddress,omitempty"` MD string `json:"md"` MerchantAccount string `json:"merchantAccount"` BrowserInfo *BrowserInfo `json:"browserInfo"` PaResponse string `json:"paResponse"` ShopperEmail string `json:"shopperEmail,omitempty"` ShopperIP string `json:"shopperIP,omitempty"` ShopperLocale string `json:"shopperLocale,omitempty"` ShopperName *Name `json:"shopperName,omitempty"` }
Authorise3D structure for Authorisation request (card is not encrypted)
https://docs.adyen.com/developers/api-reference/payments-api#paymentrequest3d
type AuthoriseEncrypted ¶
type AuthoriseEncrypted struct { AdditionalData *AdditionalData `json:"additionalData,omitempty"` Amount *Amount `json:"amount"` BillingAddress *Address `json:"billingAddress,omitempty"` DeliveryAddress *Address `json:"deliveryAddress,omitempty"` Reference string `json:"reference"` MerchantAccount string `json:"merchantAccount"` ShopperReference string `json:"shopperReference,omitempty"` // Mandatory for recurring payment Recurring *Recurring `json:"recurring,omitempty"` ShopperEmail string `json:"shopperEmail,omitempty"` ShopperInteraction string `json:"shopperInteraction,omitempty"` ShopperIP string `json:"shopperIP,omitempty"` ShopperLocale string `json:"shopperLocale,omitempty"` ShopperName *Name `json:"shopperName,omitempty"` SelectedRecurringDetailReference string `json:"selectedRecurringDetailReference,omitempty"` BrowserInfo *BrowserInfo `json:"browserInfo,omitempty"` // Required for a 3DS process CaptureDelayHours *int `json:"captureDelayHours,omitempty"` }
AuthoriseEncrypted structure for Authorisation request (with encrypted card information)
Link - https://docs.adyen.com/developers/api-reference/payments-api#paymentrequest
type AuthoriseResponse ¶
type AuthoriseResponse struct { PspReference string `json:"pspReference"` ResultCode string `json:"resultCode"` AuthCode string `json:"authCode"` RefusalReason string `json:"refusalReason"` IssuerURL string `json:"issuerUrl"` MD string `json:"md"` PaRequest string `json:"paRequest"` AdditionalData *AdditionalData `json:"additionalData,omitempty"` }
AuthoriseResponse is a response structure for Adyen
Link - https://docs.adyen.com/developers/api-reference/payments-api#paymentresult
type BrowserInfo ¶
type BrowserInfo struct { AcceptHeader string `json:"acceptHeader"` UserAgent string `json:"userAgent"` }
BrowserInfo hold information on the user browser
type Cancel ¶
type Cancel struct { Reference string `json:"reference"` MerchantAccount string `json:"merchantAccount"` OriginalReference string `json:"originalReference"` }
Cancel structure for Cancel request
type CancelOrRefundResponse ¶
type CancelOrRefundResponse struct { PspReference string `json:"pspReference"` Response string `json:"response"` }
CancelOrRefundResponse is a response structure for Adyen cancelOrRefund
type CancelResponse ¶
type CancelResponse struct { PspReference string `json:"pspReference"` Response string `json:"response"` }
CancelResponse is a response structure for Adyen cancellation
type Capture ¶
type Capture struct { ModificationAmount *Amount `json:"modificationAmount"` Reference string `json:"reference"` MerchantAccount string `json:"merchantAccount"` OriginalReference string `json:"originalReference"` }
Capture structure for Capture request
type CaptureResponse ¶
type CaptureResponse struct { PspReference string `json:"pspReference"` Response string `json:"response"` }
CaptureResponse is a response structure for Adyen capture
type Card ¶
type Card struct { Number string `json:"number"` ExpireMonth string `json:"expiryMonth"` ExpireYear string `json:"expiryYear"` Cvc string `json:"cvc"` HolderName string `json:"holderName"` }
Card structure representation
type CheckoutGateway ¶
type CheckoutGateway struct {
*Adyen
}
CheckoutGateway - allows you to accept all of Adyen's payment methods and flows.
func (*CheckoutGateway) PaymentMethods ¶
func (a *CheckoutGateway) PaymentMethods(req *PaymentMethods) (*PaymentMethodsResponse, error)
PaymentMethods - Perform paymentMethods request in Adyen.
Used to get a collection of available payment methods for a merchant.
type DirectoryLookupRequest ¶
type DirectoryLookupRequest struct { CurrencyCode string `url:"currencyCode"` MerchantAccount string `url:"merchantAccount"` PaymentAmount int `url:"paymentAmount"` SkinCode string `url:"skinCode"` MerchantReference string `url:"merchantReference"` SessionsValidity string `url:"sessionValidity"` MerchantSig string `url:"merchantSig"` CountryCode string `url:"countryCode"` ShipBeforeDate string `url:"shipBeforeDate"` }
DirectoryLookupRequest - get list of available payment methods based on skin, country and order details
Description - https://docs.adyen.com/developers/api-reference/hosted-payment-pages-api#directoryrequest CountryCode could be used to test local payment methods, if client's IP is from different country
func (*DirectoryLookupRequest) CalculateSignature ¶
func (r *DirectoryLookupRequest) CalculateSignature(adyen *Adyen) error
CalculateSignature calculate HMAC signature for request
Link: https://docs.adyen.com/developers/payments/accepting-payments/hmac-signature-calculation
type DirectoryLookupResponse ¶
type DirectoryLookupResponse struct {
PaymentMethods []PaymentMethod `json:"paymentMethods"`
}
DirectoryLookupResponse - api response for DirectoryLookupRequest
Description - https://docs.adyen.com/developers/api-reference/hosted-payment-pages-api#directoryresponse
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment allows clients to be configured for Testing and Production environments.
func ProductionEnvironment ¶
func ProductionEnvironment(random, companyName string) (e Environment, err error)
ProductionEnvironment returns production environment configuration.
func TestEnvironment ¶
func TestEnvironment() (e Environment)
TestEnvironment returns test environment configuration.
func (Environment) BaseURL ¶
func (e Environment) BaseURL(service string, version string) string
BaseURL returns api base url
func (Environment) CheckoutURL ¶
func (e Environment) CheckoutURL(service string, version string) string
CheckoutURL returns the full URL to a Checkout API endpoint.
func (Environment) ClientURL ¶
func (e Environment) ClientURL(clientID string) string
ClientURL returns Adyen Client URL to load external scripts
func (Environment) HppURL ¶
func (e Environment) HppURL(request string) string
HppURL returns Adyen HPP url to execute Hosted Payment Paged API requests
func (Environment) OverwriteAPIURL ¶
func (e Environment) OverwriteAPIURL(url string)
OverwriteAPIURL for testing use
type ModificationGateway ¶
type ModificationGateway struct {
*Adyen
}
ModificationGateway - Adyen modification transaction logic, capture, cancel, refunds and e.t.c
func (*ModificationGateway) AdjustAuthorisation ¶
func (a *ModificationGateway) AdjustAuthorisation(req *AdjustAuthorisation) (*AdjustAuthorisationResponse, error)
AdjustAuthorisation - perform adjustAuthorisation request to modify already authorised amount
Link - https://docs.adyen.com/developers/payment-modifications#adjustauthorisation
func (*ModificationGateway) Cancel ¶
func (a *ModificationGateway) Cancel(req *Cancel) (*CancelResponse, error)
Cancel - Perform cancellation of the authorised transaction
func (*ModificationGateway) CancelOrRefund ¶
func (a *ModificationGateway) CancelOrRefund(req *Cancel) (*CancelOrRefundResponse, error)
CancelOrRefund - Perform cancellation for not captured transaction otherwise perform refund action
func (*ModificationGateway) Capture ¶
func (a *ModificationGateway) Capture(req *Capture) (*CaptureResponse, error)
Capture - Perform capture payment in Adyen
func (*ModificationGateway) Refund ¶
func (a *ModificationGateway) Refund(req *Refund) (*RefundResponse, error)
Refund - perform refund for already captured request
func (*ModificationGateway) TechnicalCancel ¶
func (a *ModificationGateway) TechnicalCancel(req *TechnicalCancel) (*TechnicalCancelResponse, error)
TechnicalCancel - perform cancellation without knowing orinal payment reference (PSP), f.e. in case of technical error
Link - https://docs.adyen.com/developers/payment-modifications#technicalcancel
type Name ¶
type Name struct { FirstName string `json:"firstName"` Gender string `json:"gender"` // Should be ENUM (Male, Female, Unknown) from a constants Infix string `json:"infix,omitempty"` LastName string `json:"lastName"` }
Name - generic name structure
Link - https://docs.adyen.com/developers/api-reference/common-api#name
type NotificationRequest ¶
type NotificationRequest struct { Live StringBool `json:"live"` NotificationItems []NotificationRequestItem `json:"notificationItems"` }
NotificationRequest contains environment specification and list of notifications to process
Link - https://docs.adyen.com/developers/api-reference/notifications-api#notificationrequest
type NotificationRequestItem ¶
type NotificationRequestItem struct {
NotificationRequestItem NotificationRequestItemData `json:"NotificationRequestItem"`
}
NotificationRequestItem contains notification details
Depending on notification type, different fields can be populated and send from Adyen ¶
Link - https://docs.adyen.com/developers/api-reference/notifications-api#notificationrequestitem
type NotificationRequestItemData ¶
type NotificationRequestItemData struct { AdditionalData struct { ShopperReference string `json:"shopperReference,omitempty"` ShopperEmail string `json:"shopperEmail,omitempty"` AuthCode string `json:"authCode,omitempty"` CardSummary string `json:"cardSummary,omitempty"` ExpiryDate string `json:"expiryDate,omitempty"` AuthorisedAmountValue string `json:"authorisedAmountValue,omitempty"` AuthorisedAmountCurrency string `json:"authorisedAmountCurrency,omitempty"` } `json:"additionalData,omitempty"` Amount Amount `json:"amount"` PspReference string `json:"pspReference"` EventCode string `json:"eventCode"` EventDate time.Time `json:"eventDate"` // Event date in time.RFC3339 format MerchantAccountCode string `json:"merchantAccountCode"` Operations []string `json:"operations"` MerchantReference string `json:"merchantReference"` OriginalReference string `json:"originalReference,omitempty"` PaymentMethod string `json:"paymentMethod"` Reason string `json:"reason,omitempty"` Success StringBool `json:"success"` }
NotificationRequestItemData contains the NotificationRequestItem data.
type OneClickPaymentMethodDetails ¶
type OneClickPaymentMethodDetails struct { Details []PaymentMethodTypes `json:"details"` Name string `json:"name"` Type string `json:"type"` StoredDetails PaymentMethodStoredDetails `json:"storedDetails"` }
OneClickPaymentMethodDetails describes the OneClickPayment part of a PaymentMethods response.
type PaymentGateway ¶
type PaymentGateway struct {
*Adyen
}
PaymentGateway - Adyen payment transaction logic
func (*PaymentGateway) Authorise ¶
func (a *PaymentGateway) Authorise(req *Authorise) (*AuthoriseResponse, error)
Authorise - Perform authorise payment in Adyen
Used to perform authorisation transaction without credit card data encrypted ¶
NOTE: Due to PCI compliance, it's not recommended to send credit card data to server
Please use AuthoriseEncrypted instead and adyen frontend encryption library
func (*PaymentGateway) Authorise3D ¶
func (a *PaymentGateway) Authorise3D(req *Authorise3D) (*AuthoriseResponse, error)
Authorise3D - Perform authorise payment in Adyen
func (*PaymentGateway) AuthoriseEncrypted ¶
func (a *PaymentGateway) AuthoriseEncrypted(req *AuthoriseEncrypted) (*AuthoriseResponse, error)
AuthoriseEncrypted - Perform authorise payment in Adyen
To perform recurring payment, AuthoriseEncrypted need to have contract specified and shopperReference ¶
Example:
&adyen.AuthoriseEncrypted{ Amount: &adyen.Amount{Value: "2000", Currency: "EUR"}, MerchantAccount: "merchant-account", AdditionalData: &adyen.AdditionalData{Content: r.Form.Get("adyen-encrypted-data")}, // encrypted CC data ShopperReference: "unique-customer-reference", Recurring: &adyen.Recurring{Contract:adyen.RecurringPaymentRecurring} Reference: "some-merchant-reference", } }
adyen.Recurring{Contract:adyen.RecurringPaymentRecurring} as one of the contracts
func (*PaymentGateway) DirectoryLookup ¶
func (a *PaymentGateway) DirectoryLookup(req *DirectoryLookupRequest) (*DirectoryLookupResponse, error)
DirectoryLookup - Execute directory lookup request
Link - https://docs.adyen.com/developers/api-reference/hosted-payment-pages-api
func (*PaymentGateway) GetHPPRedirectURL ¶
func (a *PaymentGateway) GetHPPRedirectURL(req *SkipHppRequest) (string, error)
GetHPPRedirectURL - Generates link, so customer could be redirected to perform Hosted Payment Page payments
Link - https://docs.adyen.com/developers/api-reference/hosted-payment-pages-api
type PaymentMethod ¶
type PaymentMethod struct { BrandCode string `json:"brandCode"` Name string `json:"name"` Logos logos `json:"logos"` Issuers []issuer `json:"issuers"` }
PaymentMethod - structure for single payment method in directory look up response
Part of DirectoryLookupResponse
type PaymentMethodCard ¶
type PaymentMethodCard struct { ExpiryMonth string `json:"expiryMonth"` ExpiryYear string `json:"expiryYear"` HolderName string `json:"holderName"` Number string `json:"number"` }
PaymentMethodCard describes the card information associated with a OneClick payment.
type PaymentMethodDetails ¶
type PaymentMethodDetails struct { Details []PaymentMethodDetailsInfo `json:"details,omitempty"` Name string `json:"name"` Type string `json:"type"` }
PaymentMethodDetails describes the PaymentMethods part of a PaymentMethodsResponse.
type PaymentMethodDetailsInfo ¶
type PaymentMethodDetailsInfo struct { Items []PaymentMethodItems `json:"items"` Key string `json:"key"` Type string `json:"type"` }
PaymentMethodDetailsInfo describes the collection of all payment methods.
type PaymentMethodItems ¶
PaymentMethodItems describes a single payment method.
type PaymentMethodStoredDetails ¶
type PaymentMethodStoredDetails struct {
Card PaymentMethodCard `json:"card"`
}
PaymentMethodStoredDetails describes the information stored for a OneClick payment.
type PaymentMethodTypes ¶
PaymentMethodTypes describes any additional information associated with a OneClick payment.
type PaymentMethods ¶
type PaymentMethods struct { Amount *Amount `json:"amount"` Channel string `json:"channel"` CountryCode string `json:"countryCode"` MerchantAccount string `json:"merchantAccount"` ShopperLocale string `json:"shopperLocale"` ShopperReference string `json:"shopperReference"` }
PaymentMethods contains the fields required by the checkout API's /paymentMethods endpoint. See the following for more information:
https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v32/paymentMethods
type PaymentMethodsResponse ¶
type PaymentMethodsResponse struct { PaymentMethods []PaymentMethodDetails `json:"paymentMethods"` OneClickPaymentMethods []OneClickPaymentMethodDetails `json:"oneClickPaymentMethods,omitempty"` }
PaymentMethodsResponse is returned by Adyen in response to a PaymentMethods request.
type Recurring ¶
type Recurring struct {
Contract string `json:"contract"`
}
Recurring hold the behavior for a future payment : could be ONECLICK or RECURRING
type RecurringDetail ¶
type RecurringDetail struct { Acquirer string `json:"acquirer"` AcquirerAccount string `json:"acquirerAccount"` AdditionalData struct { CardBin string `json:"cardBin"` } `json:"additionalData"` Alias string `json:"alias"` AliasType string `json:"aliasType"` Card Card `json:"card,omitempty"` ContractTypes []string `json:"contractTypes"` CreationDate string `json:"creationDate"` FirstPspReference string `json:"firstPspReference"` PaymentMethodVariant string `json:"paymentMethodVariant"` RecurringDetailReference string `json:"recurringDetailReference"` Variant string `json:"variant"` }
RecurringDetail structure to hold information associated to a recurring payment
Link - https://docs.adyen.com/developers/api-reference/recurring-api#recurringdetail
type RecurringDetailsRequest ¶
type RecurringDetailsRequest struct { MerchantAccount string `json:"merchantAccount"` ShopperReference string `json:"shopperReference,omitempty"` // Not mandatory Recurring *Recurring `json:"recurring,omitempty"` }
RecurringDetailsRequest structure to list all recurring payment associated to a shopperReference
Link - https://docs.adyen.com/developers/api-reference/recurring-api#recurringdetailsrequest
type RecurringDetailsResult ¶
type RecurringDetailsResult struct { CreationDate string `json:"creationDate"` Details []struct { RecurringDetail RecurringDetail `json:"RecurringDetail"` } `json:"details"` InvalidOneclickContracts string `json:"invalidOneclickContracts"` ShopperReference string `json:"shopperReference"` }
RecurringDetailsResult structure to hold the RecurringDetails
Link - https://docs.adyen.com/developers/api-reference/recurring-api#recurringdetailsresult
type RecurringDisableRequest ¶
type RecurringDisableRequest struct { MerchantAccount string `json:"merchantAccount"` ShopperReference string `json:"shopperReference"` // Type of a contract ONECLICK, RECURRING, PAYOUT or combination of them Contract string `json:"contract,omitempty"` // ID of a customer saved payment method, all will be disabled if none is specified RecurringDetailReference string `json:"recurringDetailReference,omitempty"` }
RecurringDisableRequest structure to hold information regarding disable recurring request
If `RecurringDetailReference` is specified, specific payment ID will be disabled otherwise all customer saved payment methods will be disabled
Link - https://docs.adyen.com/developers/api-reference/recurring-api#disablerequest
type RecurringDisableResponse ¶
type RecurringDisableResponse struct {
Response string `json:"response"`
}
RecurringDisableResponse structure to hold response for disable recurring request
Link - https://docs.adyen.com/developers/api-reference/recurring-api#disableresult
type RecurringGateway ¶
type RecurringGateway struct {
*Adyen
}
RecurringGateway - Adyen recurring transaction logic
func (*RecurringGateway) DisableRecurring ¶
func (a *RecurringGateway) DisableRecurring(req *RecurringDisableRequest) (*RecurringDisableResponse, error)
DisableRecurring - disable customer's saved payment method based on a contract type or/and payment method ID
func (*RecurringGateway) ListRecurringDetails ¶
func (a *RecurringGateway) ListRecurringDetails(req *RecurringDetailsRequest) (*RecurringDetailsResult, error)
ListRecurringDetails - Get list of recurring payments in Adyen
type Refund ¶
type Refund struct { ModificationAmount *Amount `json:"modificationAmount"` Reference string `json:"reference"` MerchantAccount string `json:"merchantAccount"` OriginalReference string `json:"originalReference"` }
Refund structure for refund request
type RefundResponse ¶
type RefundResponse struct { PspReference string `json:"pspReference"` Response string `json:"response"` }
RefundResponse is a response structure for Adyen refund request
type SkipHppRequest ¶
type SkipHppRequest struct { MerchantReference string `url:"merchantReference"` PaymentAmount int `url:"paymentAmount"` CurrencyCode string `url:"currencyCode"` ShipBeforeDate string `url:"shipBeforeDate"` SkinCode string `url:"skinCode"` MerchantAccount string `url:"merchantAccount"` ShopperLocale string `url:"shopperLocale"` SessionsValidity string `url:"sessionValidity"` MerchantSig string `url:"merchantSig"` CountryCode string `url:"countryCode"` BrandCode string `url:"brandCode"` IssuerID string `url:"issuerId"` }
SkipHppRequest contains data that would be used to create Adyen HPP redirect URL
Link: https://docs.adyen.com/developers/ecommerce-integration/local-payment-methods
Request description: https://docs.adyen.com/developers/api-reference/hosted-payment-pages-api#skipdetailsrequest
func (*SkipHppRequest) CalculateSignature ¶
func (r *SkipHppRequest) CalculateSignature(adyen *Adyen) error
CalculateSignature calculate HMAC signature for request
Link: https://docs.adyen.com/developers/payments/accepting-payments/hmac-signature-calculation
type StringBool ¶
type StringBool bool
StringBool allows us to unmarhsal Adyen Boolean values which appear as strings instead of bools.
func NewStringBool ¶
func NewStringBool(b bool) *StringBool
NewStringBool returns an instance of StringBool representing a given bool
func (StringBool) MarshalJSON ¶
func (b StringBool) MarshalJSON() ([]byte, error)
MarshalJSON marshalls a StringBool to a slice of bytes
func (*StringBool) UnmarshalJSON ¶
func (b *StringBool) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON unmarshalls to a StringBool from a slice of bytes
type TechnicalCancel ¶
type TechnicalCancel struct { MerchantAccount string `json:"merchantAccount"` OriginalMerchantReference string `json:"originalMerchantReference"` Reference string `json:"reference,omitempty"` }
TechnicalCancel structure for performing technical cancellation
Link - https://docs.adyen.com/developers/payment-modifications#technicalcancel
type TechnicalCancelResponse ¶
type TechnicalCancelResponse struct { PspReference string `json:"pspReference"` Response string `json:"response"` }
TechnicalCancelResponse is a response for TechnicalCancel request