namespace, '/generate_txn_token', [ [ 'methods' => 'POST', 'callback' => [ $this, 'generate_txn_token' ], 'permission_callback' => function () { return parent::checkApiPermission(); }, ], ] ); } public function generate_txn_token( $request ) { if ( ! is_plugin_active( 'paytm-payments/woo-paytm.php' ) ) { return parent::sendError( 'invalid_plugin', 'You need to install Paytm WooCommerce Payment Gateway plugin to use this api', 404 ); } $json = file_get_contents( 'php://input' ); $body = json_decode( $json, true ); $params = [ 'order_id' => sanitize_text_field( $body['order_id'] ), 'amount' => sanitize_text_field( $body['amount'] ), 'cust_id' => sanitize_text_field( $body['cust_id'] ), ]; $payTm = new WC_paytm(); return $payTm->blinkCheckoutSend( $params ); } } new FlutterPayTm();