# Hooks

# Configuration

In most cases, you need to notify the user if the payment was sucessfuly done, and for that reason, there're hooks. Every time you implement a hook, you will receive a payment resource.

# Hooks available

If you need to listen any webhook, you may need to do something with it. A hook it's named like any event of the service but with the prefix of the package beebmx.kirby-pay.. You can check the list of the events provided by each service in their own API reference.

# Example

Here is an example of use with stripe and a webhook for the payment_intent.succeeded event:

use Beebmx\KirbyPay\Payment;

return [
    'hooks' => [
        'beebmx.kirby-pay.payment_intent.succeeded' => function (Payment $payment) {
            //Send your email
        },
    ]
];

WARNING

The variable $payment should be called if you want to use the payment information.