# List payment reference numbers

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Eventually Consistent](/docs/api/read-consistency)

This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/invoices/payment_reference_numbers \
     -G  \
     -u {site_api_key}:\
     --data-urlencode "id[is]"="__demo_inv__2"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = Invoice.ListPaymentReferenceNumbers()
		.Id().Is("__demo_inv__2")
		.Request();

foreach (var listItem in result.List){
  PaymentReferenceNumber paymentReferenceNumber = listItem.PaymentReferenceNumber;
}
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    "github.com/chargebee/chargebee-go/v3/filter"
    invoiceAction "github.com/chargebee/chargebee-go/v3/actions/invoice"
    "github.com/chargebee/chargebee-go/v3/models/invoice"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := invoiceAction.ListPaymentReferenceNumbers(&invoice.ListPaymentReferenceNumbersRequestParams{
        Id : &filter.StringFilter{
            Is : "__demo_inv__2",
        },
    }).ListRequest()
    if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            PaymentReferenceNumber := res.List[idx].PaymentReferenceNumber
        }
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.InvoiceListPaymentReferenceNumbersRequest{
    Id : &chargebee.StringFilter{
        Is : "__demo_inv__2",
    },
}
  res, err := client.Invoice.ListPaymentReferenceNumbers(req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            PaymentReferenceNumber := res.List[idx].PaymentReferenceNumber
        }
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;
import java.util.List;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        ListResult result = Invoice.listPaymentReferenceNumbers().id().is("__demo_inv__2").request();

        for (ListResult.Entry entry : result) {
            PaymentReferenceNumber paymentReferenceNumber = entry.paymentReferenceNumber();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.invoice.params.InvoiceListPaymentReferenceNumbersParams;
import com.chargebee.v4.models.invoice.responses.InvoiceListPaymentReferenceNumbersResponse;
import com.chargebee.v4.models.paymentReferenceNumber.PaymentReferenceNumber;
import java.util.List;

public class InvoiceListPaymentReferenceNumbers {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        InvoiceListPaymentReferenceNumbersParams params = InvoiceListPaymentReferenceNumbersParams.builder()
            .id()
            .is("__demo_inv__2")
            .build();

        InvoiceListPaymentReferenceNumbersResponse response = client.invoices().listPaymentReferenceNumbers(params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.invoice.listPaymentReferenceNumbers({
        id: {
            is: "__demo_inv__2"
        }
    });
    result.list.forEach((entry) => {
        console.log(entry);
        const paymentReferenceNumber = entry.payment_reference_number;
    });
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->invoice()->listPaymentReferenceNumbers([
    "id" => [
        "is" => "__demo_inv__2"
    ]
]);
foreach($result->list as $entry) {
    $paymentReferenceNumber = $entry->payment_reference_number;
}
```

#### Python

```python
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.Invoice.list_payment_reference_numbers(
    cb_client.Invoice.ListPaymentReferenceNumbersParams(
        id=Filters.StringFilter(IS="__demo_inv__2")
    )
)
for entry in entries.list:
    payment_reference_number = entry.payment_reference_number
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

list = ChargeBee::Invoice.list_payment_reference_numbers({
  "id[is]" => "__demo_inv__2"
})

list.each do |entry|
  payment_reference_number = entry.payment_reference_number
end
```

## Sample Response

```json
{
  "list": [
    {
      "payment_reference_number": {
        "id": "prn___test__8aszZTexzRqs4A",
        "invoice_id": "__demo_inv__2",
        "number": "0000202317",
        "object": "payment_reference_number",
        "type": "kid"
      }
    },
    {..}
  ]
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/invoices/payment_reference_numbers

## Input Parameters

- `limit` (optional, integer, default=10, min=1, max=100)
  The number of resources to be returned.

- `offset` (optional, string, max chars=1000)
  Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call.

## Returns

- `next_offset` (optional, string, max chars=1000)
  This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`.

- `payment_reference_number` (Payment reference number object)
  Resource object representing payment\_reference\_number
