1. Home
  2. Jobster
  3. Payment Gateways API
  4. Helpers

Helpers

Below you will find a few more functions which you may use in your gateway.

 

get_gateway_credentials()

This function is a helper that handles the credentials and some settings of the gateway. It makes the code cleaner, because in our example we needed those credentials in both taketogateway_function() and processgateway_function().

 

get_common_details( $gateway, $orderid, $currency )

This function returns the information about a particular order, or inserts a new one.

$gateway
(string) (Required) The gateway unique slug, like: $this->unique_slug

$orderid
(int) (Optional) The order ID that you want to retrieve. If it is 0, it inserts a new order.
Default value: 0

$currency
(string) (Optional) The currency in which to process the payment. By default, the current site currency.
Default value: ”

Return (array)

/* Array(
	[price] => 109                              // job price
	[post] => WP_Post Object                    // job object
	[uid] => 3                                  // buyer id
	[pid] => 3318                               // job id
	[selected] => USD                           // selected currency
	[job_title] => Title Example                // job title
	[wpjobster_final_payable_amount] => 134.72  // final price including all taxes
	[order_id] => 768                           // order id
	[current_user] => Object                    // current user object
	[currency] => USD                           // currency
) */

 

wpjobster_mark_job_prchase_completed( $orderid, $status, $response, $details )

This function updates the order with the info received from the payment gateway.

$orderid
(int) (Required) The order ID that you want to update.

$status
(string) (Optional) Can be either ‘completed’ or ‘failed’. Empty ‘’ is also ‘completed’.

$response
(string) (Optional) Usually the serialized $_POST data for debug purposes

$details
(string) (Optional) Any other info that you may find useful

Was this article helpful to you? Yes No