# Retrieve a gateway request log

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


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

Retrieves a gateway request log identified by its `log_id`.

Use this operation to inspect the full request that Chargebee sent to a payment gateway and the gateway's response. Request and response payloads are returned as stored, with sensitive values already masked.

### Implementation Notes

-   If no log matches the `log_id` for the site, or the log belongs to a business entity other than the one in context, the API returns a `resource_not_found` error.

## Sample Request

#### Chargebee CLI

```bash
chargebee gateway-request-log retrieve Xk2pR40BlZ7aQ1sYdE9f
```

#### cURL

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

#### .NET

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

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

GatewayRequestLog gatewayRequestLog = result.GatewayRequestLog;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    gatewayrequestlogAction "github.com/chargebee/chargebee-go/v3/actions/gatewayrequestlog"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := gatewayrequestlogAction.Retrieve("Xk2pR40BlZ7aQ1sYdE9f").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        GatewayRequestLog := res.GatewayRequestLog
    }
}
```

#### 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.GatewayRequestLogRetrieveRequest{
    Id : "Xk2pR40BlZ7aQ1sYdE9f",
}
  res, err := client.GatewayRequestLog.Retrieve(req)
      if err != nil {
        fmt.Println(err)
    } else {
        GatewayRequestLog := res.GatewayRequestLog
    }
}
```

#### 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 = GatewayRequestLog.retrieve("Xk2pR40BlZ7aQ1sYdE9f").request();

        GatewayRequestLog gatewayRequestLog = result.gatewayRequestLog();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.gatewayRequestLog.GatewayRequestLog;
import com.chargebee.v4.models.gatewayRequestLog.params.GatewayRequestLogRetrieveParams;
import com.chargebee.v4.models.gatewayRequestLog.responses.GatewayRequestLogRetrieveResponse;

public class GatewayRequestLogRetrieve {

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

        GatewayRequestLogRetrieveResponse response = client.gatewayRequestLogs().retrieve("Xk2pR40BlZ7aQ1sYdE9f");

        GatewayRequestLog gatewayRequestLog = response.getGatewayRequestLog();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.gatewayRequestLog.retrieve("Xk2pR40BlZ7aQ1sYdE9f");

    console.log(result);
    const gatewayRequestLog = result.gateway_request_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->gatewayRequestLog()->retrieve("Xk2pR40BlZ7aQ1sYdE9f");
$gatewayRequestLog = $result->gateway_request_log;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.GatewayRequestLog.retrieve("Xk2pR40BlZ7aQ1sYdE9f")
gateway_request_log = response.gateway_request_log
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::GatewayRequestLog.retrieve("Xk2pR40BlZ7aQ1sYdE9f")

gateway_request_log = result.gateway_request_log
```

## Sample Response

```json
{
  "gateway_request_log": {
    "log_id": "Xk2pR40BlZ7aQ1sYdE9f",
    "url": "https://api.stripe.com/v1/payment_intents",
    "status_code": "200",
    "method": "POST",
    "request_body": "{amount=2500, currency=usd, customer=cus_QxSaMpLe1, payment_method=pm_************4242, confirm=true}",
    "response_body": "{\"id\":\"pi_SaMpLe1\",\"object\":\"payment_intent\",\"status\":\"succeeded\",\"amount\":2500,\"currency\":\"usd\"}",
    "request_headers": "{\"Authorization\":\"********\"}",
    "response_headers": "{\"Content-Type\":\"application/json\",\"Request-Id\":\"req_SaMpLe123\"}",
    "gateway": "stripe",
    "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",
    "operation_name": "PAYMENT",
    "operation_type": "PAYMENT",
    "source": "API",
    "invocation_time": 1762099200,
    "response_received_at": 1762099201,
    "response_time": 842,
    "object": "gateway_request_log"
  }
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/gateway_request_logs/{gateway-request-log-log-id}

## Returns

- `gateway_request_log` (Gateway request log object)
  Resource object representing gateway\_request\_log
