0

Friend. I try To integrate quickpay in my PHP site. my quickpay payment form

<form method="POST" action="https://payment.quickpay.net">
<input type="hidden" name="version" value="v10">
<input type="hidden" name="merchant_id" value="43215429">
<input type="hidden" name="agreement_id" value="114267437">
<input type="hidden" name="order_id" value="0001">
<input type="hidden" name="amount" value="100">
<input type="hidden" name="currency" value="INR">
<input type="hidden" name="continueurl" value="http://shop.domain.tld/continue">
<input type="hidden" name="cancelurl" value="http://shop.domain.tld/cancel">
<input type="hidden" name="callbackurl" value="http://shop.domain.tld/callback">
<input type="hidden" name="checksum" value="ed93f788f699c42aefa8a6713794b4d347ff493ecce1aca660581fb1511a1816">
<input type="submit" value="Continue to payment...">
</form>

But When I try to test code it shows error like

Invalid checksum

Please Help Friend How Generate Checksum In form For success payment Thank

Akash Jha
  • 11
  • 7

1 Answers1

0

The QuickPay Form employs a checksum mechanism to authenticate you and your system and ensure that the data has not been tangled with.

<?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
}
?>

Checksum of the entire raw callback request body - using HMAC with SHA256 as the cryptographic hash function. The checksum is signed using the Account's private key.

Jaydeep Rajput
  • 3,605
  • 17
  • 35