@bates-solutions/squareup API Reference - v3.2.0
    Preparing search index...

    Class SquarePaymentError

    Payment processing errors, such as a card decline. code is the normalized code (UNKNOWN for Square codes outside SquareErrorCode); errors keeps Square's raw entries, which declineReason reads.

    Hierarchy (View Summary)

    Index
    • Parameters

      • message: string
      • code: SquareErrorCode
      • OptionalpaymentId: string
      • errors: { category: string; code: string; detail?: string; field?: string }[] = []
      • Optionalpayment: { createdAt?: string; id?: string; status?: string }

      Returns SquarePaymentError

    Normalized error code. Each provider defines its own union.

    details?: unknown

    The raw error body or other context, if any.

    errors: { category: string; code: string; detail?: string; field?: string }[]

    Square's error entries, with the raw code (for example INSUFFICIENT_FUNDS).

    paymentCreatedAt?: string

    When Square created the declined payment (RFC 3339), when it included the payment.

    paymentId?: string

    The id of the payment Square created for the declined attempt. A declined payments.create() still creates a payment, with status FAILED, and Square later sends payment.created / payment.updated webhooks for it: keep this id to match those events to the attempt. Unset when Square's error response doesn't include the payment.

    paymentStatus?: string

    The declined payment's status, usually FAILED, when Square included the payment.

    statusCode?: number

    HTTP status of the response that caused the error, if any.

    • Makes value instanceof PaymentsError true for an error from any copy of this package, not only this one. It looks for a brand that every copy puts on PaymentsError.prototype, so the prototype itself is not counted as an instance. On a subclass, such as SquareError, it is the usual prototype-chain check.

      It returns a plain boolean rather than a type predicate, so TypeScript keeps narrowing instanceof SquareError to SquareError.

      Parameters

      • value: unknown

      Returns boolean