Automation Gateway

An Automation Gateway in our system is designed to handle payments that rely on external data synchronization (like MFS SMS). These gateways provide users with step-by-step instructions and verify transactions based on specific sender keys.

Directory Structure

Every gateway must follow a strict naming convention and folder structure.

pp-gateways/
└── bkash-personal/
    ├── class.php
    └── assets/
        └── logo.jpg

The Class Blueprint

The class name must be the PascalCase version of the folder name + the word Gateway.

Required Methods

Method

Description

info()

Defines gateway metadata (Type, Sender Key, etc.)

color()

Defines the UI theme (Buttons, Backgrounds)

fields()

Configurable inputs shown in the Admin Panel

supported_languages()

Returns an array of available languages

lang_text()

The actual translation strings for instructions

instructions($data)

The logic for the step-by-step UI shown to users


Implementation Guide

A. The info() Method

This is the most critical part for Automation.

public function info() {
    return [
        'title'        => 'Bkash Personal',
        'logo'         => 'assets/logo.jpg',
        'currency'     => 'BDT',
        'tab'          => 'mfs', // Category in UI
        'gateway_type' => 'automation', // MUST be automation
        'sender_key'   => 'bkash', // The SMS/Provider identifier
        'sender_type'  => 'Personal', // Personal, Agent, or Merchant
    ];
}

Admin Config Fields

The fields() method allows you to create settings that the Admin fills out (like Wallet Numbers or QR Codes).

C. The instructions($data) Method

This generates the user-facing payment page. It receives a $data array containing $data['options'] (Admin settings) and $data['transaction'] (Amount, Currency).

Step Logic:


4. Full Code Example

<?php
    class BkashPersonalGateway
    {
        public function info()
        {
            return [
                'title'       => 'Bkash Personal',
                'logo'        => 'assets/logo.jpg',
                'currency'        => 'BDT',
                'tab'        => 'mfs',

                'gateway_type'        => 'automation',
                'sender_key'        => 'bkash',
                'sender_type'        => 'Personal',
            ];
        }

        public function color()
        {
            return [
                'primary_color'        => '#D12053',
                'text_color'        => '#FFFFFF',
                'btn_color'        => '#D12053',
                'btn_text_color'        => '#FFFFFF',
            ];
        }

        public function fields()
        {
            return [
                [
                    'name'  => 'qr_code',
                    'label' => 'Qr Code',
                    'type'  => 'image',
                ]
            ];
        }

        public function supported_languages()
        {
            return [
                'en' => 'English',
                'bn' => 'বাংলা',
            ];
        }

        public function lang_text()
        {
            return [
                '1' => [
                    'en' => 'Go to your bKash Mobile App.',
                    'bn' => 'আপনার বিকাশ মোবাইল অ্যাপে যান।',
                ],

                '2' => [
                    'en' => 'Choose "Send Money"',
                    'bn' => '“Send Money” নির্বাচন করুন',
                ],

                '3' => [
                    'en' => 'Enter the Number: {mobile_number}',
                    'bn' => 'নম্বর লিখুন: {mobile_number}',
                ],

                '4' => [
                    'en' => 'Or Scan the QR Code',
                    'bn' => 'অথবা কিউআর কোড স্ক্যান করুন',
                ],

                '5' => [
                    'en' => 'Enter the Amount: {amount} {currency}',
                    'bn' => 'পরিমাণ লিখুন: {amount} {currency}',
                ],

                '6' => [
                    'en' => 'Now enter your bKash PIN to confirm.',
                    'bn' => 'এখন নিশ্চিত করতে আপনার বিকাশ পিন লিখুন।',
                ],

                '7' => [
                    'en' => 'Put the Transaction ID in the box below and press Verify',
                    'bn' => 'ট্রানজ্যাকশন আইডি নিচের বক্সে লিখুন এবং যাচাই করুন চাপুন।',
                ],
            ];
        }

        public function instructions($data)
        {
            return [
                [
                    'icon' => '',
                    'text' => '1',
                    'copy' => false,
                ],
                [
                    'icon' => '',
                    'text' => '2',
                    'copy' => false
                ],
                [
                    'icon' => '',
                    'text' => '3',
                    'copy' => true,
                    'value' => $data['options']['mobile_number'] ?? '',
                    'vars' => [
                        '{mobile_number}' => $data['options']['mobile_number'] ?? ''
                    ]
                ],
                [
                    'icon' => '',
                    'text' => '4',
                    'action' => [
                        'type'  => 'image',
                        'label' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-qrcode"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4" /><path d="M7 17l0 .01" /><path d="M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4" /><path d="M7 7l0 .01" /><path d="M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4" /><path d="M17 7l0 .01" /><path d="M14 14l3 0" /><path d="M20 14l0 .01" /><path d="M14 14l0 3" /><path d="M14 20l3 0" /><path d="M17 17l3 0" /><path d="M20 17l0 3" /></svg>',
                        'value' => $data['options']['qr_code'] ?? '',
                    ]
                ],
                [
                    'icon' => '',
                    'text' => '5',
                    'copy' => true,
                    'value' => $data['transaction']['local_net_amount'],
                    'vars' => [
                        '{amount}' => $data['transaction']['local_net_amount'],
                        '{currency}' => $data['transaction']['local_currency']
                    ]
                ],
                [
                    'icon' => '',
                    'text' => '6',
                    'copy' => false
                ],
                [
                    'icon' => '',
                    'text' => '7',
                    'copy' => false
                ],


            ];
        }
    }

5. Allowed Sender Keys

Name

Currency

Value

bKash

BDT

bkash

Nagad

BDT

nagad

Rocket

BDT

rocket

Upay

BDT

upay

Tap

USD

tap

Cellfin

BDT

cellfin

Ok Wallet

BDT

okwallet

mCash

BDT

mcash

Pathao Pay

BDT

pathaopay

TeleCash

BDT

telecash

Ipay

BDT

ipay