adyen-api-go: github.com/zhutik/adyen-api-go Index | Files

package adyen

import "github.com/zhutik/adyen-api-go"

Package adyen is Adyen API Library for GO

Index

Package Files

adyen.go amount.go avs.go boolean.go checkout.go checkout_gateway.go credetials.go cvv.go environment.go modification.go modification_gateway.go notification.go payment.go payment_gateway.go recurring.go recurring_gateway.go response.go signature.go types.go

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 = "v52"

    // RecurringAPIVersion - API version of current recurring API
    RecurringAPIVersion = "v49"

    // 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 = "v52"
)
const (
    DelayedCharge = "DelayedCharge"
    NoShow        = "NoShow"
)

Adjust authorisation reasons

Link https://docs.adyen.com/developers/api-reference/payments-api/modificationrequest/adjustauthorisationmodificationrequest

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

func WithCurrency Uses

func WithCurrency(c string) func(*Adyen)

WithCurrency allows for custom currencies to be provided to the Adyen.

func WithTimeout Uses

func WithTimeout(d time.Duration) func(*Adyen)

WithTimeout allows for a custom timeout to be provided to the underlying HTTP client that's used to communicate with Adyen.

func WithTransport Uses

func WithTransport(transport http.RoundTripper) func(*Adyen)

WithTransport allows customer HTTP transports to be provider to the Adyen

type APIError Uses

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

func (APIError) Error Uses

func (e APIError) Error() string

Error - error interface for ApiError

type AVSResponse Uses

type AVSResponse string

AVSResponse is a type definition for all possible responses from Adyen's AVS system

https://docs.adyen.com/risk-management/avs-checks

const (
    AVSResponse0  AVSResponse = "0 Unknown"
    AVSResponse1  AVSResponse = "1 Address matches, postal code doesn't"
    AVSResponse2  AVSResponse = "2 Neither postal code nor address match"
    AVSResponse3  AVSResponse = "3 AVS unavailable"
    AVSResponse4  AVSResponse = "4 AVS not supported for this card type"
    AVSResponse5  AVSResponse = "5 No AVS data provided"
    AVSResponse6  AVSResponse = "6 Postal code matches, but the address does not match"
    AVSResponse7  AVSResponse = "7 Both postal code and address match"
    AVSResponse8  AVSResponse = "8 Address not checked, postal code unknown"
    AVSResponse9  AVSResponse = "9 Address matches, postal code unknown"
    AVSResponse10 AVSResponse = "10 Address doesn't match, postal code unknown"
    AVSResponse11 AVSResponse = "11 Postal code not checked, address unknown"
    AVSResponse12 AVSResponse = "12 Address matches, postal code not checked"
    AVSResponse13 AVSResponse = "13 Address doesn't match, postal code not checked"
    AVSResponse14 AVSResponse = "14 Postal code matches, address unknown"
    AVSResponse15 AVSResponse = "15 Postal code matches, address not checked"
    AVSResponse16 AVSResponse = "16 Postal code doesn't match, address unknown"
    AVSResponse17 AVSResponse = "17 Postal code doesn't match, address not checked."
    AVSResponse18 AVSResponse = "18 Neither postal code nor address were checked"
    AVSResponse19 AVSResponse = "19 Name and postal code matches"
    AVSResponse20 AVSResponse = "20 Name, address and postal code matches"
    AVSResponse21 AVSResponse = "21 Name and address matches"
    AVSResponse22 AVSResponse = "22 Name matches"
    AVSResponse23 AVSResponse = "23 Postal code matches, name doesn't match"
    AVSResponse24 AVSResponse = "24 Both postal code and address matches, name doesn't match"
    AVSResponse25 AVSResponse = "25 Address matches, name doesn't match"
    AVSResponse26 AVSResponse = "26 Neither postal code, address nor name matches"
)

AVSResponse hard-coded for easy comparison checking later

type AdditionalData Uses

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
    CVCResult                         CVCResult   `json:"cvcResult,omitempty"`
    CVCResultRaw                      string      `json:"cvcResultRaw,omitempty"`
    AVSResult                         AVSResponse `json:"avsResult,omitempty"`
    AVSResultRaw                      string      `json:"avsResultRaw,omitempty"`
}

AdditionalData stores encrypted information about customer's credit card

type Address Uses

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 Uses

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 Uses

type AdjustAuthorisationResponse struct {
    PspReference string `json:"pspReference"`
    Response     string `json:"response"`
}

AdjustAuthorisationResponse is a response for AdjustAuthorisation request

type Adyen Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (a *Adyen) Checkout() *CheckoutGateway

Checkout - returns CheckoutGateway

func (*Adyen) ClientURL Uses

func (a *Adyen) ClientURL(clientID string) string

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 Uses

func (a *Adyen) Modification() *ModificationGateway

Modification - returns ModificationGateway

func (*Adyen) Payment Uses

func (a *Adyen) Payment() *PaymentGateway

Payment - returns PaymentGateway

func (*Adyen) Recurring Uses

func (a *Adyen) Recurring() *RecurringGateway

Recurring - returns RecurringGateway

type Amount Uses

type Amount struct {
    Value    float32 `json:"value"`
    Currency string  `json:"currency"`
}

Amount value/currency representation

func NewAmount Uses

func NewAmount(currency string, amount float32) *Amount

NewAmount - creates Amount instance

Automatically adjust decimal points for the float value Link - https://docs.adyen.com/developers/development-resources/currency-codes

type Authorise Uses

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 Uses

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 Uses

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 Uses

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"`
    FraudResult    *FraudResult    `json:"fraudResult,omitempty"`
    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 Uses

type BrowserInfo struct {
    AcceptHeader string `json:"acceptHeader"`
    UserAgent    string `json:"userAgent"`
}

BrowserInfo hold information on the user browser

type CVCResult Uses

type CVCResult string

CVCResult represents the Adyen translation of CVC codes from issuer https://docs.adyen.com/development-resources/test-cards/cvc-cvv-result-testing

const (
    CVCResult0 CVCResult = "0 Unknown"
    CVCResult1 CVCResult = "1 Matches"
    CVCResult2 CVCResult = "2 Doesn't Match"
    CVCResult3 CVCResult = "3 Not Checked"
    CVCResult4 CVCResult = "4 No CVC/CVV provided, but was required"
    CVCResult5 CVCResult = "5 Issuer not certified for CVC/CVV"
    CVCResult6 CVCResult = "6 No CVC/CVV provided"
)

Constants represented by numerical code they are assigned

type Cancel Uses

type Cancel struct {
    Reference         string `json:"reference"`
    MerchantAccount   string `json:"merchantAccount"`
    OriginalReference string `json:"originalReference"`
}

Cancel structure for Cancel request

type CancelOrRefundResponse Uses

type CancelOrRefundResponse struct {
    PspReference string `json:"pspReference"`
    Response     string `json:"response"`
}

CancelOrRefundResponse is a response structure for Adyen cancelOrRefund

type CancelResponse Uses

type CancelResponse struct {
    PspReference string `json:"pspReference"`
    Response     string `json:"response"`
}

CancelResponse is a response structure for Adyen cancellation

type Capture Uses

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 Uses

type CaptureResponse struct {
    PspReference string `json:"pspReference"`
    Response     string `json:"response"`
}

CaptureResponse is a response structure for Adyen capture

type Card Uses

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 Uses

type CheckoutGateway struct {
    *Adyen
}

CheckoutGateway - allows you to accept all of Adyen's payment methods and flows.

func (*CheckoutGateway) PaymentMethods Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Environment allows clients to be configured for Testing and Production environments.

func ProductionEnvironment Uses

func ProductionEnvironment(random, companyName string) (e Environment, err error)

ProductionEnvironment returns production environment configuration.

func TestEnvironment Uses

func TestEnvironment() (e Environment)

TestEnvironment returns test environment configuration.

func (Environment) BaseURL Uses

func (e Environment) BaseURL(service string, version string) string

BaseURL returns api base url

func (Environment) CheckoutURL Uses

func (e Environment) CheckoutURL(service string, version string) string

CheckoutURL returns the full URL to a Checkout API endpoint.

func (Environment) ClientURL Uses

func (e Environment) ClientURL(clientID string) string

ClientURL returns Adyen Client URL to load external scripts

func (Environment) HppURL Uses

func (e Environment) HppURL(request string) string

HppURL returns Adyen HPP url to execute Hosted Payment Paged API requests

type FraudCheckResult Uses

type FraudCheckResult struct {
    AccountScore int    `json:"accountScore,omitempty"`
    CheckID      int    `json:"checkId,omitempty"`
    Name         string `json:"name,omitempty"`
}

FraudCheckResult hold information of fraud score detail

type FraudResult Uses

type FraudResult struct {
    AccountScore int64    `json:"accountScore,omitempty"`
    Results      []Result `json:"results,omitempty"`
}

FraudResult hold the fraud score of transaction

type ModificationGateway Uses

type ModificationGateway struct {
    *Adyen
}

ModificationGateway - Adyen modification transaction logic, capture, cancel, refunds and e.t.c

func (*ModificationGateway) AdjustAuthorisation Uses

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 Uses

func (a *ModificationGateway) Cancel(req *Cancel) (*CancelResponse, error)

Cancel - Perform cancellation of the authorised transaction

func (*ModificationGateway) CancelOrRefund Uses

func (a *ModificationGateway) CancelOrRefund(req *Cancel) (*CancelOrRefundResponse, error)

CancelOrRefund - Perform cancellation for not captured transaction otherwise perform refund action

func (*ModificationGateway) Capture Uses

func (a *ModificationGateway) Capture(req *Capture) (*CaptureResponse, error)

Capture - Perform capture payment in Adyen

func (*ModificationGateway) Refund Uses

func (a *ModificationGateway) Refund(req *Refund) (*RefundResponse, error)

Refund - perform refund for already captured request

func (*ModificationGateway) TechnicalCancel Uses

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 Uses

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 Uses

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 Uses

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 Uses

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"`
        HmacSignature            string `json:"hmacSignature,omitempty"`
        NOFReasonCode            string `json:"nofReasonCode,omitempty"`
        NOFSchemeCode            string `json:"nofSchemeCode,omitempty"`
        RFIReasonCode            string `json:"rfiReasonCode,omitempty"`
        RFISchemeCode            string `json:"rfiSchemeCode,omitempty"`
        ChargebackReasonCode     string `json:"chargebackReasonCode,omitempty"`
        ChargebackSchemeCode     string `json:"chargebackSchemeCode,omitempty"`
        ARN                      string `json:"arn,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.

func (*NotificationRequestItemData) ValidateSignature Uses

func (n *NotificationRequestItemData) ValidateSignature(adyen *Adyen) (bool, error)

ValidateSignature validate HMAC signature for notification event

Link: https://docs.adyen.com/development-resources/notifications/verify-hmac-signatures#verify-using-your-own-solution

type OneClickPaymentMethodDetails Uses

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 Option Uses

type Option func(*Adyen)

Option allows for custom configuration overrides.

type PaymentGateway Uses

type PaymentGateway struct {
    *Adyen
}

PaymentGateway - Adyen payment transaction logic

func (*PaymentGateway) Authorise Uses

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 Uses

func (a *PaymentGateway) Authorise3D(req *Authorise3D) (*AuthoriseResponse, error)

Authorise3D - Perform authorise payment in Adyen

func (*PaymentGateway) AuthoriseEncrypted Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

type PaymentMethodItems struct {
    ID   string `json:"id"`
    Name string `json:"name"`
}

PaymentMethodItems describes a single payment method.

type PaymentMethodStoredDetails Uses

type PaymentMethodStoredDetails struct {
    Card PaymentMethodCard `json:"card"`
}

PaymentMethodStoredDetails describes the information stored for a OneClick payment.

type PaymentMethodTypes Uses

type PaymentMethodTypes struct {
    Key  string `json:"key"`
    Type string `json:"type"`
}

PaymentMethodTypes describes any additional information associated with a OneClick payment.

type PaymentMethods Uses

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 Uses

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 Uses

type Recurring struct {
    Contract string `json:"contract"`
}

Recurring hold the behavior for a future payment : could be ONECLICK or RECURRING

type RecurringDetail Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

type RecurringGateway struct {
    *Adyen
}

RecurringGateway - Adyen recurring transaction logic

func (*RecurringGateway) DisableRecurring Uses

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 Uses

func (a *RecurringGateway) ListRecurringDetails(req *RecurringDetailsRequest) (*RecurringDetailsResult, error)

ListRecurringDetails - Get list of recurring payments in Adyen

type Refund Uses

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 Uses

type RefundResponse struct {
    PspReference string `json:"pspReference"`
    Response     string `json:"response"`
}

RefundResponse is a response structure for Adyen refund request

type Response Uses

type Response struct {
    *http.Response
    Body []byte
}

Response - Adyen API response structure

type Result Uses

type Result struct {
    FraudCheckResult *FraudCheckResult `json:"FraudCheckResult,omitempty"`
}

Result hold the fraud score detail

type SkipHppRequest Uses

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 Uses

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 Uses

type StringBool bool

StringBool allows us to unmarhsal Adyen Boolean values which appear as strings instead of bools.

func NewStringBool Uses

func NewStringBool(b bool) *StringBool

NewStringBool returns an instance of StringBool representing a given bool

func (StringBool) MarshalJSON Uses

func (b StringBool) MarshalJSON() ([]byte, error)

MarshalJSON marshalls a StringBool to a slice of bytes

func (*StringBool) UnmarshalJSON Uses

func (b *StringBool) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON unmarshalls to a StringBool from a slice of bytes

type TechnicalCancel Uses

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 Uses

type TechnicalCancelResponse struct {
    PspReference string `json:"pspReference"`
    Response     string `json:"response"`
}

TechnicalCancelResponse is a response for TechnicalCancel request

Package adyen imports 14 packages (graph) and is imported by 2 packages. Updated 2020-05-09. Refresh now. Tools for package owners.