adyen.gateway module

class adyen.gateway.BaseInteraction

Bases: object

OPTIONAL_FIELDS = ()
REQUIRED_FIELDS = ()
check_fields()

Validate required and optional fields for both requests and responses.

validate()
class adyen.gateway.BaseResponse(client, params)

Bases: adyen.gateway.BaseInteraction

process()
class adyen.gateway.Gateway(settings=None)

Bases: object

MANDATORY_SETTINGS = ('identifier', 'secret_key', 'action_url', 'signer')
build_payment_form_fields(params)
class adyen.gateway.PaymentFormRequest(client, params=None)

Bases: adyen.gateway.BaseInteraction

OPTIONAL_FIELDS = ('merchantSig', 'skinCode', 'recurringContract', 'allowedMethods', 'blockedMethods', 'shopperStatement', 'shopperLocale', 'countryCode', 'resURL', 'merchantReturnData', 'offset', 'deliveryAddressSig', 'deliveryAddressType', 'deliveryAddress.street', 'deliveryAddress.houseNumberOrName', 'deliveryAddress.city', 'deliveryAddress.postalCode', 'deliveryAddress.stateOrProvince', 'deliveryAddress.country', 'billingAddressSig', 'billingAddressType', 'billingAddress.street', 'billingAddress.houseNumberOrName', 'billingAddress.city', 'billingAddress.postalCode', 'billingAddress.stateOrProvince', 'billingAddress.country', 'shopperEmail', 'shopperLocale', 'shopperReference', 'shopperStatement', 'shopperSig', 'shopperType', 'shopper.firstName', 'shopper.infix', 'shopper.lastName', 'shopper.gender', 'shopper.dateOfBirthDayOfMonth', 'shopper.dateOfBirthMonth', 'shopper.dateOfBirthYear', 'shopper.telephoneNumber')
REQUIRED_FIELDS = ('merchantAccount', 'merchantReference', 'shopperReference', 'shopperEmail', 'currencyCode', 'paymentAmount', 'sessionValidity', 'shipBeforeDate')
build_form_fields()
class adyen.gateway.PaymentNotification(client, params)

Bases: adyen.gateway.BaseResponse

Process payment notifications (HTTPS POST from Adyen to our servers).

Payment notifications can have multiple fields. They fall into four categories:

  • required: Must be included.
  • optional: Can be included.
  • additional data: Can be included. Format is ‘additionalData.VALUE’ and we don’t need the data at the moment, so it’s ignored.
  • unexpected: We loudly complain.
OPTIONAL_FIELDS = ('operations', 'originalReference')
REQUIRED_FIELDS = ('currency', 'eventCode', 'eventDate', 'live', 'merchantAccountCode', 'merchantReference', 'paymentMethod', 'pspReference', 'reason', 'success', 'value')
check_fields()

Delete unneeded additional data before validating.

Adyen’s payment notification can come with additional data. It can mostly be turned on and off in the notifications settings, but some bits always seem to be delivered with the new “System communication” setup (instead of the old “notifications” tab in the settings). We currently don’t need any of that data, so we just drop it before validating the notification. :return:

process()
class adyen.gateway.PaymentRedirection(client, params)

Bases: adyen.gateway.BaseResponse

Process payment feedback from the user

When they paid on Adyen and get redirected back to our site. HTTP GET from user’s browser.

OPTIONAL_FIELDS = ('merchantReturnData', 'paymentMethod', 'pspReference')
REQUIRED_FIELDS = ('authResult', 'merchantReference', 'merchantSig', 'shopperLocale', 'skinCode')
process()
validate()