phppaytm

Paytm Payment gateway, system error in initate transaction mode php


I am integrating paytm payment gateway in php. I am passing all the required parameters properly to generate checksum code, After hitting the curl, i am getting a system error issue in response. we have tried to contact payment regarding this, but they are not much responding regarding this issue, So i am on my own.

Below i have mentioned my code, If anyone came across this issue before, Help me out to solve this prob

Checksum Code:

Kp+cPIrrZDweulOb3kEsYxMB4h3fJCtTOuT//bhEeJ3fpxIa1rvb6OfT5icCOkANyR4XCzbwhpaCrLCtGWDf/27BA06dSORyJnbqdAj8FKg=

Serverside code

 $encFile = PaytmChecksum::generateSignature($arrInputs,$mid);
 $paytmParams["head"] = array(
        "signature"    => $encFile
    );
    $post_data = json_encode($paytmParams, JSON_UNESCAPED_SLASHES);
    $url = "https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=$mid&orderId=$transactionId";

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
    $headers[] = 'X-Redirect-Url: http://localhost/TEWebSite/web/site/paymentresponse';
    $response = curl_exec($ch);

Initiate Transaction Response: {"head":{"requestId":null,"responseTimestamp":"1607942634809","version":"v1"},"body":{"extraParamsMap":null,"resultInfo":{"resultStatus":"U","resultCode":"00000900","resultMsg":"System error"}}}


Solution

  • my sample.php file which is working fine may you got your problem

    <?php
    require_once("PaytmChecksum.php");
    
    $mid = $_POST["mid"];
    $orderId = $_POST["orderId"];
    $amount = $_POST["amount"];
    $userId = $_POST["userId"];
    
    
    
    $paytmParams = array();
    
    $paytmParams["body"] = array(
        "requestType"   => "Payment",
        "mid"           => $mid,
        "websiteName"   => "WEBSTAGING",
        "orderId"       => $orderId,
        "callbackUrl"   => "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId>",
        "txnAmount"     => array(
            "value"     => intval($amount),
            "currency"  => "INR",
        ),
        "userInfo"      => array(
            "custId"    => "userId",
        ),
    );
    
    $checksum = PaytmChecksum::generateSignature(json_encode($paytmParams["body"], JSON_UNESCAPED_SLASHES), "MKMo2%0SvLS_5z4%");
    
    $paytmParams["head"] = array(
        "signature"    => $checksum
    );
    
    $post_data = json_encode($paytmParams, JSON_UNESCAPED_SLASHES);
    
    $url = "https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=ZpsqDd42488117746297&orderId=$orderId";
    
    
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); 
    $response = curl_exec($ch);
    print_r($response);```