Skip to content

Pay and add card "stamp" doesn't accept special characters #139

@g-rasse

Description

@g-rasse

Describe the bug

Pay and add card (https://docs.paytrail.com/#/?id=pay-and-add-card) fails on redirectLink when stamp contains special characters other than - or _.

Steps to Reproduce

  1. Navigate to demo app: https://paytrail-debug-zeta.vercel.app/
  2. Alter the stamp input field with any alphanumeric character (or - and _) and see redirectUrl loading in iframe normally.
  3. Alter the stamp input field with any character other than - or _ and see the iframe break

Expected behaviour

Docs should state limitations. Currently only type "string" and maximum length of 200 is described.

Actual behaviour

Use of special characters breaks redirectLink. In a real application this results in a direct redirection to the "cancel" redirect/callback url.

Screenshots

Screenshots of demo app.

Image Image

Additional context

Demo application is only for a quick visual of the issue.

Payload is hardcoded with only the stamp changing:

const body = {
    stamp,
    reference:
      "DON" + new Date().getTime() + Math.floor(Math.random() * 1000000),
    amount: 100 * 100,
    currency: "EUR",
    language: "FI",
    customer: {
      firstName: "John",
      lastName: "Doe",
      email: "[email protected]",
      phone: "1234567890",
    },
    redirectUrls: {
      success: "https://ecom.example.com/cart/success",
      cancel: "https://ecom.example.com/cart/cancel",
    },
    callbackUrls: {
      success: "https://ecom.example.com/cart/success",
      cancel: "https://ecom.example.com/cart/cancel",
    },
  };

Endpoint used: https://services.paytrail.com/tokenization/pay-and-add-card
HTTP-method used: POST

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions