1. Home
  2. Jobster
  3. Payment Gateways API v2
  4. Checkout


taketogateway_function( $payment_type, $common_details )

This function is hooked to the wpjobster_taketo_sample_gateway action, which is called when your gateway is used as payment method on the purchase page.

Usually here you create a form with all the info that you have about the merchant, order and user.
In our example the form is hidden and automatically submitted. It also has a spinning loader as a placeholder until the user is redirected to the gateway with all the necessary info.

(string) Is provided by the theme or from the plugin requesting the payment. For the gateway you just need to use it in two places, in the actions for success and failed payment.

(array) Contains all the info needed for sending the payment info to the gateway endpoint.


/* Array(
	[order_id]                                 => 999             // order id from the wpjobster database
	[pid]                                      => 123             // product id
	[post]                                     => WP_Post Object  // post id for job_purchase payment type
	[job_title]                                => 'Job Title'     // product title
	[title]                                    => 'Job Title'     // product title
	[uid]                                      => 1               // buyer id
	[current_user]                             => WP_User Object  // buyer object
	[currency]                                 => 'USD'           // default currency
	[selected]                                 => 'EUR'           // selected currency
	[price]                                    => 1000            // basic product price in default currency
	[wpjobster_job_price]                      => 1000            // basic product price in default currency
	[wpjobster_job_buyer_processing_fees]      => 10              // payment processing fee amount in default currency
	[wpjobster_job_tax]                        => 10              // payment tax amount in default currency
	[wpjobster_final_payable_amount_original]  => 1020            // final price including all taxes in default currency
	[wpjobster_final_payable_amount]           => 950             // final price including all taxes in selected currency
) */

get_gateway_currency( $currency )

This function is filtering the currency for processing the payment.
If your gateway only accepts a certain currency this is the place where you can define it.

Feel free to play around with the conditions. For example, if your gateway accepts a limited range of currencies you can check if the selected currency is in the range, otherwise return a specific currency.


function get_gateway_currency( $currency ) {
	// if the gateway requires a specific currency you can declare it there
	// currency conversions are done automatically
	$currency = 'USD'; // delete this line if the gateway works with any currency
	return $currency;