收到HTTP 403错误

时间:2018-08-09 09:43:21

标签: php payment-processing razorpay

我在 Linux共享主机服务器上的以下URL(test link)上设置了付款网关代码:

我突然开始在此链接上收到 HTTP 403 错误,甚至没有更改任何一行代码。

有趣的是,如果我从网址中删除了redirecturl=http%3A%2F%2Fmanage.india.resellerclub.com%2Fservlet%2FTestCustomPaymentAuthCompletedServlet参数,错误就会停止,但这会破坏我的付款网关完成付款的URL重定向要求。

此代码接受Razorpay的付款,并将用户重定向到我的ResellerClub帐户。

这是我的代码:

<?php
//  if (session_status !== PHP_SESSION_ACTIVE) {
        session_start();
//  }
    require("functions.php");   //file which has required functions
?>      

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="icon" href="https://transact.theadm.in/favi.ico">

    <title>Order Summary | Payment Page</title>

    <!-- Bootstrap core CSS -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <style>

        html {
            position: relative;
            min-height: 100%;
        }

        .container {
            width: auto;
            max-width: 680px;
            padding: 0 15px;
        }

    </style>

</head>
<body>

<?php

        $key = "XXXXX"; //replace ur 32 bit secure key , Get your secure key from your Reseller Control panel

        //This filter removes data that is potentially harmful for your application. It is used to strip tags and remove or encode unwanted characters.
        $_GET = filter_var_array($_GET, FILTER_SANITIZE_STRING);


        //Below are the  parameters which will be passed from foundation as http GET request
        $paymentTypeId = $_GET["paymenttypeid"];  //payment type id
        //echo $paymentTypeId;
        $transId = $_GET["transid"];               //This refers to a unique transaction ID which we generate for each transaction
        $userId = $_GET["userid"];               //userid of the user who is trying to make the payment
        $userType = $_GET["usertype"];             //This refers to the type of user perofrming this transaction. The possible values are "Customer" or "Reseller"
        $transactionType = $_GET["transactiontype"];  //Type of transaction (ResellerAddFund/CustomerAddFund/ResellerPayment/CustomerPayment)

        $invoiceIds = $_GET["invoiceids"];         //comma separated Invoice Ids, This will have a value only if the transactiontype is "ResellerPayment" or "CustomerPayment"
        $debitNoteIds = $_GET["debitnoteids"];     //comma separated DebitNotes Ids, This will have a value only if the transactiontype is "ResellerPayment" or "CustomerPayment"

        $sellingCurrencyAmount = $_GET["sellingcurrencyamount"]; //This refers to the amount of transaction in your Selling Currency
        $accountingCurrencyAmount = $_GET["accountingcurrencyamount"]; //This refers to the amount of transaction in your Accounting Currency

        $description = $_GET["description"];

        if($transactionType == "CustomerAddFund" || $transactionType=="ResellerAddFund")
            $des2="Add Funds <i>(INR ".$sellingCurrencyAmount.")</i>";
        else
            $des2= $description. " <i>(INR " .$sellingCurrencyAmount. ")</i>";

        $redirectUrl = $_GET["redirecturl"];  //This is the URL on our server, to which you need to send the user once you have finished charging him

        $checksum = $_GET["checksum"];   //checksum for validation

        if(verifyChecksum($paymentTypeId, $transId, $userId, $userType, $transactionType, $invoiceIds, $debitNoteIds, $description, $sellingCurrencyAmount, $accountingCurrencyAmount, $key, $checksum))
        {
            //YOUR CODE GOES HERE           

        /** 
        * since all these data has to be passed back to foundation after making the payment you need to save these data
        *   
        * You can make a database entry with all the required details which has been passed from foundation.  
        *
        *                           OR
        *   
        * keep the data to the session which will be available in postpayment.php as we have done here.
        *
        * It is recommended that you make database entry.
        **/




            $_SESSION['redirecturl']=$redirectUrl;
            $_SESSION['transid']=$transId;
            $_SESSION['sellingcurrencyamount']=$sellingCurrencyAmount;
            $_SESSION['accountingcurencyamount']=$accountingCurrencyAmount;
            $RazorPayAmount=($accountingCurrencyAmount/10)*1000;


echo <<<FORM

    <div class="container">
      <div class="page-header">
        <h2><img src="https://transact.theadm.in/logo.png" width="279" height="40"/> <span class="pull-right">Order Summary</span></h2>
      </div>

      <br />

      <p class="lead">{$des2} <span class="lead pull-right">₹{$accountingCurrencyAmount}</span></p>

      <br />

      <p>Click on the Pay Now button below to finalize your order via our our payment provider's secure environment.</p>

      <form name="paymentpage" action="https://transact.theadm.in/in/postpayment.php" class="text-right">
          <script
            src="https://checkout.razorpay.com/v1/checkout.js"
            data-key="XXXXX"
            data-amount="{$RazorPayAmount}"
            data-name="TheAdm.in"
            data-description="{$description}"
            data-netbanking="true"
            data-prefill.name="{$_GET["name"]}"
            data-prefill.email="{$_GET["emailAddr"]}"
            data-prefill.contact="{$_GET["telNo"]}"
            data-notes.shopping_order_id="{$transId}">
          </script>

      </form>
    </div>

FORM;


        }
        else
        {
            /**This message will be dispayed in any of the following case
            *
            * 1. You are not using a valid 32 bit secure key from your Reseller Control panel
            * 2. The data passed from foundation has been tampered.
            *
            * In both these cases the customer has to be shown error message and shound not
            * be allowed to proceed  and do the payment.
            *
            **/

            echo "Checksum mismatch. !";            

        }
?>
</body>
</html>

我已经尝试了所有我知道的东西,但是这个错误似乎并没有解决。谁能帮我吗?

0 个答案:

没有答案