You are here

function hook_payment_pre_execute in Payment 7

Executes right before a payment is executed. This is the place to programmatically alter payments.

Parameters

Payment $payment:

Return value

NULL

See also

Payment::execute()

1 function implements hook_payment_pre_execute()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

payment_test_payment_pre_execute in tests/payment_test/payment_test.module
Implements hook_payment_pre_execute().
1 invocation of hook_payment_pre_execute()
Payment::execute in ./payment.classes.inc
Execute the actual payment.

File

./payment.api.php, line 134
Hook documentation.

Code

function hook_payment_pre_execute(Payment $payment) {

  // Add a payment method processing fee.
  $payment
    ->setLineItem(new PaymentLineItem(array(
    'name' => 'foo_fee',
    'amount' => 5.5,
    'description' => 'Credit card fee',
    'tax_rate' => 0.19,
  )));
}