1. Home
  2. Jobster
  3. Payment Gateways API
  4. processgateway_function()

processgateway_function()

This function is hooked to the wpjobster_processafter_sample_gateway action, which is called when your gateway responds to the site with the payment status.

Here, using the order ID that you have previously sent to the gateway, you get the order details and do the required verifications before marking the payment as completed or failed.

First of all you need to check if the answer from the gateway is successful. We also recommend checking if the amount paid is correct.

Below is a small example of a success case.

if ( $status == 'success' ) {

	// do your verifications below
	// we recommend checking at least if the amount is the same

	$payment_status = 'completed';
	$payment_response = maybe_serialize( $_POST ); // for later debug
	$payment_details = '';

	wpjobster_mark_job_prchase_completed( 
		$order_id, 
		$payment_status, 
		$payment_response, 
		$payment_details 
	);

	if ( get_option( 'wpjobster_sample_success_page' ) != '' ) {
		wp_redirect( 
			get_permalink( get_option( 'wpjobster_sample_success_page' ) ) );
	} else {
		wp_redirect( 
			get_bloginfo( 'siteurl' ) . '/?jb_action=chat_box&oid=' . $order_id );
	}
	exit;
}