# Webhooks

Webhooks are calls from the Kaoshi server to the bank API to notify the bank that an event has happened to an order.

Currently, the only event Kaoshi supports is a payment-complete event. The payment-complete event includes the details of the diaspora matcher (for bank KYC purposes) and details of the recipient of the matcher that should be paid out by bank.

This payload also includes the verification details from Kaoshi.

In response to a payment-complete event, the Kaoshi API will send a post request to your registered webhook.

An example of the posted payload is below:

{
  "transaction": {
    "id": "tx-vq5ejvne0p",
    "created_by": {
      "id": "og36g3",
      "email": "joy-nigeria-testing@example.com",
      "first_name": "Joy",
      "last_name": "Nigeria-Sender"
    },
    "created_at": "2020-02-02T10:09:21.000Z",
    "updated_at": "2020-02-02T10:09:53.924Z",
    "confirmed_at": "2020-02-02T10:09:53.924Z",
    "expires_at": "2020-02-04T00:00:00.000Z",
    "exchange_rate": 361.5,
    "exchange_rate_description": "NGN:USD",
    "poster": {
      "id": "og36g3",
      "email": "joy-nigeria-testing@example.com",
      "first_name": "Joy",
      "last_name": "Nigeria-Sender"
    },
    "matcher": {
      "id": "8ep4e5",
      "email": "usd-matcher@example.com",
      "first_name": "usd-matcher",
      "last_name": "usd-matcher-lastname"
    },
    "posters_transaction": {
      "id": 140,
      "created_by": {
        "id": "og36g3",
        "email": "joy-nigeria-testing@example.com",
        "first_name": "Joy",
        "last_name": "Nigeria-Sender"
      },
      "created_at": "2020-02-02T10:09:54.000Z",
      "updated_at": "2020-02-02T10:09:54.000Z",
      "currency": "NGN",
      "sending_amount": 180750,
      "fee": 0,
      "exchange_rate_description": "NGN:USD",
      "exchange_rate": 361.5,
      "sending_method": "nigerian_bank_payment",
      "sending_to_matchers_beneficiary": {
        "amount_to_deposit": 180388.5,
        "matchers_fee_in_foreign_currency": 361.5,
        "matchers_fee_in_posters_currency": 361.5,
        "account": {
          "id": 122,
          "bank_name": "STERLING BANK PLC",
          "bank_code": "000001",
          "account_number": "234234324",
          "account_name": "qwerw qwerwe",
          "created_by": {
            "id": "8ep4e5",
            "email": "usd-matcher@example.com",
            "first_name": "usd-matcher",
            "last_name": "usd-matcher-lastname"
          },
          "created_at": "2020-02-01T04:15:40.000Z",
          "updated_at": "2020-02-01T04:15:40.000Z"
        }
      },
      "external_order": {
        "id": 5,
        "created_by": "7dkwdw",
        "order_id": "tx-vq5ejvne0p",
        "current_account_balance": 123123.12,
        "transaction_fee": 123.12,
        "transaction_fee_currency": "NGN",
        "created_at": "2020-02-02T10:09:21.000Z",
        "updated_at": "2020-02-02T10:09:21.000Z"
      }
    },
    "matchers_transaction": {
      "id": "tx-vq5ejvne0p",
      "created_at": "2020-02-02T10:09:21.000Z",
      "updated_at": "2020-02-02T10:09:53.924Z",
      "currency": "USD",
      "sending_amount": 500,
      "fee": 1,
      "exchange_rate_description": "NGN:USD",
      "exchange_rate": 361.5,
      "sending_method": "zelle_payment",
      "sending_to_posters_beneficiary": {
        "amount_to_deposit": 500,
        "posters_fee_in_foreign_currency": 0,
        "posters_fee_in_matchers_currency": 0,
        "account": {
          "id": 36,
          "email": "janeth-usa-receiver@example.com",
          "phone": "+15555555555",
          "created_by": {
            "id": "og36g3",
            "email": "joy-nigeria-testing@example.com",
            "first_name": "Joy",
            "last_name": "Nigeria-Sender"
          },
          "created_at": "2020-02-01T19:42:40.000Z",
          "updated_at": "2020-02-01T19:42:40.000Z"
        }
      }
    }
  },
  "event": "payment-complete"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

WARNING

DETAILS OF KAOSHI USER IS CONFIDENTIAL AND MEASURES SHOULD BE TAKEN TO PROTECT THE UNWARRANTED DISCLOSURE OR ABUSE OF THIS INFORMATION.