• Resolved eltiss

    (@eltiss)


    Hello,

    two gateways are already available in the extension that are “cash” and “credit card”, I would like to add a custom gateway of the kind “ticket restaurant” or “check” that does not require adjustment as a payment method online like stripes or other, how can i do ?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ollybach

    (@ollybach)

    you could add the following to your theme’s functions.php (or alternatively into a dedicated plugin – up to you)
    replacing all instances of _mygateway and _MYGATEWAY with whatever you want to call it (i.e perhaps CHECK or something)

    
    function wppizza_register_wppizza_gateway_mygateway( $gateways ) {	
    	$gateways[] = 'WPPIZZA_GATEWAY_MYGATEWAY'; /* gateway class name */
    	return $gateways;
    }
    add_filter( 'wppizza_register_gateways', 'wppizza_register_wppizza_gateway_mygateway' );
    
    	
    /**must start with WPPIZZA_GATEWAY_**/
    class WPPIZZA_GATEWAY_MYGATEWAY{
    
    	/*****************************
    		[required]
    	*****************************/
    	/*
    		@type : string( must NOT be empty)
    		@param : gateway version number
    	*/
    	public $gatewayVersion = WPPIZZA_VERSION;
    
    	/*
    		@type : string (must NOT be empty)
    		@param : string
    		gateway name
    	*/
    	public $gatewayName = 'My Gateway Name';
    
    	/*
    		@type : array
    		@param : options of gateway
    	*/
    	public $gatewayOptions = array();	
    
    	/*
    		@type : string (can be empty)
    		@param : string
    		additional description of gateway displayed in ADMIN area
    	*/
    	public $gatewayDescription = '';
    
    	/*
    		@type : string (can be empty)
    		@param : string
    		default printed under gateway options FRONTEND
    		can be changed/localized/emptied in admin
    	*/
    	public $gatewayAdditionalInfo = '';
    
    	/*
    		@type : bool
    		@param : bool
    		enable discounts on usage (rather than surcharges)
    	*/
    	public $gatewayDiscount = true;
    
    	/*
    		@type : bool
    		@param : bool
    		automatically enable on install
    	*/
    	public $gatewayAutoEnable = true;
    
    	
    	/******************************
    		[optional]
    		but recommended
    	******************************/
    	/*
    		@type : string
    		@param : 'prepay' or 'cod'.
    		omit or set distinctly to "prepay" (i.e for cc's and other payment processors)
    		set to 'cod' to simply have another payment option that works like the wppizza inbuilt cod payment
    	*/
    	public $gatewayType = 'cod';
    
    /******************************************************************************************************************
    *
    *
    *	[construct]
    *
    *
    ******************************************************************************************************************/
    	function __construct() {
    		/************************
    			[get gateway options]
    		************************/
    		$this -> gatewayOptions = get_option(__CLASS__, 0);
    	}
    }
    
    Plugin Author ollybach

    (@ollybach)

    marked as resolved due to inactivity

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add a custom gateway’ is closed to new replies.