> ## Documentation Index
> Fetch the complete documentation index at: https://docs.iso20022js.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Payment Status Report

> Payment Status Report (PAIN.002)

# Payment Status Report (PAIN.002)

The `PaymentStatusReport` class represents a Payment Status Report (PAIN.002) in the PAIN.002 format. This
class encapsulates the data and functionality related to ingesting updates about the status of a
previously sent payment instruction.

## Usage

To create a `PaymentStatusReport` instance from a raw XML string:

```typescript theme={null}
import { PaymentStatusReport } from 'iso20022.js';
const xmlString = '<xml>...</xml>';
const paymentStatusReport = PaymentStatusReport.fromXML(xmlString);
```

A `PaymentStatusReport` has a list of `StatusInformation` elements, each of which has a `type` and a `status` field.

The first `StatusInformation` element in the list is also accessible as `paymentStatusReport.type` and `paymentStatusReport.status`.

## Example

```typescript theme={null}
if (paymentStatusReport.type === PaymentStatusCode.Accepted) {
    console.log("Payment Accepted");
} else if (paymentStatusReport.type === PaymentStatusCode.Rejected) {
    console.log("Payment Rejected");
} else if (paymentStatusReport.type === PaymentStatusCode.Pending) {
    console.log("Payment Pending");
}
```
