princealikhan / paytm-payment by princealikhan

Payment Integration with Paytm.
Package Data
Maintainer Username: princealikhan
Maintainer Contact: (Prince Ali Khan)
Package Create Date: 2016-10-06
Package Last Update: 2022-07-05
Language: PHP
License: MIT
Last Refreshed: 2024-02-23 03:15:20
Package Statistics
Total Downloads: 816
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 3
Total Watchers: 2
Total Forks: 6
Total Open Issues: 4

Paytm Payment Library For Laravel 5


It simplifies the payment flow with the defined methods. You can pay through paytm just writing few lines of codes. Before you start installing this service, please complete your Paytem setup at on Paytm.


First, you'll need to require the package with Composer:

composer require princealikhan/paytm-payment

Aftwards, run composer update from your command line.

Then, update config/app.php by adding an entry for the service provider.

'providers' => [
	// ...

Then, register class alias by adding an entry in aliases section

'aliases' => [
	// ...
	'Paytm' => 'Princealikhan\PaytmPayment\Facades\Paytm',

Finally, from the command line again, run php artisan vendor:publish to publish the default configuration file. This will publish a configuration file named paytm.php which includes your Paytm authorization keys and aditional settings.


You need to fill in paytm.php file that is found in your applications config directory.


Request for Payment

You can easily send a message to all registered users with the command

$request = array('CUST_ID' => 1 ,'TXN_AMOUNT'=> 1 );

CUST_ID and TXN_AMOUNT fields value are pass to Paytm and redirect to callback URL.

After redirect to callback URL

Once we redirected to callback URL we need to verify whether transaction Success or Fail.


Suppose, your callback URL is Paytm POST respone on your URL. we need to get response.

In routes.php add a post method.

Route::post("payment/callback", "PaymentController@callback");

In PaymentController create a method

public function callback(Request $Request)
$paymentResponse =  $Request->all();
$paymentData     = Paytm::verifyPayment($paymentResponse);

$postData gives transcation details. after, use your business logic to save.

Check Transaction Status


$orderID is the Unique ID generated for the transaction by merchant

Initiate Refund Process


$orderID: Transaction Order Id by merchant.

$amount: Amount to refund.

$txnType; Any one of below values: REFUND CANCEL

Please refer to Documentation. for all customizable parameters.