Step 6: Update custompayment.php

This file serves as the main entry point for your custom payment gateway plugin, and it is responsible for registering the plugin, loading necessary files, and initializing the integration with Tutor LMS.

What to Update

Plugin Metadata:

Update the plugin name, URI, description, author, and version information to reflect the details of your custom payment gateway and your company.

Paths and Directories:

The following constants define the paths and URLs for the plugin. Ensure these paths are correct based on your plugin structure:

// Define plugin meta info.
define( 'CUSTOM_PAYMENT_VERSION', '1.0.0' );
define( 'CUSTOM_PAYMENT_URL', plugin_dir_url( __FILE__ ) );
define( 'CUSTOM_PAYMENT_PATH', plugin_dir_path( __FILE__ ) );
define( 'CUSTOM_PAYMENT_PAYMENTS_DIR', trailingslashit( CUSTOM_PAYMENT_PATH . 'src/Payments' ) );

These paths are crucial for locating resources such as payment classes, assets, and other files. If your structure differs, adjust these constants accordingly.

Autoloader:

This line ensures the Composer autoloader is included, allowing any dependencies installed via Composer to be automatically loaded. Make sure the vendor directory exists and contains the required dependencies for your plugin.

Initialization:

The CustomPayment\Init class is instantiated if the necessary conditions are met. This will initialize the gateway integration by registering the necessary hooks and filters.

Make sure the initialization process matches your intended workflow. If there are any additional setup or configurations to be done, you can modify the code here to reflect those changes.

Was this helpful?