Skip to content

Split payment doesn't work with big orders and lots of giftcards #1484

@stefanstankovic1

Description

@stefanstankovic1

Describe the bug
When customers apply multiple gift cards to large orders, the SFCC session quota api.session.maxStringLength (warn: 1200, limit: 2000) first is thrown then later on it is exceeded, causing order to fail. Error originates from the Adyen-PartialPaymentsOrder pipeline at least for release we have.

Adyen cartridge stores increasingly large JSON-serialized data in session.privacy fields during the gift card / partial payments flow. Each time a gift card is added, cumulative data stored grows. With multiple gift cards, the serialized strings exceed the SFCC session string length limits.

The code even has an acknowledging comment at line 75 of partialPayment.js:

session.privacy.giftCardResponse = JSON.stringify({
  ...response.order,    // <-- spreads ordarData
  ...response.amount,   // <-- spreads value
  paymentMethod: response.paymentMethod,
  brand: giftCardBrand,
}); // entire response exceeds string length   <-- Acknowledging the issue

To Reproduce
Steps to reproduce the behavior:

  1. Add lots of different products to the order
  2. Go to checkout
  3. Add multiple gift cards (usually 4+)
  4. Order silently fails

Expected behavior
To be able to pay with lots of gift cards

Additional context
It would be nice if we got this fixed from Adyen side as this needs an architectural fix. There are several ways to fix it, either spliting the data when it's over the warning or creating a custom attribute on basket level that is going to store this data which would give 2 times more space for this.
This again might be broken if customer addeds a large amount of giftcards lets say there order is 500 euros and they have 30 gift cards of 5 euro each. It might again break. Might be good to also block adding new giftcards when we are close to the limit to indicate they have to choose another paymnet method.
Either way the way it should be fixed is up to you but it needs a structural fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions