A container for all the values the user provided.

Hierarchy

  • PaymentRequest

Constructors

Methods

  • Returns the value for a field, after applying the field's mask.

    Parameters

    • fieldId: string

      The ID of the field to retrieve the masked value of.

    Returns undefined | string

    The masked value for the field, or undefined if no such value has been set or no such field exists in the currently set payment product (if any).

  • Returns all values that have been set, after applying the masks for the matching fields.

    Returns Record<string, undefined | string>

    An object containing all values that have been set, using the field IDs as keys and having the field's mask applied.

  • Returns whether or not payments created from this payment request should be tokenized. The default is false.

    Returns boolean

    True to tokenize payments, or false otherwise.

  • Returns the value for a field, after removing the field's mask.

    Parameters

    • fieldId: string

      The ID of the field to retrieve the unmasked value of.

    Returns undefined | string

    The unmasked value for the field, or undefined if no such value has been set or no such field exists in the currently set payment product (if any).

  • Returns all values that have been set, after removing the masks for the matching fields.

    Returns Record<string, undefined | string>

    An object containing all values that have been set, using the field IDs as keys and having the field's mask removed.

  • Returns the value for a field.

    Parameters

    • fieldId: string

      The ID of the field to retrieve the value of.

    Returns undefined | string

    The (unmodified) value for the field, or undefined if no such value has been set.

  • Returns all values that have been set.

    Returns Record<string, undefined | string>

    An object containing all values that have been set, using the field IDs as keys.

  • Returns whether or not this payment request is valid, as determined by the last call to validate.
    This payment request initially is not valid, and any update to this payment request (values, payment product, etc.) resets the validity.

    Returns boolean

  • Sets or clears the account on file. Any account on file attribute that does not have status "MUST_WRITE" will have its matching value in this payment request cleared.

    Parameters

    Returns void

  • Sets the payment product.
    Because the payment product may not be known when a payment request is created (e.g. because a payment product group is used), the payment product does not have to be provided upon creation but can be provided later. However, it is necessary to set the payment product before querying masked and unmasked values or validating.

    Parameters

    Returns void

  • Sets whether or not payments created from this payment request should be tokenized.

    Parameters

    • tokenize: boolean

      True to tokenize payments, or false otherwise.

    Returns void

  • Sets the value for a field.

    Parameters

    • fieldId: string

      The ID of the field to set the value of.

    • value: string

      The (unmodified) value for the field.

    Returns void

  • Validates all values against the currently set payment product.

    Returns ValidationResult

    The validation result. If not valid, it contains the validation errors.

    Throws

    If no payment product has been set yet.