So I understand that you can assign a payment processor any payment method - however - I am trying to create payment methods that replicate the behavior of Credit Card and Check. For example - when manually adding Check or Credit Card contributions - you will then get a field for check number or last 4 digits of the card respectively.

If I make a payment method called credit card - other, I would want those credit card fields to also populate.

Is this hard coded?

up vote 4 down vote accepted

Themak, Nice question. This are hardcoded in core file but you can create your own field for each payment method using buildform hook. Here is the snippet on how to do that

function custom_civicrm_buildForm($formName, &$form) {
  if ($formName == 'CRM_Financial_Form_Payment' && !empty($form->paymentInstrumentID)) {
    if ($form->paymentInstrumentID == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'payment_instrument_id', 'Test')) {
      $form->assign('paymentFields', array('source'));
      $form->add('text', 'source', ts('Source'));
    }
  }
}

Note: The above snippet is not fully tested i have just created blindly, but i am 100% sure it should work

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.