Cloning a Payment Module

Building a new payment module based on an existing one

Note: These instructions are for Zen Cart 1.5.8 and above. For Zen Cart 1.5.7 and below, please see Cloning a Payment Module in 1.5.7 and below.

You can create new Payment Module by making a clone of the closest matching Payment Module to what you are trying to do.

As an example, we will consider the moneyorder payment module.

Payment Modules have 2 parts:

The code file is located in:
/includes/modules/payment/moneyorder.php

The language file is located in:
/includes/languages/english/modules/payment/lang.moneyorder.php

To clone this module, for example, to venmo.php you would:

  • copy moneyorder.php to venmo.php
  • copy lang.moneyorder.php to lang.venmo.php

Note: Be sure the filename you choose does not have an underscore (_) in it.

Next, you need to change all occurrences of the strings moneyorder and MONEYORDER as follows:

OLD NEW
moneyorder venmo
MONEYORDER VENMO

These identifiers are case sensitive.

These words are written separately or within the constants such as:

class moneyorder {
... 
$this->code = 'moneyorder';
... 
$this->title = MODULE_PAYMENT_MONEYORDER_TEXT_TITLE; 

becomes

class venmo {
...
$this->code = 'venmo';
...
$this->title = MODULE_PAYMENT_VENMO_TEXT_TITLE;

Be sure to make this change in the remove() function as well.

These plugins might also help:




Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified May 10, 2024 by Scott Wilson (a96bcb81).