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

MID missing: This attribute is not passed. It is a mandatory attribute #35

Closed sathiyad closed 4 years ago

sathiyad commented 4 years ago

Getting the error message for the following code,

        $payTMwallet = PaytmWallet::with('receive');
        $payTMwallet->prepare([
            'order' => 123,
            'user' => 11111,
            'mobile_number' => '77777 77777',
            'email' => 'some@email.com',
            'amount' => '10',
            'callback_url' => 'http://LocalCalbackURL'
          ]);
          return $payTMwallet->receive();
    }

Which return an HTML page and which automatically submit and return this error. http://i.prntscr.com/UQMIJb55S26WYwCJ1GjmYg.png

anandsiddharth commented 4 years ago

Check config, you might have missed adding.

Ref : https://github.com/anandsiddharth/laravel-paytm-wallet#configuring

sathiyad commented 4 years ago

@anandsiddharth I checked it still getting the same error.

steps I have done.

  1. Added package by composer command.
  2. Registered in bootstrap\app.php since I am using Lumen.
  3. Added paytm-wallet array to config\services.php
    <?php
    return array(
    'paytm-wallet' => [
        'env' => 'local', 
        'merchant_id' => 'paytmTestID',
        'merchant_key' => 'paytmTestKey',
        'merchant_website' => 'mysite.com',
        'channel' => 'WEB',
        'industry_type' => 'Retail',
    ],
    );
  4. controller code in here.

    public function initiatePay(Request $request){
        $payTMwallet = PaytmWallet::with('receive');
    
        $payTMwallet->prepare([
            'order' => 123,
            'user' => 11111,
            'mobile_number' => '77777 77777',
            'email' => 'some@email.com',
            'amount' => '10',
            'callback_url' => 'http://LocalCalbackURL'
          ]);
    
          return $payTMwallet->receive();
    }

still getting the same error

MID missing: This attribute is not passed. It is a mandatory attribute

sathiyad commented 4 years ago

In Lumen, services not registered by default. After adding the following line of code in bootstrap\app.php It works.

$app->configure('services');