Below is a copy of the PHP Class we will need in order to add a payment processor. Once this file has been adjusted please submit them to our Support Team or your Gazoop Contact.

📘

Need additional help or clarification?

You can find out more detailed information about how to customise this file on our Getting Started pages here: https://docs.gazoop.com/docs/creditcard-processor-gettingstarted

<?php
/**
 * @name Payment Processor Class File - OFFLINE METHOD
 * @author James Parmee Morris
 * @version 2.0.2
 *
 */
class CreditCardModule {
	
	public $status = 'Pending';
	public $reference = '';
	private $configuration = array();
	private $cardDetails = array();
	private $personalDetails = array();
	public $transactionNotes = '';
	
	public function __construct($configuration){
		// Use this area to do any preperation functions before processing a charge or generating a token. This function also supplies all variables stored from the clients account.
	    // If you have authentication logins, please use $this->configuration['varName'] - we will ensure the client enters any variables specified in this section.
		
		$this->configuration = $configuration;
	}
	
	public function applyCardDetails($card_number, $card_type, $expiry, $cvv, $valid_from='', $issue='', $token=''){
		
		// NB: Valid From and Issue Number are very rarely used and should be optional.
		
		$this->cardDetails = array(
		'card_number'	=>	$card_number,
		'card_type'		=>	$card_type,
		'expiry'		=>	$expiry,
		'cvv'			=>	$cvv,
		'valid_from'	=>	$valid_from,
		'issue'			=>	$issue,
		'token'         =>  $token,
		);
		
	}
	
	public function applyPersonalDetails($first_name, $last_name, $address1, $address2, $city, $state, $country, $postcode){
		
		// NB: Postcode is the same as ZIP code, State is the same as County.
		
		$this->personalDetails = array(
		'first_name'	=>	$first_name,
		'last_name'		=>	$last_name,
		'address1'		=>	$address1,
		'address2'		=>	$address2,
		'city'			=>	$city,
		'state'			=>	$state,
		'country'		=>	$country,
		'postcode'		=>	$postcode,
		'email'			=>	$email);
		
	}
	
	/*
	 * Please uncomment this function if you require card details to be tokenized. If this method exists, the system will call this when storing new card details before calling chargeCard. No card information will be stored by Gazoop if this method exists.
	 * 
	public function getToken(){
	    
	    // NB: This should be used to store card information in exchange for a token which we save and can be obtained when chargeCard is called by using $this->cardDetails[token]
	
	    $this->cardDetails['token']=$token;
	    return $token;
	}*/
	
	public function chargeCard($amount,$currency){
		
		// NB: Generally this should be where API attempts are made to process the transaction. The response should be "Authorized" or "NotAuthorized".
		
		$this->transactionNotes = "Payment against invoice.";
		$this->reference = "ABC1234";
		$this->status='Authorized';
		
	}
	
}

?>