# Modifying payload of requests sent to Mollie

The integration allows modifying the request's payload before sending it to Mollie.

# Get payment methods

To modify the payload sent to the List payment methods (opens new window) endpoint, use the beforeRequestPaymentMethods hook.

WARNING

The request is handled by the commercetools extension for Mollie (opens new window), which allows overwriting only specific values. You can see a list of available parameters on this page (opens new window).

// middleware.config.js
module.exports = {
  integrations: {
    mollie: {
      location: '@vsf-enterprise/mollie-commercetools/server',
      configuration: {
        // ...
        beforeRequestPaymentMethods: async (context, requestParams, params, payload) => {
          return {
            ...payload,
            issuers: false
          }
        }
    }
  }
};

Method has to return PaymentMethodsRequestParameters type.

# Create order

To modify the payload sent to the Create order (opens new window) endpoint, use the beforeCreatePayment hook.

WARNING

The request is handled by the commercetools extension for Mollie (opens new window), which allows overwriting only specific values. You can see a list of available parameters on this page (opens new window).

// middleware.config.js
module.exports = {
  integrations: {
    mollie: {
      location: '@vsf-enterprise/mollie-commercetools/server',
      configuration: {
        // ...
        beforeCreatePayment: async (params, builtPayload) => {
          return {
            ...payload,
            webhookUrl: 'https://vuestorefront.io/webhook'
          }
        }
    }
  }
};

Method has to return MollieCreatePaymentPayload type.