Question

I am trying to implement the adyen api into my project and I am encountering the following issue:

At first, I am receiving a notification callback from adyen with AUTHORISATION true and the transatction status 1, but after this, I am not receiving any other notification. Even if the payment process is CAPTURED true, the notification does not arrive.

I have tested adyen notifications in the adyen sandbox, and the notifications work. Here is a code sample of the callback file:

if (($eventCode=="AUTHORISATION") && ($success=="true"))
{

    if($paymentRecharge['status']!=0) //Check if status is placed only
    {
        ReleaseTableLock($orderID);

        print('[accepted]');  
        return;
    }

    if (($paymentRecharge['adyen_amount']!=$value) || ($paymentRecharge['currency']!=$currency)) //Check to see if the paid value is the same as our value, otherwise this is Fraud
    {
        SetPaymentStatus($orderID,5);
        ReleaseTableLock($orderID);
        print('[accepted]'); 
        return;
    }

    MarkAsAuthorised($orderID); //changes status to 1 - authorised

    //check if we need to Capture automatically
    if($adyenParams['adyen_capture']==1)
    {
        $adyen = new AdyenGateway();
        $data = array();
        $data["params"] = $adyenParams;

        $data["userId"] = $paymentRecharge['customerId'];
        $response;
        $result=$adyen->Capture($data,$pspReference,$response,$paymentRecharge['userId'],$paymentRecharge['adyen_amount'],$paymentRecharge['currency']);
    }
}

if (($eventCode=="AUTHORISATION") && ($success=="false"))
{
        SetPaymentStatus($orderID,6);
        ReleaseTableLock($orderID);
        print('[accepted]');
        return;
}

if (($eventCode=="CAPTURE") && ($success=="true"))
{
        SetPaymentStatus($orderID,2);
        ProcessPayment($orderID);
}



//Release the payment order lock
ReleaseTableLock($orderID);
print('[accepted]');

Any ideas for why this is happening?

Was it helpful?

Solution

The solution is not in the sample of code that I shared earlier. It happened like this - As per usual, I have a table lock, given the fact that Adyen sends parallel notifications and modifications and maybe some of them are for other accounts that made a payment and if the table lock failed, I was sending them a [failed] response, instead of [accepted].

Adyen does not accept [failed] responses. Doing so results in the message queue getting blocked for retries. This is clearly mentioned in the documentation.

Their system does not understand [failed], only [accepted]. And for this matter, because I had some older payments that kept coming back as notifications from Adyen, my system did not find them and the lock failed so I kept sending them a [failed] response. And Adyen placed me in the penalty box and marked me as NOT receiving notifications.

From the adyen documentation:

Accept notifications

Send the response "[accepted]" from your server to the Adyen server within 10 seconds of receiving a notification. We recommend that you accept and reply to notifications separately from processing them.

After our server receives this response, all items in the notification are marked as received.

At-least-once delivery

If the notification delivery fails, or in case it is not possible to determine, from the response, whether the message was delivered successfully or not, notifications are sent multiple times. This at-least-once delivery rule means that you may receive the same notification multiple times.

Retries

Whenever a successful response is not explicitly received, notifications are sent multiple times at regular, increasing time intervals:

2 minutes 5 minutes 10 minutes 15 minutes 30 minutes 1 hour 2 hours 4 hours 8 hours A system message is displayed in the Adyen Customer Area (CA) after the third unsuccessful attempt, i.e. after 2 + 5 + 10 = 17 minutes. Then, the system continues retrying every 8 hours during the following seven days.

If you want to trigger a resend attempt, you can send a test notification to yourself:

In the Customer Area, go to Settings > Server Communications. If the operation is successful, all queued notifications are resent. Otherwise, you get an overview of the current errors our system has recorded until then.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top