> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revolv3.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Processor Raw Response

> Learn how to retrieve detailed raw responses from payment processors for debugging, auditing, and accessing processor-specific codes and messages.

## What is Processor Raw Response?

The **processor raw response** is the complete, unprocessed response from the payment processor (WorldPay, Adyen, Nuvei, etc.). It contains detailed information that's not included in Revolv3's simplified response, including:

* Processor-specific transaction IDs
* Detailed fraud check results
* AVS (Address Verification System) results
* Processor-specific error codes
* Additional metadata and flags

**When to use it:**

* **Debugging**: Understanding exactly what the processor returned
* **Auditing**: Keeping detailed records of processor responses
* **Processor-specific logic**: When you need processor-specific codes or data
* **Support**: Providing detailed information when contacting support
* **Reconciliation**: Matching with processor reports using processor transaction IDs

> **Note**: Raw responses are optional and increase response size. Only request them when you need the detailed information.

## Important: Raw Response Format

The `rawResponse` is returned as an **escaped JSON string**, not a JSON object. This means it looks "ugly" with backslashes:

```json theme={null}
"rawResponse": "{\"cnpTxnId\":84083493722313344,\"orderId\":\"319214\",\"response\":\"000\"...}"
```

**You must parse it** in your code to use it effectively.

## Enabling Raw Processor Responses

To include the raw processor response, add this parameter to your request:

```json theme={null}
{
  "includeRawProcessorResponse": true
}
```

### In Payment Requests

Add it to payment-related endpoints:

* `POST {{Api Root}}/api/payments/sale`
* `POST {{Api Root}}/api/payments/sale/{paymentMethodId}`
* `POST {{Api Root}}/api/payments/authorization`
* `POST {{Api Root}}/api/payments/capture/{paymentMethodAuthorizationId}`

### In Invoice Retrieval

Add it as a query parameter:

```
GET {{Api Root}}/api/Invoices/{invoiceId}?includeRawProcessorResponse=true
```

Replace `{{Api Root}}` with `api.revolv3.com` (production) or `api-sandbox.revolv3.com` (sandbox).

## Example: Payment with Raw Response

### Request

```json theme={null}
{
  "IncludeRawProcessorResponse": true,
  "NetworkProcessing": {
    "ProcessingType": "initialInstallment",
    "OriginalNetworkTransactionId": null
  },
  "CustomerId": null,
  "PaymentMethod": {
    "BillingAddress": {
      "AddressLine1": "100 Main St",
      "City": "Los Angeles",
      "State": "CA",
      "PostalCode": "90210",
      "Country": "USA"
    },
    "BillingFirstName": "John",
    "BillingLastName": "Doe",
    "CreditCard": {
      "PaymentAccountNumber": "4444333322221111",
      "ExpirationDate": "1130",
      "SecurityCode": "214"
    }
  },
  "Invoice": {
    "MerchantInvoiceRefId": "ABC12345DProbVs1",
    "Amount": {
      "Value": 0.13
    }
  }
}
```

### Response (Success)

The `rawResponse` field contains the escaped JSON string:

```json theme={null}
{
  "CustomerId": null,
  "InvoiceId": 319214,
  "MerchantInvoiceRefId": "ABC12345DProbVs1",
  "NetworkTransactionId": "241815930449764",
  "InvoiceStatus": "Paid",
  "InvoiceAttemptStatus": "Success",
  "Message": "Approved",
  "Amount": {
    "Currency": "USD",
    "Value": 0.13
  },
  "PaymentMethodId": 12310,
  "RawResponse": "{\"cnpTxnId\":84083493722313344,\"orderId\":\"319214\",\"response\":\"000\",\"responseTime\":\"2024-11-19T19:12:16\",\"message\":\"Approved\",\"cardSuffix\":\"1111\",\"authCode\":\"123457\",\"fraudResult\":{\"avsResult\":\"00\"}...}"
}
```

### Parsing the Raw Response

**Before parsing** (escaped string):

```json theme={null}
"RawResponse": "{\"cnpTxnId\":84083493722313344,\"response\":\"000\"...}"
```

**After parsing** (structured object):

```json theme={null}
{
  "CnpTxnId": "84083493722313344",
  "OrderId": "319214",
  "Response": "000",
  "ResponseTime": "2024-11-19T19:12:16",
  "Message": "Approved",
  "CardSuffix": "1111",
  "AuthCode": "123457",
  "FraudResult": {
    "AvsResult": "00"
  }
}
```

### Response (Failure)

For a failed transaction, the raw response includes the decline reason:

```json theme={null}
{
  "InvoiceStatus": "Noncollectable",
  "InvoiceAttemptStatus": "Fail",
  "Message": "Insufficient Funds",
  "RawResponse": "{\"cnpTxnId\":83997868055145032,\"orderId\":\"474126\",\"response\":\"110\",\"message\":\"Insufficient Funds\"...}"
}
```

**After parsing**, you can see `"response": "110"` which corresponds to "Insufficient Funds" in WorldPay's documentation.

## How to Parse Raw Responses

### JavaScript/Node.js

```javascript theme={null}
const response = await makePaymentRequest();
const rawResponse = JSON.parse(response.rawResponse);
console.log(rawResponse.response); // "000"
console.log(rawResponse.message); // "Approved"
```

### Python

```python theme={null}
import json

response = make_payment_request()
raw_response = json.loads(response['rawResponse'])
print(raw_response['response'])  # "000"
print(raw_response['message'])  # "Approved"
```

### C\#

```csharp theme={null}
var response = await MakePaymentRequest();
var rawResponse = JsonSerializer.Deserialize<JObject>(response.RawResponse);
var responseCode = rawResponse["response"].ToString(); // "000"
```

## Understanding Processor Response Fields

**Processor-specific**: Each processor has its own field names and codes. Refer to your processor's documentation for specific meanings.

## When to Use Raw Responses

### Use Raw Responses When:

* **Debugging payment issues**: Need to see exactly what the processor returned
* **Processor-specific logic**: Building logic based on processor codes
* **Detailed auditing**: Need complete records for compliance
* **Reconciliation**: Matching with processor reports using processor transaction IDs
* **Support requests**: Providing detailed information to Revolv3 support

### Don't Use Raw Responses When:

* **Simple integrations**: Revolv3's simplified response is usually enough
* **Performance sensitive**: Raw responses increase response size
* **You don't need the details**: If `invoiceAttemptStatus` are sufficient

## Best Practices

1. **Always parse**: Treat `rawResponse` as a string and parse it—don't try to use it as an object
2. **Handle parsing errors**: Wrap parsing in try/catch—malformed JSON can break your code
3. **Use sparingly**: Only request when needed—it increases response size
4. **Fallback to simplified**: If parsing fails, use Revolv3's fields as a fallback

## Processor-Specific Codes

Each processor has its own response codes. Common examples:

### WorldPay

* `"000"`: Approved
* `"110"`: Insufficient Funds
* `"200"`: Generic Decline

### Adyen

* `"Authorised"`: Approved
* `"Refused"`: Declined
* Various refusal reasons

**Refer to your processor's documentation** for complete code lists and meanings.

## Common Questions

**Q: Do I have to parse the raw response?** A: Yes, it's returned as an escaped JSON string. You must parse it to use the data.

**Q: What if parsing fails?** A: Log the raw string and use Revolv3's fields as a fallback. Check processor documentation for format changes.

**Q: Should I always request raw responses?** A: No, only when you need the detailed information. It increases response size and processing time.

**Q: Can I use raw responses for all processors?** A: Yes, but the format and fields vary by processor. Check your processor's documentation for specifics.

**Q: Is raw response data sensitive?** A: It may contain transaction details.

## Next Steps

* [**Get Invoice Details**](/docs/core-concepts/invoice/get-details-of-invoice-attempts) — See how to get raw responses for existing invoices
* [**Error Responses**](/docs/error-codes/error-responses) — Understand how to handle API errors
* [**Make a Payment**](/docs/getting-started/make-a-payment) — See how to include raw response in payment requests

***
