Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parsigate - Iranian Payment Gateways for WooCommerce

Parsigate is a free and open-source WooCommerce plugin that supports multiple Iranian payment gateways, including bank, installment, and intermediary gateways.

Requirements

Supported Gateways

Bank Gateways

  • Parsian
  • Pasargad
  • Saman (Sep)
  • Mellat (BehPardakht)
  • Melli (Sadad)
  • Asan Pardakht
  • Saderat (Sepehr)
  • Iran Kish

Installment Gateways

  • SnappPay
  • Tara
  • DigiPay
  • Azki Vam

Intermediary Gateways

  • Zibal
  • Zarinpal
  • PayPing
  • AghaPardakht
  • Shepa

Test Gateway

  • Test payment gateway for development and debugging

Developer Guide

How to use in your project

$gateway = new \ParsiGate\Gateway($driver = 'zarinpal');
$pay = $gateway->pay($params = []);
$verify = $gateway->verify($params = []);

Get List of drivers

$gateways = \ParsiGate\Gateways::list();

How to add custom gateway

// 1. Create Your Own Gateway Class for Process
class MyGateway extends \ParsiGate\Gateways\Base
{
    public function pay(array $args = []): array
    {
        return $this->success();
    }

    public function verify(array $args = []): array
    {
        return $this->success();
    }
}

// 2. Append to Gateway List with `parsigate_gateways_list` Hook
add_filter('parsigate_gateways_list', 'new_define_gateway_parsigate', 10, 1);
function new_define_gateway_parsigate($list)
{
    $list['my-gateway'] = [
        'title' => __('My Gateway Name', 'parsigate'),
        'class' => MyGateway::class,
        'website' => 'gateway-site.com',
        'logo' => 'https://gateway-site.com/logo.png',
        'type' => 'bank',
        'usage' => ['woocommerce'],
        'woocommerce' => [
            'sandbox' => false,
            'settings' => [
                'merchant_id' => [
                    'title' => __('Merchant ID', 'parsigate'),
                    'type' => 'text',
                    'default' => '',
                    'desc_tip' => false
                ]
            ],
            'pay' => function ($amount, $order, $option, $callback_url, $class) {
                return [
                    "merchant_id" => $option['merchant_id'],
                    "amount" => $amount,
                    "callback_url" => $callback_url,
                    "description" => sprintf(__('Order ID: %d', 'parsigate'), $order->get_order_number()),
                ];
            },
            'verify' => function ($amount, $order, $option, $class, $request) {
                $authority = ($request['get']['Authority'] ?? '');
                $status = ($request['get']['Status'] ?? '');
                return [
                    "merchant_id" => $option['merchant_id'],
                    "amount" => $amount,
                    'Authority' => $authority,
                    'Status' => $status
                ];
            }
        ]
    ];
    
    return $list;
}

Installation

  1. Install and activate the ParsiDate plugin.
  2. Upload and activate Parsigate via WordPress admin or FTP.
  3. Go to WooCommerce → Settings → Payments and configure your desired gateways.

License

GNU General Public License v2.0 or later.

Author

wordpress-parsi

About

Banking Gateways for WooCommerce and WordPress Persian

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages