• I am getting this error on my checkout screen when customers enter the Expiration Date format incorrectly:

    https://developer.sagepayments.com/docs/errors#400000
    Detail : InvalidRequestData : request.Vault: The field CVV must be a string or array type with a maximum length of ‘4’.

    The format should be MM/YY but the field allows for MM/YYYY. The format is strict and if it is not exact, it will decline the transaction. I have tried adding some js code but it was not successful. The code I tried:

    jQuery(function($){
    $(document.body).on(‘input’, ‘#sagepaymentsusaapi-card-expiry, input[name=”sagepaymentsusaapi-card-expiry”]’, function(){
    let v = this.value.replace(/\D/g, ”).slice(0, 4); // digits only, max 4 (MMYY)
    if (v.length >= 3) v = v.slice(0,2) + ‘/’ + v.slice(2);
    this.value = v;
    });
    });

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi @jmondragon!

    Thanks for providing the details about the issue.

    WooCommerce core doesn’t control the card fields themselves. For PCI compliance, WooCommerce does not handle raw credit card data directly. Instead, the payment gateway integration is responsible for handling the card information.

    The card number, expiration date, and CVV fields including their formatting, masking, and validation are generally rendered and controlled by the payment gateway plugin and its JavaScript/templates. WooCommerce mainly provides the checkout page structure around those fields.

    Since the error you’re seeing is coming from the payment processor and the expiration date needs to follow a specific MM/YY format, I’d recommend contacting the payment gateway plugin’s support team. They are in the best position to confirm whether the expiration-date format is controlled by their integration and provide the appropriate fix.

    I’d also recommend avoiding custom JavaScript changes to the payment fields until you confirm this with the gateway developer, as modifying payment fields directly could interfere with the gateway’s validation or payment flow.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.