Developer

Construct payment page

Follow

'2C2P SecurePay API' allows merchant to be integrated seamlessly to 2C2P Payment Gateway. Merchant could provide the best payment experience to the customer without requiring to go through complex and demanding requirement of PCIDSS and other compliances.

Construct payment form

Add 'data-encrypt' fields into form to capture card information securely.

<form id="2c2p-payment-form" action="./payment_3d.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/CVC2"><br/>
    <input type="submit" value="Submit">
</form>
Attribute Description
data-encrypt="cardnumber" To capture the credit card number encrypted
data-encrypt="month" To capture the credit card expire month encrypted
data-encrypt="year" To capture the credit card expire year encrypted
data-encrypt="cvv" To capture the credit card security code encrypted

 

Import Api and Submit Form

Import 2C2P Secure Pay API and submit form with credit card information securely.

<script type="text/javascript" src="https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/api/my2c2p.1.6.9.min.js"></script>
<script type="text/javascript">
    My2c2p.onSubmitForm("2c2p-payment-form", function(errCode,errDesc){
        if(errCode!=0){
            alert(errDesc+" ("+errCode+")");
        }
    });
</script> 
Error Code Description
0 Success
1 Card number is required
2 Card number is invalid
3 Expiry month is required
4 Expiry month must be two numbers
5 Expiry year is required
6 Expiry year must be four numbers
7 Card already expired(year)
8 Card already expired(month)
9 Expiry month is invalid
10 CVV2/CVC2 is invalid

 

Complete Code
Copy & Paste below code to 'demo_3d.html' file, and put this file in your Web Server.

<html>
<head>
	<title>2C2P PGW Secure Pay API DEMO (3DS)</title>
</head>

<body> 
<form id="2c2p-payment-form" action="./payment_3d.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/CVC2"><br/>
    <input type="submit" value="Submit">
</form>
 
<script type="text/javascript" src="https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/api/my2c2p.1.6.9.min.js"></script>
<script type="text/javascript">
    My2c2p.onSubmitForm("2c2p-payment-form", function(errCode,errDesc){
        if(errCode!=0){
            alert(errDesc+" ("+errCode+")");
        }
    });
</script> 
</body>
</html>
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.