Comment on page

Actions

First, we will talk about the filters that should work separately for each add-on during the add-on development process.
Since we have already mentioned the parameters in hooks in the "Filters" section, we will not mention them again.
There are 3 sections in total in the checkout process, before mentioning the hooks below. We will talk about these first. So you will have a better understanding of exactly where the hooks work.
  • "init" occurs when the user selects a network to initiate the payment process.
  • "createTransaction" occurs when the user confirms the payment with the wallet or sends the relevant amount to the address during the transfer payment process such as Bitcoin.
  • "payment Finished" occurs after the entire payment process has been completed.

1 - This hook only works in the init part. And the init part happens after the user selects a network. So you can use this hook to do an action in this process.

Hook::callAction('init_{addon}', $data);

2 - We can say that it performs the same function as the previous hook. So it works in createTransaction. But after the whole process.

Hook::callAction('payment_started_{addon}', $data);

3 - We can say that it performs the same function as the previous hook. So it works in paymentFinished. But after the whole process.

Hook::callAction('payment_finished_{addon}', $data);
Hook::callAction("settings");

5 - If you want to run an extra process in the API, you can easily do this with the hook below.

$endpoint = 'cp_get_transaction_list';
Hook::callAction('custom_endpoint_' . $endpoint, $this->data);
// API URL
$apiUrl = 'http://example.com/wp-json/cryptopay/custom-endpoints?endpoint='$endpoint;
Hook::addAction('custom_endpoint_' . $endpoint, function($data) {
// process
});
Yes, now that we have taken a look at all the "Actions", we can now look at how we can develop add-ons and custom integrations for CryptoPay.