Sample.xml File | EasyStore - Documentation | JoomShaper

EasyStore

Updated Last: 24 April 2024

Sample.xml File

The XML file for the Sample Plugin provides essential information and configuration for integrating your payment gateway into the EasyStore component.

This document outlines the structure, elements, and purpose of the XML file.

Rename the XML File

Before you start rename the sample.xml file with the name of your payment gateway.

Extension Name and Author Information

<name>PLG_EASYSTORE_SAMPLE</name>
<author>JoomShaper</author>

Replace With: Replace Sample with the name of your payment plugin (use all caps) and the author with the actual author.

<description>PLG_EASYSTORE_SAMPLE_XML_DESCRIPTION</description>

Replace With: Replace Sample with the name of your payment plugin (use all caps).

<namespace path="src">JoomShaper\Plugin\EasyStore\Sample</namespace>

Replace With: Define the PHP namespace path for the plugin's source code. Replace Sample with the name of your payment plugin.

Rename the XML File

<media folder="media">
 <folder>plg_easystore_sample/js</folder>
 <filename>plg_easystore_sample/joomla.asset.json</filename>
</media>

Description: Specifies media files associated with the plugin, including JavaScript files and Joomla asset JSON.

Replace With: Replace Sample with the name of your payment plugin.

Source Code Files

<files>
 <folder plugin="sample">services</folder>
 <folder>assets</folder>
 <folder>src</folder>
</files>

Description: Lists the source code folders for the plugin, including services, assets, and the main source folder.

Replace With: Replace sample in services with the name of your payment plugin.

Language Files

<languages folder="admin">
 <language tag="en-GB">plg_easystore_[your_gateway_name].ini</language>
 <language tag="en-GB">plg_easystore_[your_gateway_name].sys.ini</language>
</languages>

Description: Specifies language files for the admin interface in English.

Configuration Fields

<config>
 <fields name="params">
 <fieldset name="basic">
 <!-- Fields for configuration settings -->
 </fieldset>
 </fields>
</config>

Description: Defines the configuration settings fields for the plugin, including fields for title, payment environment, secret keys, and payment instructions.

Title

<field
 name="title"
 type="text"
 label="PLG_EASYSTORE_SAMPLE_TITLE"
 default="Sample"
/>

Description: It is the field for the plugin title.

Replace With: Replace "sample" in label and default with the name of your payment plugin.

Payment Environment

<field
   name="payment_environment"
   type="radio"
   class="btn-group btn-group-yesno"
   label="PLG_EASYSTORE_SAMPLE_PAYMENT_ENVIRONMENT"
   description="PLG_EASYSTORE_SAMPLE_PAYMENT_ENVIRONMENT_DESC"
   default="test"
>
   <option value="live">PLG_EASYSTORE_SAMPLE_PAYMENT_ENVIRONMENT_LIVE</option>
   <option value="test">PLG_EASYSTORE_SAMPLE_PAYMENT_ENVIRONMENT_TEST</option>
</field>

This field allows administrators to choose the payment environment (live or test).

  • Label: Displays the label for the field. Here, replace SAMPLE with the name of your payment plugin (all caps).
  • Description: Provides additional information about the field. Here, replace SAMPLE with the name of your payment plugin (all
    caps).
  • Default: Sets the default value to "test."

Note: Keep this field if your payment gateway supports any payment environment. Otherwise, you can remove this field.

Test Secret Key

<field
    name="test_key"
    type="text"
    label="PLG_EASYSTORE_SAMPLE_TEST_SECRET_KEY"
    description="PLG_EASYSTORE_SAMPLE_TEST_KEY_DESCRIPTION"
    showon="payment_environment:test"
/>

This field allows administrators to enter the test secret key for the Payment Gateway.

  • Label: Displays the label for the field. Here, replace SAMPLE with the name of your payment plugin (all caps).
  • Description: Provides additional information about the field. Here, replace SAMPLE with the name of your payment plugin (all
    caps).
  • Showon: Specifies that this field is shown only when the payment environment is set to "test."

Note: Keep this field if your payment gateway supports any payment environment. Otherwise, you can remove this field.

3. Live Secret Key

<field
    name="live_key"
    type="text"
    label="PLG_EASYSTORE_SAMPLE_LIVE_KEY"
    description="PLG_EASYSTORE_SAMPLE_LIVE_SECRET_KEY_DESCRIPTION"
    showon="payment_environment:live"
/>

This field allows administrators to enter the live secret key for the Payment Gateway.

  • Label: Displays the label for the field. Here, replace SAMPLE with the name of your payment plugin (all caps).
  • Description: Provides additional information about the field. Here, replace SAMPLE with the name of your payment plugin (all
    caps).
  • Showon: Specifies that this field is shown only when the payment environment is set to "live."

Note: Keep this field if your payment gateway supports any payment environment. Otherwise, you can remove this field.

These are some of the example fields. You can add any required field this way to implement your preferred payment gateway.

After configuring the sample.xml file, the next step is to set up the SamplePayment.php file. This file contains the implementation of your custom payment gateway logic.