0

I am trying to implement Quickpay API.

While doing so, I am also trying to make use of the callback-functionality as described here: https://learn.quickpay.net/tech-talk/api/callback/

And just to get started, I am using the PHP code-snippet found on the abovementioned page:

<?php
    function sign($base, $private_key) {
        return hash_hmac("sha256", $base, $private_key);
    }

    $request_body = file_get_contents("php://input");
    $checksum     = sign($request_body, "your_account_private_key");

    if ($checksum == $_SERVER["HTTP_QUICKPAY_CHECKSUM_SHA256"]) {
      // Request is authenticated
    } else {
      // Request is NOT authenticated
    }
?>

However, looking at this code, I simply don't understand how/from where the $_SERVER["HTTP_QUICKPAY_CHECKSUM_SHA256"] should be populated with any value?

...and sure enough; merely hoping for magic and trying to execute the afforementioned code just gives me this error:

"Undefined index: HTTP_QUICKPAY_CHECKSUM_SHA256"

So... my question is: How should $_SERVER["HTTP_QUICKPAY_CHECKSUM_SHA256"] be set/populated?

double-beep
  • 5,031
  • 17
  • 33
  • 41
Lars M
  • 1
  • 2

1 Answers1

0

SOLVED! It turns out that a security feature in my script regarding the handling of $_POST was blocking the callback from Quickpay - I turned it off, and now it works just fine.

So... as it turns out: $_SERVER["HTTP_QUICKPAY_CHECKSUM_SHA256"] is populated when you get the callback from Quickpay.

Lars M
  • 1
  • 2