• Michelle N.

    (@michellenephew)


    There are a LOT of requests for a cash or check payment option that just passes through a PAYMENT_STATUS_PENDING result. I really need one, too, so I thought I’d take a stab at compiling it from the hints I’ve found in the documentation and from payment-paypal.php.

    (Note that there’s some talk of a “blackhole” method somewhere that does this, but I’ve only found dead links to it.)

    PLEASE PLEASE PLEASE someone take a look at my code and let me know what needs to be changed to make this work. Right now it’s not even appearing in the WP>Tickets>Setup>Payment panel.

    <?php
    
    /**
     * Cash or check payment method for Camptix
     *
     * INSTALLATION INSTRUCTIONS:
     * Install and set up CampTix.
     * Copy this file into wp-content/plugins/camptix/addons
     * Activate the payment method in WP>Tickets>Setup>Payment panel.
     * Edit your e-mail templates in WP>Tickets>Setup>E-mail Templates so the text fits your new payment type.
     */
     
    class CampTix_Payment_Method_Check extends CampTix_Payment_Method {
    	/**
    	 * The following variables are required for every payment method.
    	 */
    	public $id = 'check';
    	public $name = 'Cash or Check';
    	public $description = 'Pay by cash or check';
    
    	public $supported_currencies = array( 'USD' );
    	
        public function payment_checkout( $payment_token ) {
            // Will go to checkout here
        }
    }	
    
    	/**
    	 * Process a checkout request
    	 *
    	 * This method is called when the user initiates
    	 * a checkout process with the selected payment method. 
    	 *
    	 * @param string $payment_token
    	 *
    	 * @return int One of the CampTix_Plugin::PAYMENT_STATUS_{status} constants
    	 */
    	function payment_checkout( $payment_token ) {
    		/** @var CampTix_Plugin $camptix */
    		global $camptix;
    
        $payment_data = array(
            'transaction_id' => rand( 1, 9999 ),
            'transaction_details' => array(
                'buyer_email' => '[email protected]',
            ),
        );
    
        return $this->payment_result( $payment_token, $camptix::PAYMENT_STATUS_PENDING, $payment_data );
    	}
    
    /**
     * The last stage is to register your payment method with CampTix.
     * Since the CampTix_Payment_Method class extends from CampTix_Addon,
     * we use the camptix_register_addon function to register it.
     */
    camptix_register_addon( 'CampTix_Payment_Method_Check' );
    
  • The topic ‘Help Me Fix This Check/Cash Payment Method, Please’ is closed to new replies.