English (United Kingdom)
Knowledge Base  >  Vik Restaurants  >  Hooks  >  Payment  >  Init Transaction

apply_filters_ref_array( 'vikrestaurants_init_payment_transaction', bool $status, array &$transaction, mixed &$params )

Fires while instantiating the payment gateway for the validation of the transaction.


Description

Use this hook to manipulate the transaction details and the configuration of the payment.

This hook DOES NOT trigger in case the payment assigned to the order doesn't exist anymore.


Parameters

$status

(bool)  True on success, false otherwise.

&$transaction

(array)  An associative array containing the transaction details.

&$params

(string|array)  Either an array or a JSON string holding the configuration of the payment.


Example

/**
 * This hook is triggered before creating the payment instance.
 *
 * @param  boolean  $status        True on success, false otherwise.
 * @param  array    &$transaction  The array holding the transaction details.
 * @param  mixed    &$params       Either a JSON string or a configuration array.
 */
add_filter('vikrestaurants_init_payment_transaction', function($status, &$transaction, &$params)
{
    /**
     * @todo do stuff here
     */

    return $status;
}, 10, 3);

Changelog

Version Description
1.0 Introduced.
Last Update: 2021-01-24
Helpful?