Support

Home Forums Event Espresso Premium Custom Payment Gateway Requires Form to be Submitted From JS

Custom Payment Gateway Requires Form to be Submitted From JS

Posted: March 16, 2016 at 5:08 am

Viewing 1 reply thread


pollarit

March 16, 2016 at 5:08 am

Hi guys,

Im stuck for 2 days now and I can’t really find a solution. So, a payment gateway here in Thailand has the following sample code:

<form id="2c2p-payment-form" action="./payment_non3d.php" method="POST">
    <input type="text" data-encrypt="cardnumber" maxlength="16" placeholder="Credit Card Number"><br/>
    <input type="text" data-encrypt="month" maxlength="2" placeholder="MM"><br/>
    <input type="text" data-encrypt="year" maxlength="4" placeholder="YYYY"><br/>
    <input type="password" data-encrypt="cvv" maxlength="4" autocomplete="off" placeholder="CVV2" ><br/>
    <input type="submit" value="Submit">
</form>

<script type="text/javascript" src="https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/api/my2c2p.1.6.6.min.js"></script>
<script type="text/javascript">
    My2c2p.SubmitForm("2c2p-payment-form", function(errCode,errDesc){
        if(errCode!=0){ 
            alert(errDesc);
        }
    });
</script>

I managed to create the new payment gateway onsite by looking at other payment gateway code inside Event Espresso.

Problem 1: EE_CREDIT_CARD_MONTH_INPUT and EE_CREDIT_CARD_YEAR _INPUT don’t recognize html_other_attributes. I need it because the payment required data-encrpyt attribute as you can see in sample code. After trying so hard, I resorted to using EE_TEXT_INPUT instead. Is there a way I can still use select inputs for month and year but with data-encrypt attribute?

Problem 2: When form is submitted thru the above JS code, I am getting the error that the form was not actually submitted due to the PHP code in _billing_form_is_valid . What the JS above does is that it encrypts the credit card details and adds another field in the POST body called encryptedData. So, can someone help me what’s the right approach to make this work?


Lorenzo Orlando Caum

  • Support Staff

March 16, 2016 at 5:34 am

Hello,

I do know that card information is sanitized so we do not store it but unfortunately, I’m not sure what is the recommended way to handle that information securely.

Could you post this question over on our Github project so a developer can follow up with you directly?

https://github.com/eventespresso/event-espresso-core/issues/new


Lorenzo

Viewing 1 reply thread

The support post ‘Custom Payment Gateway Requires Form to be Submitted From JS’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso