Using Hooks
Hooks, often called webhooks are a convenient way to receive notification when some events occur in your Tropipay account. These events can be for example: when a payment is completed or funds are guarded by Tropipay in a mediation paymentcard. You can use hooks instead of notificationUrl to verify payments.
Some supported events
These are some of the most important events that we can get via webhooks.
| Event name | Description |
|---|---|
user_login | Event launched once an user completes login on the TropiPay platform. |
user_kyc | Event launched once an user completes kyc process. |
beneficiary_added | Launched after new beneficiary is created. |
beneficiary_updated | Launched after a beneficiary is modified. |
beneficiary_deleted | Launched after a beneficiary is deleted. |
transaction_new | Create a new transaction |
transaction_pendingin | Pending transaction to settle in the payment entity |
transaction_charged | Transaction waiting to be sent |
transaction_paid | A transaction has been paid. |
transaction_cancelled | Events launched when a transaction is cancelled |
transaction_guarded | Used for mediation paymentcards |
transaction_guarded_mediation | Used in mediation paymentcards |
user_after_update | Event launched after a user is updated. |
transaction_completed | Event launched after transaction is completed. You can use this event to verify payments |
Subscribe a Hook Event
tpp.hooks.subscribe({ eventType: "beneficiary_added", target: "web", value: "https://mysite/webhooks/beneficiary_added",});Modify a Hook Event
tpp.hooks.update("beneficiary_added", "web", "https://mysite/anotherroute/");Get subscribed event(s) info
tpp.hooks.list();// you can also specify what event you want to retrievetpp.hooks.list("beneficiary_added");Clear a Hook Event
tpp.hooks.delete("beneficiary_added", "web");