# 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](/docs/vendor-notifications-webhook/).

**Fields**: See [here](/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**:

| Field name          | Type   | Description                                                                   |
| ------------------- | ------ | ----------------------------------------------------------------------------- |
| `merchantId`        | String | Your platform's ID.                                                           |
| `vendorId`          | String | The vendor's unique ID in Unipaas.                                            |
| `vendorName`        | String | The vendor's name.                                                            |
| `id`                | String | The mandate ID.                                                               |
| `status`            | String | Mandate status. Can be: `pending_approval`, `active`, `cancelled`, `rejected` |
| `consumer`          | String | Customer ID.                                                                  |
| `consumerReference` | String | Customer reference.                                                           |
| `consumerEmail`     | String | Customer email.                                                               |
| `createdAt`         | String | Mandate creation date.                                                        |
| `mandateReference`  | String | The mandate reference as will be visible to the vendor and customer.          |
| `paymentOptionId`   | String | An ID that represents the payment option (e.g., Direct Debit).                |

**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](/docs/vendor-notifications-webhook/).

**Fields**: See [here](/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](/docs/unipaas-webhook-notifications/).

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

**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](/docs/vendor-notifications-webhook/).
