First, we need to add a checkout button, we can add it before or after JobEngine or ClassiFiedEngine default checkout buttons.

Example, I add Stripe checkout button:

JobEngine: add_action ('after_je_payment_button', 'stripe_payment_button');
ClassifiedEngine: add_action ('after_ce_payment_button', 'stripe_payment_button');
function stripe_payment_button ($payment_gateways) {
	if(!isset($payment_gateways['stripe']))  return;
	$stripe	=	$payment_gateways['stripe'];
	if( !isset($stripe['active']) || $stripe['active'] == -1) return ;
?>	<li class="clearfix">
	<div class="f-left">
		<div class="title"><?php _e( 'Stripe', ET_DOMAIN )?></div>
		<div class="desc">
<?php _e( 'Pay using your credit card through Stripe.', ET_DOMAIN )?></div>
		</div>
		<div class="btn-select f-right">
		<button id="stripe_pay" class="bg-btn-hyperlink border-radius" data-gateway="stripe" >
<?php _e('Select', ET_DOMAIN );?>
</button>
	</div>
	</li>
	<?php
	}

Note: $payment_gateways is array of enabled gateways.

payment

When user checkouts for a job, JobEngine has 2 steps to process payment.
First step, send payment details, set up the payment and send a response to client. After client receive reponse, use javascript to submit user to payment processor. To filter the response we can use filter ‘ je_payment_setup’:

JobEngine: add_filter ('je_payment_setup', 'setup_payment');
ClassifiedEngine: add_filter (‘et_payment_setup', 'setup_payment');

function setup_payment ( $response , $paymentType, $order ) { 
	// your payment setup and return reponse here
}
$response : payment response for setup a payment
$paymentType: payment gateway type, use to check which payment gateway is used
$order : order information 

Second step, when users submit a payment, and already pay for a job. They will be returned to page process payment to approve payment or deny fraud. In function process payment return has a filter-‘je_payment_process’ to help developer process integrated gateway.

Here is the function filter and process payment by stripe:

JobEngine: add_filter( 'je_payment_process', 'process_payment', 10 ,2 );
ClassifiedEngine: add_filter( 'et_payment_process', 'process_payment', 10 ,2 );
function process_payment ( $payment_return, $order) {
	if(isset($_REQUEST['paymentType']) && $_REQUEST['paymentType'] == 'stripe' ) {
		if($_REQUEST['token'] == $order->get_payment_code() ) {
			$payment_return	=	array (
				'ACK' 		=> true,
				'payment'	=>	'stripe'
			);
			$order->set_status ('publish');
			$order->update_order();
			}
		}
		return $payment_return;
	}

Tip: you can use ‘je_payment_settings’ and ‘et_update_payment_setting’ hooks render and save payment gateway settings.

4 Comments
  • Alexandre
    Jan  25TH,  2015

    Ok! There is a tutorial of how to integrate, but what are the paths of the files for the modification?

    • nhunq
      Jan  26TH,  2015

      Hi,

      Thanks for your feedback. All of filters can be applied for functions.php of child theme.

      Also, if you have any further question about our product, please contact us via Forums. It is convenient to support you more.

  • Patrick Nel
    May  20TH,  2017

    Could I implement this method to Microjobengine?

    • Thao Le
      May  23RD,  2017

      Hi Patrick,

      Regarding your question, could you provide us your email address, we’ll send you the tutorial, guiding you to integrate additional payment gateway into your MicrojbobEngine theme.

      Look forward to your reply.

      Kind regards,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.