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

# Settlement report Adyen mapping

## Configuration

Before enabling settlement reporting for an Adyen connector please follow the below steps. Some fields in the settlement report are not in the default Adyen settlement report and need to be configured via the Adyen portal. The following fields need to be added: `Booking date`, `Booking Date TimeZone` and `metadata`. To add the columns to the Adyen report follow the documentation [here](https://docs.adyen.com/reporting/settlement-reconciliation/transaction-level/settlement-details-report/#additional-columns).

Please follow the below column configuration.

```
Company Account
Merchant Account
Psp Reference
Merchant Reference
Payment Method
Creation Date
TimeZone
Type
Modification Reference
Gross Currency
Gross Debit (GC)
Gross Credit (GC)
Exchange Rate
Net Currency
Net Debit (NC)
Net Credit (NC)
Commission (NC)
Markup (NC)
Scheme Fees (NC)
Interchange (NC)
Payment Method Variant
Modification Merchant Reference
Batch Number
Reserved4
Reserved5
Reserved6
Reserved7
Reserved8
Reserved9
Reserved10
Booking Date
Booking Date TimeZone
Metadata
```

<Note>
  It's important to set up the columns in order and these are the minimum columns needed. If more columns are desired, these should be placed after the last column mentioned here.
</Note>

Once that is set up, a report user needs to be created.
The report user is created via the Adyen developers dashboard, please follow the documentation [here](https://docs.adyen.com/reporting/automatically-get-reports/#create-api-credential).

The report user follows a naming convention like `report_123456@Company.Gr4vyInc`.
Please fill out the whole name, not just the report\_123456 part, and provide the basic auth password in the dashboard.
It is important to use the Basic Auth key pair when configuring the report user in the dashboard, and not the API key. This needs to be filled out in the **settlement** tab in the connector configuration page.

<img src="https://mintcdn.com/gr4vy/81rUFzs1xxqEKdRI/assets/images/reports/adyen-settlement-configuration.png?fit=max&auto=format&n=81rUFzs1xxqEKdRI&q=85&s=be6ba3ebcc59e17d97da08dcde0f0e46" alt="Adyen configuration" width="563" height="629" data-path="assets/images/reports/adyen-settlement-configuration.png" />

## Fields mapping

<Warning>This integration is in beta</Warning>

Below is the mapping of Adyen's settlement report to the consolidated settlement report. This data is pulled from the Adyen `settlement_detail_report` report.

| Settlement report                               | Adyen field? | Adyen report                                                                                                                                                               |
| :---------------------------------------------- | :----------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payment_service_transaction_reconciliation_id` | Yes          | `Merchant Reference` or `Metadata[gr4vy_tx_sid]`                                                                                                                           |
| `transaction_id`                                | No           | -                                                                                                                                                                          |
| `payment_service_transaction_id`                | Yes          | `Psp Reference`                                                                                                                                                            |
| `payment_service_id`                            | No           | -                                                                                                                                                                          |
| `payment_service_definition_id`                 | No           | -                                                                                                                                                                          |
| `payment_service_display_name`                  | No           | -                                                                                                                                                                          |
| `journal_type`                                  | Yes          | Check journal type mapping table below                                                                                                                                     |
| `raw_journal_type`                              | Yes          | `Type`                                                                                                                                                                     |
| `payment_service_transaction_created_at`        | Yes          | `Creation Date` with `Time Zone` UTC offset applied                                                                                                                        |
| `posted_at`                                     | Yes          | `Booking Date`, with `Booking Date Time Zone` UTC offset applied                                                                                                           |
| `processing_amount_plain`                       | Yes          | `Gross Credit (GC)` if `Settled` `Type`, `Gross Debit (GC)` if `Refunded` `Type`                                                                                           |
| `processing_currency`                           | Yes          | `Gross Currency`                                                                                                                                                           |
| `exchange_rate`                                 | Yes          | `Exchange Rate`                                                                                                                                                            |
| `currency`                                      | Yes          | `Net Currency`                                                                                                                                                             |
| `gross_credit_plain`                            | Yes          | `Gross Credit (GC) * Exchange Rate` or `Net Credit (NC)` for non-customer facing journal types                                                                             |
| `net_credit_plain`                              | Yes          | `Net Credit (NC)`                                                                                                                                                          |
| `gross_debit_plain`                             | Yes          | `Gross Debit (GC) * Exchange Rate` or `Net Debit (NC)` for non-customer facing journal types                                                                               |
| `net_debit_plain`                               | Yes          | `Net Debit (NC)`                                                                                                                                                           |
| `fee_markup_plain`                              | Yes          | `Markup (NC)`                                                                                                                                                              |
| `fee_interchange_plain`                         | Yes          | `Interchange (NC)`                                                                                                                                                         |
| `fee_scheme_plain`                              | Yes          | `Scheme Fees (NC)`                                                                                                                                                         |
| `fee_total_plain`                               | Yes          | `Commission (NC)` or `Gross Credit (GC) * Exchange Rate - Net Credit (NC)` if `Settled` `Type` or `Net Debit (NC) - Gross Debit (GC) * Exchange Rate` if `Refunded` `Type` |
| `method`                                        | Yes          | Calculated from `Payment Method` or `Payment Method Variant`                                                                                                               |
| `raw_method`                                    | Yes          | `Payment Method` or `Payment Method Variant` depending on which was used to calculate `method`                                                                             |
| `scheme`                                        | Yes          | Calculated from `Payment Method` or `Payment Method Variant`                                                                                                               |
| `raw_scheme`                                    | Yes          | `Payment Method` or `Payment Method Variant` depending on which was used to calculate `scheme`                                                                             |
| `batch`                                         | Yes          | `Batch Number`                                                                                                                                                             |
| `report_id`                                     | No           | -                                                                                                                                                                          |
| `raw_report_ids`                                | No           | -                                                                                                                                                                          |
| `ingested_at`                                   | No           | -                                                                                                                                                                          |
| `description`                                   | Yes          | Contains raw `Time Zone` and `Booking Date Time Zone` values                                                                                                               |
| `transaction_external_identifier`               | No           | -                                                                                                                                                                          |
| `transaction_metadata`                          | No           | -                                                                                                                                                                          |
| `report_payment_service_id`                     | No           | -                                                                                                                                                                          |
| `report_payment_service_definition_id`          | No           | -                                                                                                                                                                          |
| `report_payment_service_display_name`           | No           | -                                                                                                                                                                          |
| `payment_service_modification_reference`        | Yes          | `Modification Reference`                                                                                                                                                   |
| `payment_service_refund_reconciliation_id`      | Yes          | Always `null`                                                                                                                                                              |

### Notes

* `payment_service_transaction_created_at` and `posted_at` have been converted to UTC using `Time Zone` and `Booking Date Time Zone` respectively, which are time zone abbreviations.
  As these time zone abbreviations can be ambiguous, the applied UTC offset to these timestamp columns may not be accurate. Please refer to the `description` for the raw values used.
* Non-customer facing journal types may have columns defaulting to `0` or empty strings.

### Journal type mapping

| Adyen raw journal type | Journal type          |
| :--------------------- | :-------------------- |
| `Chargeback`           | `chargeback`          |
| `ChargebackReversed`   | `chargeback_reversal` |
| `Refunded`             | `refund`              |
| `SecondChargeback`     | `chargeback`          |
| `Settled`              | `settlement`          |
| any other value        | `other`               |

<Note>
  Fields marked as not being an **Adyen field** are populated from internal
  data and not from the imported payment service report.
</Note>
