The Init.php
file is responsible for initializing the custom payment gateway within the Tutor LMS ecosystem. It registers the necessary hooks to connect the gateway with Tutor LMS, allowing the system to recognize the custom payment method and its configuration.
What to Update
Payment Gateway Name:
In the code, the payment gateway name is set as 'custompayment'
. You should update this to match the name of your payment gateway.
Payment Gateway Classes:
The CustomPaymentGateway::class
and CustomPaymentConfig::class
in the payment_gateways_with_ref
and filter_payment_gateways
functions need to be updated to reflect the new gateway class names.
Gateway Label:
The label 'Custom Payment'
in the $custom_payment_method
array should be updated to the display name of your payment gateway.
Gateway Fields:
The fields
array holds the settings and configuration fields for the payment gateway. These are the fields shown to the user in the admin settings. You can add new fields or modify the existing ones as needed for your gateway. For example:
If your payment gateway requires additional fields (e.g. merchant ID), you can add them to the fields
array in the same format.
array(
'name' => 'merchant_id',
'type' => 'secret_key',
'label' => 'Merchant ID',
'value' => '',
),
Icon:
If you want to add an icon for your payment gateway, specify the URL in the 'icon'
field. This could be a link to an image hosted on your server.
Subscription Support:
The 'support_subscription' => false
value indicates that the gateway does not support subscriptions. If your payment gateway supports subscriptions, change this value to true
.
Adding More Fields:
If your gateway requires additional settings, simply add more fields to the fields
array in the $custom_payment_method
configuration.
By updating these sections, you can integrate your custom payment gateway into Tutor LMS while customizing it to meet your specific gateway requirements.