# Payout Drill Through

Payout Drill Through is the ability to see which account transaction was computed as part of a specific payout. 

> 📘
>
> You can drill through the payout as long as it wasn't cancelled.

## Payout Drill Through

Make a [`GET /payouts/{payoutId}/drillthrough`](https://docs.unipaas.com/reference#payoutcontroller_getpayoutdetails) request:

```curl
curl --request GET \
  --url 'https://sandbox.unipaas.com/platform/payouts/{payoutId}/drillthrough' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <PLATFORM_SECRET_KEY>'
```

> 📘 The payout drill through result will contain a list of account transactions that have been associated with the specific payout.

## Vendor Payout Drill Through

Make a [`GET /vendors/{vendorId}/payouts/{payoutId}/drillthrough`](https://docs.unipaas.com/reference#vendorpayoutcontroller_getpayoutdetails) request:

```curl
curl --request GET \
  --url 'https://sandbox.unipaas.com/platform/vendors/{vendorId}/payouts/{payoutId}/drillthrough' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <PLATFORM_SECRET_KEY>'
```

In response you will receive the following answer that includes:

* The payout transaction from the vendor's account to his bank account. 
* The payment drill through of all payments that were paid out. 

The example below shows the response for a single payout, with a drill down that includes 2 payments.  

```text
[
  {
    "merchantName": "Merchant Name",
    "direction": "out",
    "id": "115517",
    "originalAmount": 42,
    "amount": -42,
    "currency": "GBP",
    "fees": 0,
    "transactionId": "pa_12220",
    "authorizationId": null,
    "merchantId": "61c80d626416920dc881b5cf",
    "transactionType": "Payout",
    "transactionResult": "committed",
    "brand": "payout",
    "issuerCountry": "GB",
    "reconciled": "irrelevant",
    "ewalletId": "102767",
    "netAmount": -42,
    "pendingAmount": 0,
    "payableAmount": -42,
    "reservedAmount": 0,
    "pendingBalance": 0,
    "payableBalance": 0,
    "reservedBalance": 0,
    "payoutId": "12220",
    "fundsFlow": "collect",
    "type": "Payout",
    "createdAt": "2022-02-02T07:23:43.815Z",
    "vendorId": "61d19b83cb3d9317a9ad1107"
  },
  {
    "merchantName": "Merchant Name",
    "direction": "in",
    "id": "113030",
    "originalAmount": 22,
    "amount": 22,
    "currency": "GBP",
    "fees": 0,
    "transactionId": "61d5741c547ed4699c701f12",
    "authorizationId": "61d5741c547ed4699c701f0e",
    "merchantId": "61c80d626416920dc881b5cf",
    "transactionType": "Sale",
    "transactionResult": "Approved",
    "brand": "visa",
    "issuerCountry": "GB",
    "reconciled": "true",
    "ewalletId": "102767",
    "netAmount": 22,
    "pendingAmount": -22,
    "payableAmount": 22,
    "reservedAmount": 0,
    "pendingBalance": 0,
    "payableBalance": 42,
    "reservedBalance": 0,
    "payoutId": "12220",
    "fundsFlow": "collect",
    "type": "Charge",
    "createdAt": "2022-01-05T08:35:52.094Z",
    "vendorId": "61d19b83cb3d9317a9ad1107"
  }
  {
    "merchantName": "Merchant Name",
    "direction": "in",
    "id": "113031",
    "originalAmount": 20,
    "amount":20,
    "currency": "GBP",
    "fees": 0,
    "transactionId": "61d5741c547ed4699c701f14",
    "authorizationId": "61d5741c547ed4699c701f0s",
    "merchantId": "61c80d626416920dc881b5cf",
    "transactionType": "Sale",
    "transactionResult": "Approved",
    "brand": "visa",
    "issuerCountry": "GB",
    "reconciled": "true",
    "ewalletId": "102767",
    "netAmount": 20,
    "pendingAmount": -20,
    "payableAmount": 20,
    "reservedAmount": 0,
    "pendingBalance": 0,
    "payableBalance": 20,
    "reservedBalance": 0,
    "payoutId": "12220",
    "fundsFlow": "collect",
    "type": "Charge",
    "createdAt": "2022-01-08T08:25:42.094Z",
    "vendorId": "61d19b83cb3d9317a9ad1107"
  }
  ]
```

## Using Payout Drill Through to indicate which account transaction are paid out

If you wish to indicate whether a single transaction was paid out (from vendor account to vendor's bank account) you can use payout drill through do do so. 

When payout status is completed use `transactionId` from payout drill through response to mark the account transaction as "paid out"
