function commerce_no_payment_transaction in Commerce No Payment 7
Creates a payment transaction
Parameters
$payment_method: The payment method instance object used to charge this payment.
$order: The order object the payment applies to.
$charge: An array indicating the amount and currency code to charge.
1 call to commerce_no_payment_transaction()
- commerce_no_payment_submit_form_submit in ./
commerce_no_payment.module - Payment method callback: submit form submission.
File
- ./
commerce_no_payment.module, line 59 - Provides a payment method for Drupal Commerce for orders that do not require a payment (free stuff).
Code
function commerce_no_payment_transaction($payment_method, $order, $charge) {
$transaction = commerce_payment_transaction_new('commerce_no_payment', $order->order_id);
$transaction->instance_id = $payment_method['instance_id'];
$transaction->amount = $charge['amount'];
$transaction->currency_code = $charge['currency_code'];
$transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
commerce_payment_transaction_save($transaction);
}