# GET /customer/purchase-info/{{customer_id}} — Get Customer Purchase Information

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

This API is used to retrieve all the purchase details of that customer like total amount, total refund, total revenue and so on by the customer id .

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| customer_id | string | Yes |  |

**Query parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| currency_code | string | Yes | Eg: USD, INR |

**Response (200)** — Get Customer Purchase Information:

```json
{
    "status": "success",
    "message": "Purchase info",
    "data": {
        "puchase_info": {
            "total_amount": 100,
            "total_revenue": 100,
            "refund_amount": 0,
            "unused_credit": {
                "remaining_amount": 0,
                "subscription_count": 0
            },
            "receivables_amount": 0,
            "mrrTotalAmt": 0,
            "applied_tax": [],
            "applied_tax_total": {
                "tax_amount": 0,
                "sale_count": 0,
                "tax_count": 0
            }
        },
        "subscription_info": {
            "cancelled_count": 0,
            "cancelled_amount": 0,
            "onetime_count": 1,
            "onetime_amount": 100,
            "reccuring_count": 0,
            "reccuring_amount": 0,
            "pending_count": 0,
            "pending_amount": 0,
            "live_count": 1,
            "live_amount": 100,
            "total_count": 1,
            "total_amount": 100,
            "failed_count": 0,
            "failed_amount": 0,
            "total_addon_amount": 0,
            "total_addon_count": 0,
            "onetime_addon_amount": 0,
            "onetime_addon_count": 0,
            "recurring_addon_amount": 0,
            "recurring_addon_count": 0,
            "expired_count": 0,
            "expired_amount": 0,
            "nonrenewing_count": 0,
            "nonrenewing_amount": 0
        },
        "transaction_info": {
            "all_transactions_amount": 100,
            "all_transactions_count": 1,
            "successful_transactions_amount": 100,
            "successful_transactions_count": 1,
            "missed_invoice_amount": 0,
            "missed_invoice_count": 0
        },
        "affiliate_info": {
            "affiliate_commission": 0,
            "net_profit_via_affiliate": 0,
            "sales_count": 0,
            "refund_amount": 0,
            "refund_count": 0
        },
        "customer_info": {
            "id": "5f58c0815ee80365c77e29e2",
            "first_name": "Jhon",
            "last_name": "Doe",
            "user_name": "jhondoe@inboxkitten.com",
            "email_id": "jhondoe@inboxkitten.com",
            "company_name": "",
            "website": "",
            "phone": "",
            "tax_id": "",
            "copy_billing_address": false,
            "portal_language": "",
            "currency": "",
            "createdAt": "2020-09-09T11:46:09.882Z",
            "updatedAt": "2020-09-09T11:46:09.882Z",
            "portal_status": false,
            "is_affiliate": false,
            "shipping_address": {},
            "billing_address": {
                "street1": "",
                "city": "",
                "state": "",
                "zip_code": "",
                "country": ""
            }
        },
        "card_info": [
            {
                "id": "5f58c0825ee80365c77e29e6",
                "customer_id": "5f58c0815ee80365c77e29e2",
                "type": "credit_card",
                "createdAt": "2020-09-09T11:46:10.114Z",
                "brand": "visa",
                "country": "",
                "exp_month": 1,
                "exp_year": 2029,
                "last4": "1111",
                "gateway_name": "Test Gateway"
            }
        ]
    }
}

```

**Code examples:**

_cURL_

```curl
curl https://payments.pabbly.com/api/v1/customer/purchase-info/{{customer_id}}?currency_code={{currency_code}} \
  -u {{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}
```

_Ruby_

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

uri = URI('https://payments.pabbly.com/api/v1/customer/purchase-info/{{customer_id}}?currency_code={{currency_code}}')
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/customer/purchase-info/{{customer_id}}?currency_code={{currency_code}}',
    auth=HTTPBasicAuth('{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'),
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://payments.pabbly.com/api/v1/customer/purchase-info/{{customer_id}}?currency_code={{currency_code}}');
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/customer/purchase-info/{{customer_id}}?currency_code={{currency_code}}"))
    .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/customer/purchase-info/{{customer_id}}?currency_code={{currency_code}}', {
  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/customer/purchase-info/{{customer_id}}?currency_code={{currency_code}}", 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/customer/purchase-info/{{customer_id}}?currency_code={{currency_code}}");
request.Headers.TryAddWithoutValidation("Authorization", $"Basic {credentials}");

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

---

**Other endpoints in Customers:**

- [GET /customer/{{customer_id}} — Get Single Customer via Customer ID](/subscription-billing/customers/get-single-customer-via-customer-id)
- [GET /customer/ — Get Single Customer via Customer Email](/subscription-billing/customers/get-single-customer-via-customer-email)
- [GET /customers — List All Customers](/subscription-billing/customers/list-all-customers)
- [PUT /customer/{{customer_id}} — Update Customer Detail](/subscription-billing/customers/update-customer-detail)
- [POST /subscription — Create Customer With Subscription](/subscription-billing/customers/create-customer-with-subscription)
- [DELETE /customers/{{customer_id}} — Delete Customer](/subscription-billing/customers/delete-customer)
- [POST /customer — Create Customer](/subscription-billing/customers/create-customer)

