JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrPKЊZ="laravel-paytm-wallet/composer.jsonnu[{ "name": "anandsiddharth/laravel-paytm-wallet", "description": "Integrate paytm wallet easily with this package. This package uses official Paytm PHP SDK's", "license": "MIT", "keywords": ["paytm wallet", "laravel"], "authors": [ { "name": "Anand Siddharth", "email": "anandsiddharth21@gmail.com" } ], "minimum-stability": "dev", "require": { "php": ">=7.3.0", "illuminate/support": ">=8.0", "illuminate/contracts": ">=8.0" }, "autoload": { "psr-4": { "Anand\\LaravelPaytmWallet\\": "src/" } }, "extra": { "laravel": { "providers": [ "Anand\\LaravelPaytmWallet\\PaytmWalletServiceProvider" ], "aliases": { "PaytmWallet": "Anand\\LaravelPaytmWallet\\Facades\\PaytmWallet" } } } } PKЊZ8j !!8laravel-paytm-wallet/src/Traits/HasTransactionStatus.phpnu[response['STATUS'] == PaytmWallet::STATUS_OPEN){ return true; } return false; } public function isFailed(){ if ($this->response['STATUS'] == PaytmWallet::STATUS_FAILURE) { return true; } return false; } public function isSuccessful(){ if($this->response['STATUS'] == PaytmWallet::STATUS_SUCCESSFUL){ return true; } return false; } public function isPending(){ if($this->response['STATUS'] == PaytmWallet::STATUS_PENDING){ return true; } return false; } }PKЊZ2m/laravel-paytm-wallet/src/PaytmWalletManager.phpnu[driver($driver); } protected function createReceiveDriver(){ $this->config = $this->container['config']['services.paytm-wallet']; return $this->buildProvider( 'Anand\LaravelPaytmWallet\Providers\ReceivePaymentProvider', $this->config ); } protected function createStatusDriver(){ $this->config = $this->container['config']['services.paytm-wallet']; return $this->buildProvider( 'Anand\LaravelPaytmWallet\Providers\StatusCheckProvider', $this->config ); } protected function createBalanceDriver(){ $this->config = $this->container['config']['services.paytm-wallet']; return $this->buildProvider( 'Anand\LaravelPaytmWallet\Providers\BalanceCheckProvider', $this->config ); } protected function createAppDriver(){ $this->config = $this->container['config']['services.paytm-wallet']; return $this->buildProvider( 'Anand\LaravelPaytmWallet\Providers\PaytmAppProvider', $this->config ); } protected function createRefundDriver() { $this->config = $this->container['config']['services.paytm-wallet']; return $this->buildProvider( 'Anand\LaravelPaytmWallet\Providers\RefundPaymentProvider', $this->config ); } protected function createRefundStatusDriver(){ $this->config = $this->container['config']['services.paytm-wallet']; return $this->buildProvider( 'Anand\LaravelPaytmWallet\Providers\RefundStatusCheckProvider', $this->config ); } public function getDefaultDriver(){ throw new \Exception('No driver was specified. - Laravel Paytm Wallet'); } public function buildProvider($provider, $config){ return new $provider( $this->container['request'], $config ); } } PKЊZ×?laravel-paytm-wallet/src/resources/views/app_redirect.blade.phpnu[ Paytm Redirect back to the app
PKЊZv ;laravel-paytm-wallet/src/resources/views/transact.blade.phpnu[ Merchant Check Out Page

Your transaction is being processed!!!

Please do not refresh this page...

@yield('payment_redirect') PKЊZĆX67laravel-paytm-wallet/src/resources/views/form.blade.phpnu[@extends($view) @section('payment_redirect')
@foreach ($params as $key => $value) @endforeach
@stopPKЊZ5hh0laravel-paytm-wallet/src/Facades/PaytmWallet.phpnu[app->singleton('Anand\LaravelPaytmWallet\Contracts\Factory', function ($app) { // $this->app->singleton('PaytmWallet', function ($app) { return new PaytmWalletManager($app); }); } public function boot(){ $this->loadViewsFrom(__DIR__.'/resources/views', 'paytmwallet'); } public function provides(){ return ['Anand\LaravelPaytmWallet\Contracts\Factory']; } }PKЊZ%oo<laravel-paytm-wallet/src/Providers/RefundPaymentProvider.phpnu[ NULL, 'reference' => NULL, 'amount' => NULL, 'transaction' => NULL ]; $_p = array_merge($defaults, $params); foreach ($_p as $key => $value) { if ($value == NULL) { throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method'); return false; } } $this->parameters = $_p; return $this; } private function beginTransaction(){ $params = array(); $params["MID"] = $this->merchant_id; $params["ORDERID"] = $this->parameters['order']; $params["REFID"] = $this->parameters['reference']; $params["TXNTYPE"] = 'REFUND'; $params["REFUNDAMOUNT"] = $this->parameters['amount']; $params["TXNID"] = $this->parameters['transaction']; $chk = getChecksumFromArray($params, $this->merchant_key); $params['CHECKSUM'] = $chk; $this->response = $this->api_call_new($this->paytm_refund_url, $params); return $this; } public function initiate(){ if ($this->parameters == null) { throw new \Exception("prepare() method not called"); } $this->beginTransaction(); return $this; } public function response(){ return $this->response; } public function isRefundAlreadyRaised() { if ($this->isFailed() && $this->response()['RESPCODE'] == PaytmWallet::REPSONSE_REFUND_ALREADY_RAISED) { return true; } return false; } } PKЊZJ'RHH7laravel-paytm-wallet/src/Providers/PaytmAppProvider.phpnu[all(), $this->merchant_key); return response()->json([ 'CHECKSUMHASH' => $checksum, 'ORDER_ID' => $request->get('ORDER_ID'), 'payt_STATUS' => '1' ]); } public function verify(Request $request, $success = null, $error = null){ $paramList = $request->all(); $return_array = $request->all(); $paytmChecksum = $request->get('CHECKSUMHASH'); $isValidChecksum = verifychecksum_e($paramList, $this->merchant_key, $paytmChecksum); if ($isValidChecksum) { if ($success != null && is_callable($success)) { $success(); } }else{ if ($error != null && is_callable($error)) { $error(); } } $return_array["IS_CHECKSUM_VALID"] = $isValidChecksum ? "Y" : "N"; unset($return_array["CHECKSUMHASH"]); $encoded_json = htmlentities(json_encode($return_array)); return view('paytmwallet::app_redirect')->with('json', $encoded_json); } }PKЊZq]j:laravel-paytm-wallet/src/Providers/PaytmWalletProvider.phpnu[request = $request; if ($config['env'] == 'production') { $domain = 'securegw.paytm.in'; }else{ $domain = 'securegw-stage.paytm.in'; } $this->paytm_txn_url = 'https://'.$domain.'/theia/processTransaction'; $this->paytm_txn_status_url = 'https://'.$domain.'/merchant-status/getTxnStatus'; $this->paytm_refund_url = 'https://'.$domain.'/refund/HANDLER_INTERNAL/REFUND'; $this->paytm_refund_status_url = 'https://'.$domain.'/refund/HANDLER_INTERNAL/getRefundStatus'; $this->paytm_balance_check_url = 'https://'.$domain.'/refund/HANDLER_INTERNAL/getRefundStatus'; $this->merchant_key = $config['merchant_key']; $this->merchant_id = $config['merchant_id']; $this->merchant_website = $config['merchant_website']; $this->industry_type = $config['industry_type']; $this->channel = $config['channel']; } public function response(){ $checksum = $this->request->get('CHECKSUMHASH'); if(verifychecksum_e($this->request->post(), $this->merchant_key, $checksum) == "TRUE"){ return $this->response = $this->request->post(); } throw new \Exception('Invalid checksum'); } public function getResponseMessage() { return $this->response()['RESPMSG']; } public function api_call($url, $params){ return callAPI($url, $params); } public function api_call_new($url, $params){ return callAPI($url, $params); } } PKЊZe;laravel-paytm-wallet/src/Providers/BalanceCheckProvider.phpnu[ NULL, ]; $_p = array_merge($defaults, $params); foreach ($_p as $key => $value) { if ($value == NULL) { throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method'); return false; } } $this->parameters = $_p; return $this; } public function check(){ if ($this->parameters == null) { throw new \Exception("prepare() method not called"); } return $this->beginTransaction(); } private function beginTransaction(){ $params = [ 'MID' => $this->merchant_id, 'TOKEN' => $this->parameters['token'] ]; return $this->api_call($this->paytm_balance_check_url, $params); } }PKЊZ@laravel-paytm-wallet/src/Providers/RefundStatusCheckProvider.phpnu[ NULL, 'reference' => NULL, ]; $_p = array_merge($defaults, $params); foreach ($_p as $key => $value) { if ($value == NULL) { throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method'); return false; } } $this->parameters = $_p; return $this; } public function check(){ if ($this->parameters == null) { throw new \Exception("prepare() method not called"); } return $this->beginTransaction(); } private function beginTransaction(){ $params = array( 'MID' => $this->merchant_id, 'ORDERID' => $this->parameters['order'], 'REFID' => $this->parameters['reference'] ); $chk = getChecksumFromArray($params, $this->merchant_key); $params['CHECKSUM'] = $chk; $this->response = $this->api_call_new($this->paytm_txn_status_url, $params); return $this; } public function response(){ return $this->response; } public function getOrderId(){ return $this->response()['ORDERID']; } public function getTransactionId(){ return $this->response()['TXNID']; } } PKЊZT<7ll:laravel-paytm-wallet/src/Providers/StatusCheckProvider.phpnu[ NULL, ]; $_p = array_merge($defaults, $params); foreach ($_p as $key => $value) { if ($value == NULL) { throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method'); return false; } } $this->parameters = $_p; return $this; } public function check(){ if ($this->parameters == null) { throw new \Exception("prepare() method not called"); } return $this->beginTransaction(); } private function beginTransaction(){ $params = array( 'MID' => $this->merchant_id, 'ORDERID' => $this->parameters['order'] ); $chk = getChecksumFromArray($params, $this->merchant_key); $params['CHECKSUMHASH'] = $chk; $this->response = $this->api_call_new($this->paytm_txn_status_url, $params); return $this; } public function response(){ return $this->response; } public function getOrderId(){ return $this->response()['ORDERID']; } public function getTransactionId(){ return $this->response()['TXNID']; } } PKЊZK/=laravel-paytm-wallet/src/Providers/ReceivePaymentProvider.phpnu[ NULL, 'user' => NULL, 'amount' => NULL, 'callback_url' => NULL, 'email' => NULL, 'mobile_number' => NULL, ]; $_p = array_merge($defaults, $params); foreach ($_p as $key => $value) { if ($value == NULL) { throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method'); return false; } } $this->parameters = $_p; return $this; } public function receive(){ if ($this->parameters == null) { throw new \Exception("prepare() method not called"); } return $this->beginTransaction(); } public function view($view) { if($view) { $this->view = $view; } return $this; } private function beginTransaction(){ $params = [ 'REQUEST_TYPE' => 'DEFAULT', 'MID' => $this->merchant_id, 'ORDER_ID' => $this->parameters['order'], 'CUST_ID' => $this->parameters['user'], 'INDUSTRY_TYPE_ID' => $this->industry_type, 'CHANNEL_ID' => $this->channel, 'TXN_AMOUNT' => $this->parameters['amount'], 'WEBSITE' => $this->merchant_website, 'CALLBACK_URL' => $this->parameters['callback_url'], 'MOBILE_NO' => $this->parameters['mobile_number'], 'EMAIL' => $this->parameters['email'], ]; return view('paytmwallet::form')->with('view', $this->view)->with('params', $params)->with('txn_url', $this->paytm_txn_url)->with('checkSum', getChecksumFromArray($params, $this->merchant_key)); } public function getOrderId(){ return $this->response()['ORDERID']; } public function getTransactionId(){ return $this->response()['TXNID']; } } PKЊZsd/laravel-paytm-wallet/src/Contracts/Provider.phpnu[ **For Laravel 6.0** use version `^1.0.0`
**For Laravel 7.0** use version `^1.0.0`
**For Laravel 8.0** use version `^2.0.0`
## Introduction Integrate paytm wallet in your laravel application easily with this package. This package uses official Paytm PHP SDK's. ## License Laravel Paytm Wallet open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT) ## Getting Started To get started add the following package to your `composer.json` file using this command. composer require anandsiddharth/laravel-paytm-wallet ## Configuring **Note: For Laravel 5.5 and above auto-discovery takes care of below configuration.** When composer installs Laravel Paytm Wallet library successfully, register the `Anand\LaravelPaytmWallet\PaytmWalletServiceProvider` in your `config/app.php` configuration file. ```php 'providers' => [ // Other service providers... Anand\LaravelPaytmWallet\PaytmWalletServiceProvider::class, ], ``` Also, add the `PaytmWallet` facade to the `aliases` array in your `app` configuration file: ```php 'aliases' => [ // Other aliases 'PaytmWallet' => Anand\LaravelPaytmWallet\Facades\PaytmWallet::class, ], ``` #### Add the paytm credentials to the `.env` file ```bash PAYTM_ENVIRONMENT=local PAYTM_MERCHANT_ID=YOUR_MERCHANT_ID_HERE PAYTM_MERCHANT_KEY=YOUR_SECRET_KEY_HERE PAYTM_MERCHANT_WEBSITE=YOUR_MERCHANT_WEBSITE PAYTM_CHANNEL=YOUR_CHANNEL_HERE PAYTM_INDUSTRY_TYPE=YOUR_INDUSTRY_TYPE_HERE ``` #### One more step to go.... On your `config/services.php` add the following configuration ```php 'paytm-wallet' => [ 'env' => env('PAYTM_ENVIRONMENT'), // values : (local | production) 'merchant_id' => env('PAYTM_MERCHANT_ID'), 'merchant_key' => env('PAYTM_MERCHANT_KEY'), 'merchant_website' => env('PAYTM_MERCHANT_WEBSITE'), 'channel' => env('PAYTM_CHANNEL'), 'industry_type' => env('PAYTM_INDUSTRY_TYPE'), ], ``` Note : All the credentials mentioned are provided by Paytm after signing up as merchant. #### Laravel 7 Changes Our package is comptible with Laravel 7 but same_site setting is changed in default Laravel installation, make sure you change `same_site` to `null` in `config/session.php` or callback won't include cookies and you will be logged out when a payment is completed ```php null, ]; ``` ## Usage ### Making a transaction ```php prepare([ 'order' => $order->id, 'user' => $user->id, 'mobile_number' => $user->phonenumber, 'email' => $user->email, 'amount' => $order->amount, 'callback_url' => 'http://example.com/payment/status' ]); return $payment->receive(); } /** * Obtain the payment information. * * @return Object */ 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 } } ``` Make sure the `callback_url` you have mentioned while receiving payment is `post` on your `routes.php` file, Example see below: ```php Route::post('/payment/status', [App\Http\Controllers\PaytmController::class,'paymentCallback'])->name('status'); ``` Important: The `callback_url` must not be csrf protected [Check out here to how to do that](https://laracasts.com/discuss/channels/general-discussion/l5-disable-csrf-middleware-on-certain-routes) ### Get transaction status/information using order id ```php prepare(['order' => $order->id]); $status->check(); $response = $status->response(); // To get raw response as array //Check out response parameters sent by paytm here -> http://paywithpaytm.com/developer/paytm_api_doc?target=txn-status-api-description if($status->isSuccessful()){ //Transaction Successful }else if($status->isFailed()){ //Transaction Failed }else if($status->isOpen()){ //Transaction Open/Processing } $status->getResponseMessage(); //Get Response Message If Available //get important parameters via public methods $status->getOrderId(); // Get order id $status->getTransactionId(); // Get transaction id } } ``` ### Initiating Refunds ```php prepare([ 'order' => $order->id, 'reference' => "refund-order-4", // provide refund reference for your future reference (should be unique for each order) 'amount' => 300, // refund amount 'transaction' => $order->transaction_id // provide paytm transaction id referring to this order ]); $refund->initiate(); $response = $refund->response(); // To get raw response as array if($refund->isSuccessful()){ //Refund Successful }else if($refund->isFailed()){ //Refund Failed }else if($refund->isOpen()){ //Refund Open/Processing }else if($refund->isPending()){ //Refund Pending } } } ``` ### Check Refund Status ```php prepare([ 'order' => $order->id, 'reference' => "refund-order-4", // provide reference number (the same which you have entered for initiating refund) ]); $refundStatus->check(); $response = $refundStatus->response(); // To get raw response as array if($refundStatus->isSuccessful()){ //Refund Successful }else if($refundStatus->isFailed()){ //Refund Failed }else if($refundStatus->isOpen()){ //Refund Open/Processing }else if($refundStatus->isPending()){ //Refund Pending } } } ``` ### Customizing transaction being processed page Considering the modern app user interfaces, default "transaction being processed page" is too dull which comes with this package. If you would like to modify this, you have the option to do so. Here's how: You just need to change 1 line in you `OrderController`'s code. ```php prepare([ 'order' => $order->id, 'user' => $user->id, 'mobile_number' => $user->phonenumber, 'email' => $user->email, 'amount' => $order->amount, 'callback_url' => 'http://example.com/payment/status' ]); return $payment->view('your_custom_view')->receive(); } ``` Here `$payment->receive()` is replaced with `$payment->view('your_custom_view')->receive()`. Replace `your_custom_view` with your view name which resides in your `resources/views/your_custom_view.blade.php`. And in your view file make sure you have added this line of code before `` (i.e. before closing body tag), which redirects to payment gateway. `@yield('payment_redirect')` Here's a sample custom view: ```html

Custom payment message

@yield('payment_redirect') ``` That's all folks! ## Support on Beerpay [![Beerpay](https://beerpay.io/anandsiddharth/laravel-paytm-wallet/badge.svg?style=beer-square)](https://beerpay.io/anandsiddharth/laravel-paytm-wallet) [![Beerpay](https://beerpay.io/anandsiddharth/laravel-paytm-wallet/make-wish.svg?style=flat-square)](https://beerpay.io/anandsiddharth/laravel-paytm-wallet?focus=wish) PKЊZפ00laravel-paytm-wallet/LICENSEnu[MIT License Copyright (c) 2016 Anand Siddharth Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PKЊZv -)laravel-paytm-wallet/lib/encdec_paytm.phpnu[ $value) { if ($flag) { $paramStr .= checkString_e($value); $flag = 0; } else { $paramStr .= "|" . checkString_e($value); } } return $paramStr; } function redirect2PG($paramList, $key) { $hashString = getchecksumFromArray($paramList); $checksum = encrypt_e_openssl($hashString, $key); } function removeCheckSumParam($arrayList) { if (isset($arrayList["CHECKSUMHASH"])) { unset($arrayList["CHECKSUMHASH"]); } return $arrayList; } function getTxnStatus($requestParamList) { return callAPI(PAYTM_STATUS_QUERY_URL, $requestParamList); } function initiateTxnRefund($requestParamList) { $CHECKSUM = getChecksumFromArray($requestParamList,PAYTM_MERCHANT_KEY,0); $requestParamList["CHECKSUM"] = $CHECKSUM; return callAPI(PAYTM_REFUND_URL, $requestParamList); } function callAPI($apiURL, $requestParamList) { $jsonResponse = ""; $responseParamList = array(); $JsonData =json_encode($requestParamList); $postData = 'JsonData='.urlencode($JsonData); $ch = curl_init($apiURL); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($postData)) ); $jsonResponse = curl_exec($ch); $responseParamList = json_decode($jsonResponse,true); return $responseParamList; } PKЊZ="laravel-paytm-wallet/composer.jsonnu[PKЊZ8j !!8laravel-paytm-wallet/src/Traits/HasTransactionStatus.phpnu[PKЊZ2m/|laravel-paytm-wallet/src/PaytmWalletManager.phpnu[PKЊZ×?alaravel-paytm-wallet/src/resources/views/app_redirect.blade.phpnu[PKЊZv ;rlaravel-paytm-wallet/src/resources/views/transact.blade.phpnu[PKЊZĆX67laravel-paytm-wallet/src/resources/views/form.blade.phpnu[PKЊZ5hh0laravel-paytm-wallet/src/Facades/PaytmWallet.phpnu[PKЊZ]GG7laravel-paytm-wallet/src/PaytmWalletServiceProvider.phpnu[PKЊZ%oo<Zlaravel-paytm-wallet/src/Providers/RefundPaymentProvider.phpnu[PKЊZJ'RHH75$laravel-paytm-wallet/src/Providers/PaytmAppProvider.phpnu[PKЊZq]j:(laravel-paytm-wallet/src/Providers/PaytmWalletProvider.phpnu[PKЊZe;?1laravel-paytm-wallet/src/Providers/BalanceCheckProvider.phpnu[PKЊZ@j5laravel-paytm-wallet/src/Providers/RefundStatusCheckProvider.phpnu[PKЊZT<7ll:;laravel-paytm-wallet/src/Providers/StatusCheckProvider.phpnu[PKЊZK/=eAlaravel-paytm-wallet/src/Providers/ReceivePaymentProvider.phpnu[PKЊZsd/Ilaravel-paytm-wallet/src/Contracts/Provider.phpnu[PKЊZx  .Jlaravel-paytm-wallet/src/Contracts/Factory.phpnu[PKЊZE|((bLlaravel-paytm-wallet/README.mdnu[PKЊZפ00tlaravel-paytm-wallet/LICENSEnu[PKЊZv -)3ylaravel-paytm-wallet/lib/encdec_paytm.phpnu[PK @