Web
...
Web Integrations
Web SDK

Payment Form Error Messages

Displaying Payment Form Error Messages

The Web SDK is designed to provide feedback quickly and clearly to the consumer.

To display payment form error messages:

  1. Add a div with the id judopay-errors on your page, ideally below the iframe: <div class="judopay-errors"></div>;

The table below displays all errors that can be returned:

ID

Error String

0

Card number can only contain numbers

1

Card number not valid

2

Card type not recognised, please recheck your number

3

{1} is not supported

4

Card number required

5

Card is expired

6

Card expiry date is not valid

7

Expiry date required

8

{0} code too short for {1} card

9

{0} code too long for {1} card

10

{0} code can only contain numbers

11

{0} code required for {1} card

12

Post/Zip code is invalid

13

Sorry, an error has occurred, you have not been charged.

14

Cardholder Name is required

15

Cardholder Name can't be less than 4 characters

16

Cardholder Name can't contain numbers or special characters

For error strings containing {0} and {1}, these will be changed into values depending on the current state of the iframe form. For example:

  • {0} will change to the card verification code acronym. This is named differently depending on the card type (e.g. CVC, CVV).
  • {1} will refer to the detected card type, for example Visa, Mastercard, Diners Club International or Discover.

If the iframe has detected a Visa number, the following error message transform would occur: {0} code too long for {1} card" -> "CVC code to long for Visa card

A similar error with an American Express card, the message would appear as: CID code too long for American Express card"



Web SDK Error Responses

There are 2 possible error formats:

  1. Error responses from our Transaction API (which the Web SDK formats and returns). These are caused by the transaction itself, for example:
    1. Incorrect payment credentials
    2. Failure of 3D Secure 2 For more information on this type of error, see Enhanced Error Messaging for Web SDK.
  2. Errors thrown by the Web SDK code. Examples of causes can be:
    1. Scripts failing to load
    2. Closing of a modal
    3. Time-outs For more information on this type of error, see here.


Enhanced Error Messaging for Web SDK

For Web SDK Version 0.0.29 (or higher), the error response object has the following additional fields describing the error:

  • name
  • status
  • judoDetails

Not all errors returned from the Web SDK will have the new format described below. This only refers to errors that originated from our Transaction API (previous to version 0.0.29) having the following interface: {message: string}.

Error Object Response Fields

Field

Description

message String

A text description of the error.

name String

Represents a name for the type of error.

status Number

A HTTP response status code.

judoDetails Object



Object giving additional context to the error.

For further details on the interface of the judoDetails object, including examples, see JudoDetails Object.

This field is optional.



Examples of the Enhanced Error Response

The enhanced error response provides an error object with additional fields to increase the description of the error, for example:

Cause: Amount = 0.00
Cause: Card Authentication Fails

Enhanced Error Response:

{ message: 'Request failed with status code 400', name: "Error", status: 400, judoDetails: { category: 2, code: 1, details: [{ code: 4, fieldName: 'Amount', message: 'Sorry, but the amount specified must be greater than "0".', detail: "Sorry, we're currently unable to process this request."}], message: "Sorry, we're unable to process your request. Please check your details and try again." } }


JudoDetails Object

The judoDetails object aims to provide additional context around the error. See below for further information on the optional judoDetails object that is now included in the error response:

JudoDetails Interface

Field

Description

message String

A text description of the error.

code Number

A static numeric code associated with the specific error.

category Number



The type of error:

1 - RequestError 2 - ModelError 3 - ConfigError 4 - DuplicationError / ProcessingError 5 - ExceptionError

details Object



Object giving additional context to the error.

For examples on what this object may look like, see judoDetails Examples.

This field is optional.

For ModelError:

  • Array of FieldErrors describing one or more attributes.

For DuplicationError:

  • Provides the receiptId and url of the duplicate transaction.

JudoDetails Examples

RequestError Example
ModelError Example
ConfigError Example
DuplicationError Example
ProcessingError Example
ExceptionError Example

Example Category 1:

{ message: "Sorry, but we were unable to authenticate your request. Please check your details and try again.", code: 403, category: 1 }
{ message: "We've been unable to decrypt the supplied Encrypted payload. Please ensure the message has not been modified.", code: 150, category: 1 }