PHP code example of brainlabsweb / laravel-paytm

1. Go to this page and download the library: Download brainlabsweb/laravel-paytm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

brainlabsweb / laravel-paytm example snippets

sh
php artisan vendor:publish --provider="Brainlabsweb\Paytm\PaytmServiceProvider"

/**
* The below are mandatory fields
* optional fields MOBILE_NO, EMAIL
*/
$data = [
    'ORDER_ID'   => 'order_id',
    'TXT_AMOUNT' => '1',
    'CUST_ID'    => 'custid'
];
<form method="POST" action="{{ paytm()->getTxnUrl() }}">
    @foreach(\Brainlabsweb\Paytm\Paytm::prepare($data) as $key => value)
    <input type="hidden" name="{{ $key }}" value="{{ $value }}">   
    @endforeach
    
    <button type="submit">Pay</button>
</form>
OR

paytm()->prepare($data)

\Brainlabsweb\Paytm\Paytm::verify(); // returns true/false 

OR

paytm()->verify();

\Brainlabsweb\Paytm\Paytm::response(); // returns paytm response array 

OR
                  
paytm()->response();                   

Make POST REQUEST with param $order_id

\Brainlabsweb\Paytm\Paytm::getTransactionStatus($order_id); // returns paytm response array

OR

paytm()->getTransactionStatus($order_id); 

$data = [
    'ORDERID'   => 'order_id',
    'REFID' => 'ref1', // should be unique everytime
    'TXNID'    => 'TXNID' // will get as response when made a transaction
    'REFUNDAMOUNT' => '1',
    'COMMENT' => 'SOME TEXT' // THIS IS OPTIONAL PARAMTER
];

\Brainlabsweb\Paytm\Paytm::refund($data); // returns paytm response array 

OR

paytm()->refund($data);

$data = [
    'ORDERID'   => 'order_id',
    'REFID' => 'ref1', // This is REFID for which refund status is being inquired
];

\Brainlabsweb\Paytm\Paytm::refundStatus($data); // returns paytm response array

OR

paytm()->refundStatus($data);