# List gateway webhook logs

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


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

Retrieves the webhooks that payment gateways sent to Chargebee for the site, newest first.

Use this operation to confirm that gateway notifications reached Chargebee and to trace them to a [customer](/docs/api/v2/pcv-1/customers), [invoice](/docs/api/v2/pcv-1/invoices), or [transaction](/docs/api/v2/pcv-1/transactions). Filter by `received_at` to limit the results to a time range.

### Implementation Notes

-   Results are sorted by `received_at` in descending order. Pass `sort_by[asc]` as `received_at` to list the oldest logs first.
-   Pagination can reach at most the first 10,000 matching logs: `offset` plus `limit` can't exceed 10,000. Once the next page would go past 10,000 logs, `next_offset` isn't returned, even if more logs match. To page further back, narrow the time range with the `received_at` filter.
-   Only the filters listed on this page are supported. Any other filter parameter returns an error instead of being ignored.
-   When Multi Business Entity is enabled and a business entity is in context, only logs for that business entity are returned.

## Sample Request

#### Chargebee CLI

```bash
chargebee gateway-webhook-log list \
    -d limit=2 \
    -d 'gateway[is]=adyen'
```

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/gateway_webhook_logs \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=2 \
     --data-urlencode "gateway[is]"="adyen"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = GatewayWebhookLog.List()
		.Limit(2)
		.Gateway().Is("adyen")
		.Request();

foreach (var listItem in result.List){
  GatewayWebhookLog gatewayWebhookLog = listItem.GatewayWebhookLog;
}
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    "github.com/chargebee/chargebee-go/v3/filter"
    gatewaywebhooklogAction "github.com/chargebee/chargebee-go/v3/actions/gatewaywebhooklog"
    "github.com/chargebee/chargebee-go/v3/models/gatewaywebhooklog"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := gatewaywebhooklogAction.List(&gatewaywebhooklog.ListRequestParams{
        Limit : chargebee.Int32(2),
        Gateway : &filter.StringFilter{
            Is : "adyen",
        },
    }).ListRequest()
    if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            GatewayWebhookLog := res.List[idx].GatewayWebhookLog
        }
    }
}
```

#### 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.GatewayWebhookLogListRequest{
    Limit : chargebee.Int32(2),
    Gateway : &chargebee.StringFilter{
        Is : "adyen",
    },
}
  res, err := client.GatewayWebhookLog.List(req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            GatewayWebhookLog := res.List[idx].GatewayWebhookLog
        }
    }
}
```

#### 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 = GatewayWebhookLog.list()
            .limit(2)
            .gateway().is(GatewayWebhookLog.Gateway.ADYEN)
            .request();

        for (ListResult.Entry entry : result) {
            GatewayWebhookLog gatewayWebhookLog = entry.gatewayWebhookLog();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.gatewayWebhookLog.GatewayWebhookLog;
import com.chargebee.v4.models.gatewayWebhookLog.params.GatewayWebhookLogListParams;
import com.chargebee.v4.models.gatewayWebhookLog.responses.GatewayWebhookLogListResponse;
import java.util.List;

public class GatewayWebhookLogList {

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

        GatewayWebhookLogListParams params = GatewayWebhookLogListParams.builder()
            .limit(2)
            .gateway()
            .is("adyen")
            .build();

        GatewayWebhookLogListResponse response = client.gatewayWebhookLogs().list(params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.gatewayWebhookLog.list({
        limit: 2,
        gateway: {
            is: "adyen"
        }
    });
    result.list.forEach((entry) => {
        console.log(entry);
        const gatewayWebhookLog = entry.gateway_webhook_log;
    });
} 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->gatewayWebhookLog()->all([
    "limit" => 2,
    "gateway" => [
        "is" => "adyen"
    ]
]);
foreach($result->list as $entry) {
    $gatewayWebhookLog = $entry->gateway_webhook_log;
}
```

#### Python

```python
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.GatewayWebhookLog.list(
    cb_client.GatewayWebhookLog.ListParams(
        limit=2,
        gateway=Filters.StringFilter(IS="adyen")
    )
)
for entry in entries.list:
    gateway_webhook_log = entry.gateway_webhook_log
```

#### Ruby

```ruby
require 'chargebee'

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

list = ChargeBee::GatewayWebhookLog.list({
  :limit => 2,
  "gateway[is]" => "adyen"
})

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

## Sample Response

```json
{
  "list": [
    {
      "gateway_webhook_log": {
        "webhook_id": "Yb3nS40BlZ7aQ1sYfG2h",
        "url": "https://acme-test.chargebee.com/adyen/webhook",
        "method": "POST",
        "status_code": "200",
        "gateway": "adyen",
        "id_at_gateway": "8835511210681327",
        "customer_handle": "__test__KyVnHhSBWlC1T2cj",
        "invoice_handle": "__demo_inv__1",
        "transaction_handle": "txn___test__KyVnHhSBWlxBX2qV",
        "payment_method_handle": "pm___test__KyVnHhSBWlC4q2cn",
        "gateway_credential_handle": "gw___test__KyVnHhSBWl6sk2bY",
        "payment_method_name": "Card",
        "request_body": "{\"live\":\"false\",\"notificationItems\":[{\"NotificationRequestItem\":{\"eventCode\":\"AUTHORISATION\",\"success\":\"true\",\"pspReference\":\"8835511210681327\",\"merchantAccountCode\":\"AcmeECOM\",\"amount\":{\"value\":2500,\"currency\":\"USD\"}}}]}",
        "response_body": "[accepted]",
        "request_headers": "{\"Content-Type\":\"application/json\",\"Authorization\":\"********\"}",
        "response_headers": "{\"Content-Type\":\"text/plain\"}",
        "received_at": 1762099260,
        "response_time": 35,
        "object": "gateway_webhook_log"
      }
    },
    {..}
  ],
  "next_offset": "2"
}
```

## URL Format

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

## Input Parameters

- `limit` (optional, integer, default=10, min=1, max=100)
  The number of resources to be returned.
  
  **Constraints**
  
  -   `offset` plus `limit` can't exceed 10,000.

- `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.
  
  **Constraints**
  
  -   `offset` plus `limit` can't exceed 10,000. To page further back, narrow the time range with the `received_at` filter.

## Returns

- `next_offset` (optional, string, max chars=1000)
  Returned only when more resources are present and the next page stays within the first 10,000 matching logs. To fetch the next set of resources, use this value for the input parameter `offset`.

- `gateway_webhook_log` (Gateway webhook log object)
  Resource object representing gateway\_webhook\_log
