Question

Does magento 2 support PayPal IPN? I cannot find any document mentioned about it.

Was it helpful?

Solution

Yes Magento 2 support PayPal IPN (see CHANGELOG).

Payment improvements:

Implemented support of PayPal IPN protocol HTTP 1.1

Post back to PayPal to check whether this request is a valid one.

\vendor\magento\module-paypal\Model\AbstractIpn.php

protected function _postBack()
{
    /*** Code 

    if (empty($postbackResult) || in_array($responseCode, ['500', '502', '503'])) {
        if (empty($postbackResult)) {
            $reason = 'Empty response.';
        } else {
            $reason = 'Response code: ' . $responseCode . '.';
        }
        $this->_debugData['exception'] = 'PayPal IPN postback failure. ' . $reason;
        throw new RemoteServiceUnavailableException(__($reason));
    }
    /*** Code 

    if ($response != 'VERIFIED') {
        $this->_addDebugData('postback', $postbackQuery);
        $this->_addDebugData('postback_result', $postbackResult);
        throw new \Exception('PayPal IPN postback failure. See system.log for details.');
    }

}

Hope this answer is useful.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top