function commerce_payment_example_submit_form_submit in Commerce Core 7
Payment method callback: submit form submission.
File
- modules/
payment/ modules/ commerce_payment_example.module, line 60 - Provides an example payment method for Drupal Commerce for testing and development.
Code
function commerce_payment_example_submit_form_submit($payment_method, $pane_form, $pane_values, $order, $charge) {
// Just as an example, we might store information in the order object from the
// payment parameters, though we would never save a full credit card number,
// even in examples!
$number = $pane_values['credit_card']['number'];
$pane_values['credit_card']['number'] = substr($number, 0, 4) . str_repeat('-', strlen($number) - 8) . substr($number, -4);
$order->data['commerce_payment_example'] = $pane_values;
// Every attempted transaction should result in a new transaction entity being
// created for the order to log either the success or the failure.
commerce_payment_example_transaction($payment_method, $order, $charge);
}