---
title: Response
slug: payments/response
description: Learn about the Response format and keys returned from a Request call, including version, action, timestamp, validRequest, apiErrors, and responseJSON. Understand how errors are handled during validation and processing by the payment processor, with detai
docTags: 
createdAt: 2021-11-04T07:33:30.000Z
---

### Response

The Response is the information returned from the Request call. It will be returned in the form of a Map\<String, Object>.


Below is the list of Keys or Parameters returned in the Response Map:

| **Key (String)** | **Value (Object)**                                     | **Additional Detail**                                                                                          |
| ---------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| version	         | ‘1.0’                                                  | Returns the same version sent in the Request                                                                   |
| action           | See the list of available actions                      | Returns the same action sent in the Request                                                                    |
| timestamp	       | Timestamp in milliseconds (Unix).	                     | The time at which the response was returned, can be used to troubleshoot                                       |
| validRequest		   | Either true or false.                                  | If the Request satisfies the Breadwinner validations, it will be returned as true                              |
| apiErrors	       | This will be a list of Errors returned as JSON         | Errors which Breadwinner gets while validating the request and before making the request to Payments Processor |
| responseJSON	    | Returns the response of the record(s) as a JSON string | This includes the records data as well as any errors from the processor                                        |

### Errors

There can be some exceptions within Breadwinner and the Payment Processor may throw some errors as part of our API actions and those errors are returned in separate layers in the form of JSON.

### Before requesting the Payment Processor

Errors that occur while validating the request, or while making a request to the payment processor are returned as ‘errors’; when these exceptions are there, validRequest key will be sent as false.

These errors are returned as ‘errors’ as a key of the Response map, and errors is a list of Error object.

### After requesting the Payment Processor

Errors that occur within the payment processor while processing the request, or while processing the data in Breadwinner are sent as ‘errors’ in the responseJSON key of the Response map.

These errors are returned as ‘errors’ in the responseJSON, which is a key of the Response map and errors is a list of Error object.

### Error Object

Error object contains two String parameters

| **Field Name&#x9;** | **Data Type&#x9;** | **Description**                                                                                                                           |
| ------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| message	            | String	            | Short message about the error.                                                                                                            |
| code	               | String	            | For some errors that could be handled programmatically, a short string indicating the error code is reported.                             |
| detail              | String             | A detailed explanation of the Error occurred. Example: Breadwinner was unable to process the request as the action parameter was invalid. |

## Example

:::::Tabs
::::Tab{title="Validation Error"}
Breadwinner does validation prior to calling out to the Payment Processor.

:::CodeblockTabs
Invalid Request

```json
{
  apiErrors={
    "errors": [
      {
        "message": "Invalid processor id.",
        "detail": "ProcessorId is not valid. Please refer the Breadwinner API Docs.",
        "code": "INVALID_PROCESSOR"
      }
    ]
  },
  timestamp=1654159364579,
  validRequest=false
}
```
:::
::::

::::Tab{title="Error returned from Payment Processor"}
This is an error sent back from Processor that was reformatted for easier reading.

:::CodeblockTabs
400

```json
{
  action=createCustomer,
  timestamp=1635239587001,
  version=1.0,
  statusCode=400,
  responseJSON={
  "errors": [
    {
      "message": "email_invalid",
      "detail": "Invalid email address: tests.com",
      "code": "invalid_request_error"
    }
  ]
 }
}
```
:::
::::
:::::

