Creating a custom payment method with conditional field
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
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?
civicontribute payment
add a comment |Â
up vote
3
down vote
favorite
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?
civicontribute payment
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
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?
civicontribute payment
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?
civicontribute payment
civicontribute payment
edited 1 hour ago
asked 1 hour ago
themak
830116
830116
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
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
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
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
add a comment |Â
up vote
3
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
add a comment |Â
up vote
3
down vote
accepted
up vote
3
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
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
answered 56 mins ago
Pradeep Nayak
9,0321418
9,0321418
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcivicrm.stackexchange.com%2fquestions%2f26874%2fcreating-a-custom-payment-method-with-conditional-field%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password