# Retrieve voucher data

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


Retrieves a voucher using the unique `payment_voucher_id` .

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/payment_vouchers/pv_1mG11S1TcNL0SP9Vd \
     -u {site_api_key}:
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = PaymentVoucher.Retrieve("pv_1mG11S1TcNL0SP9Vd").Request();

PaymentVoucher paymentVoucher = result.PaymentVoucher;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    paymentvoucherAction "github.com/chargebee/chargebee-go/v3/actions/paymentvoucher"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := paymentvoucherAction.Retrieve("pv_1mG11S1TcNL0SP9Vd").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        PaymentVoucher := res.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.PaymentVoucherRetrieveRequest{
    Id : "pv_1mG11S1TcNL0SP9Vd",
}
  res, err := client.PaymentVoucher.Retrieve(req)
      if err != nil {
        fmt.Println(err)
    } else {
        PaymentVoucher := res.PaymentVoucher
    }
}
```

#### Java

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

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = PaymentVoucher.retrieve("pv_1mG11S1TcNL0SP9Vd").request();

        PaymentVoucher paymentVoucher = result.paymentVoucher();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.paymentVoucher.PaymentVoucher;
import com.chargebee.v4.models.paymentVoucher.params.PaymentVoucherRetrieveParams;
import com.chargebee.v4.models.paymentVoucher.responses.PaymentVoucherRetrieveResponse;

public class PaymentVoucherRetrieve {

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

        PaymentVoucherRetrieveResponse response = client.paymentVouchers().retrieve("pv_1mG11S1TcNL0SP9Vd");

        PaymentVoucher paymentVoucher = response.getPaymentVoucher();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.paymentVoucher.retrieve("pv_1mG11S1TcNL0SP9Vd");

    console.log(result);
    const paymentVoucher = result.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()->retrieve("pv_1mG11S1TcNL0SP9Vd");
$paymentVoucher = $result->payment_voucher;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.PaymentVoucher.retrieve("pv_1mG11S1TcNL0SP9Vd")
payment_voucher = response.payment_voucher
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::PaymentVoucher.retrieve("pv_1mG11S1TcNL0SP9Vd")

payment_voucher = result.payment_voucher
```

## Sample Response

```json
{
  "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",
    "currency_code": "BRL",
    "customer_id": "test_d23ed22ew",
    "linked_invoices": [
      {
        "invoice_id": "60",
        "date": 1682364741,
        "total": 18900,
        "status": "payment_due"
      },
      {..}
    ]
  }
}
```

## URL Format

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

## Returns

- `payment_voucher` (Payment voucher object)
  Resource object representing payment\_voucher
