# GET /invoice/{{invoice_id}} — Get Single Invoice

> Product: **Pabbly Subscription Billing** (v1)
> Base URL: `https://payments.pabbly.com/api/v1`
> Auth: Basic via `Authorization` header
> Canonical: `/subscription-billing/invoice/get-single-invoice`

This is a GET request API which is used to get the data of a single invoice. The Invoice Id is added in the link and fired without any formdata. In response You will get the customer Id user Id, email product Id, plan Id and all the data which is present in the invoice. Most important you get the status of the Invoice. If the status is paid then the payment is successful from the customer’s end.

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| invoice_id | string | Yes | Here you can pass the Invoice ID (65dafe0d2323da3340d7812d) or the Invoice Number (INV-7444). |

**Response (200)** — Get Single Invoice:

```json
{
    "status": "success",
    "message": "Invoice data",
    "data": {
        "quantity": 1,
        "product_id": "5ff696ec57b2331ca3011f96",
        "setup_fee": 0,
        "currency_symbol": "$",
        "credit_note": {
            "total_tax": "0.00",
            "status": "success",
            "new_plan_total": 100,
            "total_credit_amount": 0,
            "charge_amount": 100,
            "credit_applied": []
        },
        "tax_apply": {
            "country": "CA",
            "tax_id": "",
            "exempt_tax": [],
            "total_amount": 100,
            "total_tax": "0.00"
        },
        "cron_process": "done",
        "retry": false,
        "retry_count": 0,
        "createdAt": "2022-05-28T09:51:52.525Z",
        "updatedAt": "2022-05-28T09:51:52.525Z",
        "id": "6291f4fa9dcb4a60765ed4b7",
        "customer_id": "612a073743d3f446f5b75cb2",
        "subscription_id": "612a073743d3f446f5b75cb4",
        "status": "paid",
        "invoice_id": "INV-3399",
        "payment_term": "",
        "amount": 100,
        "due_amount": 0,
        "due_date": "2022-05-28T09:51:52.525Z",
        "plan_id": [
            "60012f1553dc266105c2ca0c"
        ],
        "invoice_link": "https://payments.pabbly.com/secureinvoice/606ab5d390d2342cb0d30971/?cinvoice_id=5c3d43b4b2d7f1965bc557049742b5d0:1bd3e4e1ad3a10f273958232e91c3d7284e3579145b4e04ff6549235f50be15dd042d4f2b7004740d7f37935326681a8142a2188499ae9bb6916b3ec01cf359aabc13cb99440037ad27c714ae38e02d5"
    }
}
```

**Code examples:**

_cURL_

```curl
curl https://payments.pabbly.com/api/v1/invoice/{{invoice_id}} \
  -u {{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}
```

_Ruby_

```ruby
require 'net/http'
require 'json'

uri = URI('https://payments.pabbly.com/api/v1/invoice/{{invoice_id}}')
request = Net::HTTP::Get.new(uri)
request.basic_auth '{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(request)
end

data = JSON.parse(response.body)
```

_Python_

```python
import requests
from requests.auth import HTTPBasicAuth

response = requests.get(
    'https://payments.pabbly.com/api/v1/invoice/{{invoice_id}}',
    auth=HTTPBasicAuth('{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'),
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://payments.pabbly.com/api/v1/invoice/{{invoice_id}}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, '{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}');

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

_Java_

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;

String credentials = Base64.getEncoder().encodeToString("{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}".getBytes());

HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
    .uri(URI.create("https://payments.pabbly.com/api/v1/invoice/{{invoice_id}}"))
    .header("Authorization", "Basic " + credentials)
    .GET();

HttpRequest request = builder.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

_Node.js_

```node
const credentials = Buffer.from('{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}').toString('base64');

const response = await fetch('https://payments.pabbly.com/api/v1/invoice/{{invoice_id}}', {
  method: 'GET',
  headers: {
    'Authorization': `Basic ${credentials}`,
  },
});

const data = await response.json();
```

_Go_

```go
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    req, _ := http.NewRequest("GET", "https://payments.pabbly.com/api/v1/invoice/{{invoice_id}}", nil)
    req.SetBasicAuth("{{YOUR_API_KEY}}", "{{YOUR_SECRET_KEY}}")

    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
}
```

_.NET_

```dotnet
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}"));

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://payments.pabbly.com/api/v1/invoice/{{invoice_id}}");
request.Headers.TryAddWithoutValidation("Authorization", $"Basic {credentials}");

var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
```

---

**Other endpoints in Invoice:**

- [GET /invoices/transactions/{{invoice_id}} — List All Transactions By Invoice Id](/subscription-billing/invoice/list-all-transactions-by-invoice-id)
- [GET /invoices/{{customer_id}} — List All Invoices By Customer Id](/subscription-billing/invoice/list-all-invoices-by-customer-id)
- [GET /invoices — List All Invoices](/subscription-billing/invoice/list-all-invoices)
- [POST /invoice/recordpayment/{{invoice_id}} — Record Payment Invoice](/subscription-billing/invoice/record-payment-invoice)
- [POST /invoice/failedpayment/{{invoice_id}} — Record Failed Payment Invoice](/subscription-billing/invoice/record-failed-payment-invoice)
- [DELETE /invoices/{{invoice_id}} — Delete Invoice](/subscription-billing/invoice/delete-invoice)
- [POST /invoices/create-metered/{{subscription_id}} — Create Metered Invoice](/subscription-billing/invoice/create-metered-invoice)

