These docs are for v3.2.6. Click to read the latest docs for v4.3.0.

Construct payment page

'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.

👍

Download Sample Code

PHP Code

📘

Environment

Please refer Demo & Live Endpoint.

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>
AttributeDescription
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.

🚧

Import Secure Pay JS library

Refer latest library for Demo & Live Environment

<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 CodeDescription
0Success
1Card number is required
2Card number is invalid
3Expiry month is required
4Expiry month must be two numbers
5Expiry year is required
6Expiry year must be four numbers
7Card already expired(year)
8Card already expired(month)
9Expiry month is invalid
10CVV2/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>

Next : Submit payment request (S2B) (Support 3DS and Non-3DS transactions)
Or : Submit payment request (S2S) (Only Non-3DS transaction)