Vue Storefront is now Alokai! Learn More
Extend Payment Request

Extend Payment Request

The guide illustrates how to extend the request sent to Adyen

The session request to Adyen may be extended with custom attributes via the buildCustomSessionAttributes property, which is a function that returns the desired attributes along with their values. The attributes will be concatenated to the already built base payload.

The buildCustomSessionAttributes can be added to the adyen.configuration object inside the middleware.config.js

The basic pattern is the same for all properties.

Here's an example:

middleware.config.js
{
  adyen: {
    // ...
    configuration: {
      // ...
      buildCustomSessionAttributes(params) {
        return {
          nameofProperty: [
            "could",
            "be",
            "an",
            "array"
          ],
          additionalCustomProperty: {
            "now": "this one is an object"
          },
          thirdCustomProperty: "can also be a string"
        };
      }
    }
  }
}

Check the Adyen Doc section on Sessions where you can find available properties to add to your session requests.

Available params

The first argument of the buildCustomSessionAttributes function called params has the following type:

export type buildCustomSessionAttributesParams = {
  payload: CreateSessionRequestPayload;
  payment: PaymentWithFields;
  cart: Cart;
  shopperLocale?: string;
  customerId?: string;
};

The same thing can be done for the payments call with this attribute - buildCustomPaymentAttributes.