anandsiddharth / laravel-paytm-wallet

Integrate paytm wallet in your laravel application easily with this package. This package uses official Paytm PHP SDK's.
MIT License
92 stars 40 forks source link

execute else if($transaction->isFailed()) condition when call paymentCallback() in laravel 7 #70

Closed sarvaiyaakshay closed 2 years ago

sarvaiyaakshay commented 2 years ago

public function paymentCallback() { $transaction = PaytmWallet::with('receive');

    $response = $transaction->response(); // To get raw response as array
    //Check out response parameters sent by paytm here -> http://paywithpaytm.com/developer/paytm_api_doc?target=interpreting-response-sent-by-paytm

    if($transaction->isSuccessful()){
      //Transaction Successful
    }else if($transaction->isFailed()){
      //Transaction Failed
    }else if($transaction->isOpen()){
      //Transaction Open/Processing
    }
    $transaction->getResponseMessage(); //Get Response Message If Available
    //get important parameters via public methods
    $transaction->getOrderId(); // Get order id
    $transaction->getTransactionId(); // Get transaction id
}    

}

at the end else if($transaction->isFailed()) condition is execute every time