idokd / wp-simple-payment

Simple Payment - Wordpress Plugin to support Payment processing easy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Payment Wordpress Plugin

Theme Payment Gateway Example

Create your implementation of your Payment Gateways

save it on your active theme directory;

example: theme-simple-payment.php

<?php

namespace SimplePayment\Engines;

if (!defined("ABSPATH")) {
  exit; // Exit if accessed directly
}

class Custom extends Engine {

    public $name = 'ThemeEngine';

    public function process($params) {
      parent::process($params);
      // Process the transaction, for example
      // - Call payment gateway API
      // - Redirect to the payment gateway url with params

      // Throw Exception or return false if transaction Failed
      return(true);
    }

    public function post_process($params) {
      parent::post_process($params);
      // Process the result of the transactions save

      return(true);
    }

    public function pre_process($params) {
      parent::pre_process($params);
      // Process any parameters necessary before
      // calling process

      // If your payment providers doesn't create a unique payment id use:
      //$this->transaction = $this->uuid();

      // Throw Exception or return false if Failed
      return($params); // Return array with values to be logged and processed
    }

}

Make sure to include the file in your theme functions.php

require_once('theme-simple-payment.php');

About

Simple Payment - Wordpress Plugin to support Payment processing easy

License:GNU General Public License v2.0


Languages

Language:PHP 87.3%Language:API Blueprint 4.2%Language:JavaScript 2.8%Language:HTML 2.5%Language:CSS 2.2%Language:Shell 0.6%Language:Hack 0.2%Language:Smarty 0.2%Language:SCSS 0.1%Language:Python 0.0%