Developer Center

Module Structure

This document explains where the payment gateway module files are located and how the module works.

Specifying a Module Name

  • When determining the module name of the payment service provider, it should be noted that it starts with a letter (UPPERCASE and lowercase letters) and never contains spaces and special characters.
  • Change the directory named "SamplePaymentModule" in the files you have downloaded from our Github page and the name of the "SamplePaymentModule.php" file in it with the name of the payment service provider you will integrate with. (Ex: PayPalPro.php.)
  • After defining the module name to the directory and files, open the "SamplePaymentModule.php" file and replace the class name in it with the name of the module.
  • Open the "config.php" file and replace the "SamplePaymentModule" with the name of the module.

After following the specified steps, you can upload the module files under the "coremio/modules/Payment/" directory.

Directory/File Structure of the Module

The directory and file structure of the module is as in the diagram below:

coremio/modules/Payment/SamplePaymentModule/
  | - lang/en.php
  |  config.php
  |  SamplePaymentModule.php

If you need, you can install the "API SDK" files of the payment service provider in the module directory. 

coremio/modules/Payment/

It is the directory where the payment modules will be hosted. It is hosted in the form of a directory within the modules.

lang/*.php

The php files under the "lang" directory are used to provide multilingual support in the module. The "en.php" file is used by default. The file content is expected to be prepared as PHP string data and the following mandatory indices should be defined.

name In the area where the administrator views the module, you can change the module name depending on the language.
invoice-name The name that will appear in the invoice preview. Eg: Credit Card
option-name It is the name that will appear in the cart or bill payment options. Ex: Pay by Credit Card
description It is the description field that will appear on the settings/configuration page of the module. (can be left blank)

Example Source Code:

    return [
        'name'                 => 'Sample Payment',
        'invoice-name'         => 'Credit Card',
        'option-name'          => 'Pay by Credit Card',
        'description'          => 'description here…',
    ];

config.php

The setting/configuration fields of the module are contained in this file as PHP string data.

Name Type Mandatory Explanation
meta
∟ name
String Yes Module Name
meta
∟ version
String , Float Yes The version number of the module. Ex:1.0
meta
∟ logo
String No Company logo of the payment service provider. You can define an image file that is in the module directory. Ex: logo.png
meta
∟ card-storage-supported
Boolean No If the payment method type is "Tokenized", this index must be defined as "true".
meta
∟ standard-card-form
Boolean No If the value to be entered is "true", the default WISECP credit card form will appear in front of the customer.
settings
∟ commission_rate
Integer No It is the commission rate that will be applied to the invoice on the WISECP side.
settings
∟ force_convert_to
Integer No After selecting the payment method in the cart, it is necessarily converted to the specified currency. Acceptable value : is the "currencies.id" value in the database.
settings
∟accepted_countries
Array No By using the "ISO 3166-1" country codes in this field, it is ensured that the module is displayed only to the specified countries. (When left blank, it will be visible to everyone.)
settings
∟unaccepted_countries
Array No By using the "ISO 3166-1" country codes in this field, the module is prevented from being displayed in the specified countries.
settings
∟ …your field name…
String,Int,Float,Boolean No You can place a custom field index under the "settings" index.

Example Source Code:

    return [
        'meta'     => [
            'name'    => 'Third Party Payment',
            'version' => '1.0',
        ],
        'settings' => [
            'your_field_1'  => 'example test',
            'your_field_2'  => 'example test 2',
            'commission_rate'  => 0,
            'force_convert_to' => 0,
            'accepted_countries'    => ['US','ZW'],
            'unaccepted_countries'  => ['DE','FR'],
        ],
    ];
Getting Started Settings/Configuration Page

Do you have any questions?

Feel free to contact us
Contact Us
Copyright © 2024. All Rights Reserved.
Join Our Discord Channel
Top