PaymentRequiredError

"402 Payment Required" response error class.

This is a nonstandard response status code that is reserved for future use. This status code was created to enable digital cash or (micro) payment systems and would indicate that the requested content is not available until the client makes a payment.

Sometimes, this status code indicates that the request cannot be processed until the client makes a payment. However, no standard use convention exists and different entities use it in different contexts.

Browser compatibility This status code is reserved but not defined. No browser actually supports it and the error will be displayed as a generic 4xx status code.

Constructor

new PaymentRequiredError(dataopt)

NotFoundError constructor

Parameters:
NameTypeAttributesDescription
dataObject | String | ResponseErrorOptions | Options | undefined<optional>

Error message or options

Extends

Members

status

Error status

Examples
404 Not Found
451 Unavailable For Legal Reasons
500 Internal Server Error

Methods

toJSON() → {Object}

Plain object representation of the error

Returns:
Type: 
Object
Example
// returned JSON
{
  error: {
    code: 400,
    requestId: '123456-test-request-id',
    message: 'Baaaaaad Request :-(',
    details: 'Check your request body'
  }
}

toPojo() → {Object}

Plain object representation of the error

Returns:
Type: 
Object
Example
// returned object
{
  error: {
    code: 400,
    requestId: '123456-test-request-id',
    message: 'Baaaaaad Request :-(',
    details: 'Check your request body'
  }
}

toString() → {string}

String representation of the error

Returns:
Type: 
string
Example
// returned string
{"error":{"code":400,"requestId":"123456-test-request-id","message":"Baaaaaad Request :-(","details":"Check your request body"}}