# Webhooks and Notifications for Direct Debit

## notification/create

**Description**: The `notification/create` webhook will notify your platform about every significant event that is related to your vendors, use the notification/create webhook notifications to update your vendors about important events. For more information about this webhook, see [here](https://docs.unipaas.com/docs/vendor-notifications-webhook).

**Fields**: See [here](https://docs.unipaas.com/docs/vendor-notifications-webhook).

**Example**: 

```json JSON
{
  "merchantId": "62fc99b24c728b3f02fc634f",
  "vendorId": "64772bdad168ea250924f1cc",
  "vendorEmail": "john.doe@unipaas.com",
  "subject": "",
  "body": "",
  "data": {
    "consumerName": "Jane Doe"
  },
  "importance": "high",
  "notificationMessage": "Your Direct Debit with Jane Doe has been set up and you can start collecting payments.",
  "notificationId": "1082",
  "domEvent": "liveInstructionChangedMessageVendor",
  "actions": [
    {
      "text": "View payment",
      "severity": "info",
      "payload": {
        "action": "payPortal",
        "actionPayload": {
          "queryParam": "page=directDebit&tab=mandates"
        },
        "method": "event"
      }
    }
  ],
  "group": "DirectDebit"
}
```

## mandate/update

**Description**: Subscribe to the `mandate/update` webhook to get notifications when a mandate status has changed.

**Fields**:

<table>
  <thead>
    <tr>
      <th>
        Field name
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `merchantId`
      </td>

      <td>
        String
      </td>

      <td>
        Your platform's ID.
      </td>
    </tr>

    <tr>
      <td>
        `vendorId`
      </td>

      <td>
        String
      </td>

      <td>
        The vendor's unique ID in UNIPaaS.
      </td>
    </tr>

    <tr>
      <td>
        `vendorName`
      </td>

      <td>
        String
      </td>

      <td>
        The vendor's name.
      </td>
    </tr>

    <tr>
      <td>
        `id`
      </td>

      <td>
        String
      </td>

      <td>
        The mandate ID.
      </td>
    </tr>

    <tr>
      <td>
        `status`
      </td>

      <td>
        String
      </td>

      <td>
        Mandate status.\
        Can be: `pending_approval`, `active`, `cancelled`, `rejected`
      </td>
    </tr>

    <tr>
      <td>
        `consumer`
      </td>

      <td>
        String
      </td>

      <td>
        Customer ID.
      </td>
    </tr>

    <tr>
      <td>
        `consumerReference`
      </td>

      <td>
        String
      </td>

      <td>
        Customer reference.
      </td>
    </tr>

    <tr>
      <td>
        `consumerEmail`
      </td>

      <td>
        String
      </td>

      <td>
        Customer email.
      </td>
    </tr>

    <tr>
      <td>
        `createdAt`
      </td>

      <td>
        String
      </td>

      <td>
        Mandate creation date.
      </td>
    </tr>

    <tr>
      <td>
        `mandateReference`
      </td>

      <td>
        String
      </td>

      <td>
        The mandate reference as will be visible to the vendor and customer.
      </td>
    </tr>

    <tr>
      <td>
        `paymentOptionId`
      </td>

      <td>
        String
      </td>

      <td>
        An ID that represents the payment option (e.g., Direct Debit).
      </td>
    </tr>
  </tbody>
</table>

**Example**: 

```json JSON
{
  "merchantId": "62fc99b24c728b3f02fc634f",
  "vendorId": "64772bdad168ea250924f1cc",
  "vendorName": "Dunder Mifflin",
  "id": "64a1614bc0ab75af88587d48",
  "status": "active",
  "consumer": "64a16511c0ab75af88587d4c",
  "consumerReference": "Michael-Scott-1",
  "consumerEmail": "michael.scott@dundermifflin.com",
  "createdAt": "2023-07-02T11:36:43.565Z",
  "mandateReference": "HZRD2XJ-dunder-mif",
  "paymentOptionId": "64a2cdc4125bc79ea763db4a"
}
```

## ewalletTransaction/create

**Description**: Subscribe to the `eWalletTransaction/create` webhook to get notifications when an account transaction associated with one of your vendors is created. For more information about this webhook, see [here](https://docs.unipaas.com/docs/vendor-notifications-webhook).

**Fields**: See [here](https://docs.unipaas.com/docs/get-webhook-notifications#account-transactions-notifications).

**Example**: 

```json JSON
{
  "merchantId": "605c8a4b8b37a82b60f0752d",
  "vendorId": "64abf7793668f266fb47e9ed",
  "id": "477984",
  "amount": 120,
  "currency": "GBP",
  "reference": "INV-1234",
  "fees": 0,
  "type": "Charge",
  "transactionId": "64d3a6973fb33a3b0acdb787",
  "authorizationId": "64d3a6973fb33a1e74cdb782",
  "transactionType": "Sale",
  "transactionResult": "Approved",
  "paymentMethod": "directDebit",
  "payoutId": null,
  "brand": "unknown",
  "issuerCountry": "GB",
  "reconciled": "false",
  "eWalletId": "105764",
  "netAmount": 120,
  "pendingAmount": 120,
  "payableAmount": 0,
  "reservedAmount": 0,
  "payableBalance": 0,
  "reservedBalance": 0,
  "identificationReference": null,
  "feeDesription": null,
  "hint": null,
  "metadata": null,
  "checkoutId": "5ef06c92d19f168be59b9a6f",
  "createdAt": "2023-08-09T14:47:41.546Z"
}
```

## authorization/update

**Description**: On every new Authorization or Authorization status change, you will receive a webhook notification to your server. For more information about this webhook, see [here](https://docs.unipaas.com/docs/platform-webhook-notifications#payin).

**Fields**: See [here](https://docs.unipaas.com/docs/platform-webhook-notifications#payin).

**Example**: 

```json JSON
{
  "authorizationId": "64a423833b415011933cfc6b",
  "transactionId": "64a423833b415085433cfc6f",
  "authorizationStatus": "Submitted",
  "paymentOption": {
    "bankAccount": {
      "brand": "BARCLAYS BANK UK PLC"
    }
  },
  "currency": "GBP",
  "amount": 10,
  "orderid": "Inv-1234",
  "reference":"Inv-1234",
  "items": [],
  "consumerId": "64a172436c83244ba1211552",
  "consumerEmail": "oleg.brusilovski+consumer@unipaas.com"
}
```

To ensure that you are promptly notified about important updates regarding mandates and collections, it is crucial to subscribe to the vendor notification webhook. By subscribing, you will receive real-time notifications regarding changes in mandate or collection statuses.

For detailed instructions on how to subscribe to the vendor notification webhook and handle the notifications, please refer to the [vendor notification webhook documentation](https://docs.unipaas.com/docs/vendor-notifications-webhook).
