# List vouchers for a customer

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


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

Retrieves vouchers for a customer in reverse chronological order.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/customers/test_d23ed22ew/payment_vouchers \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=1
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = PaymentVoucher.PaymentVouchersForCustomer("test_d23ed22ew")
		.Limit(1)
		.Request();

foreach (var listItem in result.List){
  PaymentVoucher paymentVoucher = listItem.PaymentVoucher;
}
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    paymentvoucherAction "github.com/chargebee/chargebee-go/v3/actions/paymentvoucher"
    "github.com/chargebee/chargebee-go/v3/models/paymentvoucher"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := paymentvoucherAction.PaymentVouchersForCustomer("test_d23ed22ew", &paymentvoucher.PaymentVouchersForCustomerRequestParams{
        Limit : chargebee.Int32(1),
    }).ListRequest()
    if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            PaymentVoucher := res.List[idx].PaymentVoucher
        }
    }
}
```

#### 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.PaymentVoucherPaymentVouchersForCustomerRequest{
    Limit : chargebee.Int32(1),
}
  res, err := client.PaymentVoucher.PaymentVouchersForCustomer("test_d23ed22ew", req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            PaymentVoucher := res.List[idx].PaymentVoucher
        }
    }
}
```

#### 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 = PaymentVoucher.paymentVouchersForCustomer("test_d23ed22ew")
            .limit(1)
            .request();

        for (ListResult.Entry entry : result) {
            PaymentVoucher paymentVoucher = entry.paymentVoucher();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.paymentVoucher.PaymentVoucher;
import com.chargebee.v4.models.paymentVoucher.params.PaymentVouchersForCustomerParams;
import com.chargebee.v4.models.paymentVoucher.responses.PaymentVouchersForCustomerResponse;
import java.util.List;

public class PaymentVouchersForCustomer {

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

        PaymentVouchersForCustomerParams params = PaymentVouchersForCustomerParams.builder()
            .limit(1)
            .build();

        PaymentVouchersForCustomerResponse response = client
            .paymentVouchers()
            .paymentVouchersForCustomer("test_d23ed22ew", params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.paymentVoucher.payment_vouchersForCustomer("test_d23ed22ew", {
        limit: 1
    });
    result.list.forEach((entry) => {
        console.log(entry);
        const paymentVoucher = entry.payment_voucher;
    });
} 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->paymentVoucher()->paymentVouchersForCustomer("test_d23ed22ew", [
    "limit" => 1
]);
foreach($result->list as $entry) {
    $paymentVoucher = $entry->payment_voucher;
}
```

#### Python

```python
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.PaymentVoucher.payment_vouchers_for_customer("test_d23ed22ew",
    cb_client.PaymentVoucher.PaymentVouchersForCustomerParams(
        limit=1
    )
)
for entry in entries.list:
    payment_voucher = entry.payment_voucher
```

#### Ruby

```ruby
require 'chargebee'

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

list = ChargeBee::PaymentVoucher.payment_vouchers_for_customer("test_d23ed22ew",{
  :limit => 1
})

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

## Sample Response

```json
{
  "list": [
    {
      "payment_voucher": {
        "id": "pv_1mG11S1TcNL0SP9Vd",
        "id_at_gateway": "pi_3N0V7aK7ilSfRo7v1pfbc2NI",
        "payment_voucher_type": "boleto",
        "expires_at": 1682364922,
        "status": "active",
        "amount": 18900,
        "gateway_account_id": "gw_161my9TXG5oNYwgv",
        "payment_source_id": "pm_1mG11S1TcNKrvR9Up",
        "gateway": "stripe",
        "payload": "{\"url\":\"https://payments.stripe.com/boleto/voucher/test_YWNjdF8xTHZnMFRLN2lsU2ZSbzd2LF9ObTNFc3MzMDlsbU1qamg1Q2ROdDNzOWNYUk81bkhp0100p0cMVCz3\",\"voucher_number\":\"01010101010101010101010101010101010101010101010\",\"expiry\":\"1682364922\"}",
        "url": "http://john.chargebee.com/pages/v3/__dev__w5aPBsoEK5z6kIEt2mrEIH9GWLliHXrN/view_voucher",
        "date": 1682364742,
        "updated_at": 1682364742,
        "resource_version": 1682364742832,
        "object": "payment_voucher",
        "linked_invoices": [
          {
            "invoice_id": "60",
            "date": 1682364741,
            "total": 18900,
            "status": "payment_due"
          },
          {..}
        ],
        "currency_code": "BRL",
        "customer_id": "test_d23ed22ew"
      }
    },
    {..}
  ]
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/customers/{customer-id}/payment_vouchers

## 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_voucher` (Payment voucher object)
  Resource object representing payment\_voucher
