1.7.1. Getting callback

You can get callback when a payment is processed successfully. This allows you to update external systems or perform any other actions that Moski2.net does not handle implicitly.

To receive a callback you simply pass along the callbackUrl parameter to M2_Payment::getPaymentWizard(). On this URL you will receive a POST request upon successful payment, holding two parameters: ordernumber and token. These can then be used to investigate the details of the order in question with M2_Payment::getPaymentDetails().

You will also receive any custom parameters you passed along to the payment wizard with the callbackParams parameter.

In order to protect your callback URL from false payment notifications you should retrieve the parameters from the callback with the M2_Payment_Util::validateCallback() utility, which ensures that the callback is valid:

<?php

$params = M2_Payment_Util::validateCallback();

$driver = M2_Payment_Client::getDriver();
$details = $driver->getPaymentDetails($params['ordernumber'], $params['token']);

// ...update external systems etc....

?>

Your callback page must return with an HTTP code 200, or else an error is logged with ALERT severity.