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

Installment Payment Plan options inquiry

❗️

Important Notice

New version of Payment Action API has been released.
We are recommending our merchants to refer new guide Payment Maintenance to implement Payment Action API.

Allows merchant to pull available IPP options for specific Merchant ID.

📘

Environment

Please refer Demo & Live Endpoint.

 

Prepare IPP Options Inquiry Request

👍

Download Sample Code

PHP Code

🚧

Prerequisite

Required necessary certificate key for the Payment Action Request and Response. Please refer Certificate Generation Guide.

Set account credentials

//Merchant's account information
	$merchantID = "JT01";		//Get MerchantID when opening account with 2C2P
	$secretKey = "7jYcp4FxFdf0";	//Get SecretKey from 2C2P PGW Dashboard

Set Inquiry Parameter

//Request Information  
	$version = "2.3";

Set payment action request information

//Construct signature string
	$stringToHash = $version . $merchantID;
	$hash = strtoupper(hash_hmac('sha256', $stringToHash ,$secretKey, false));	//Compute hash value

Construct payment action request message

//Construct request message
	$xml = "<IppOptionRequest>
			<version>$version</version> 
			<merchantID>$merchantID</merchantID>
			<hashValue>$hash</hashValue>
			</IppOptionRequest>";  

	include_once('pkcs7.php');
	
	$pkcs7 = new pkcs7();
	$payload = $pkcs7->encrypt($xml,"./keys/demo2.crt"); //Encrypt payload

Submit payment action request message

include_once('HTTP.php');
	
	//Send request to 2C2P PGW and get back response
	$http = new HTTP();
 	$response = $http->post("https://demo2.2c2p.com/2C2PFrontend/PaymentActionV2/PaymentAction.aspx","paymentRequest=".$payload);

Read payment response and Validate Hash

//Decrypt response message and display  
	$response = $pkcs7->decrypt($response,"./keys/demo2.crt","./keys/demo2.pem","2c2p");   
	echo "Response:<br/><textarea style='width:100%;height:80px'>". $response."</textarea>"; 
 
	//Validate response Hash
	$resXml=simplexml_load_string($response); 
	$res_version = $resXml->version;
	$res_timeStamp = $resXml->timeStamp;
	$res_respCode = $resXml->respCode; 
	
	
	//Compute response hash
	$res_stringToHash = $res_version . $res_respCode;
	
	$res_responseHash = strtoupper(hash_hmac('sha256',$res_stringToHash,$secretKey, false));	//Compute hash value
	echo "<br/>hash: ".$res_responseHash."<br/>"; 
	if(strtolower($resXml->hashValue) == strtolower($res_responseHash)){ echo "valid response"; } 
	else{ echo "invalid response"; }
	
?>

Complete Code

<?php

	//Merchant's account information
	$merchantID = "JT01";		//Get MerchantID when opening account with 2C2P
	$secretKey = "7jYcp4FxFdf0";	//Get SecretKey from 2C2P PGW Dashboard

	//Request Information  
	$version = "2.3";  
	
	//Construct signature string
	$stringToHash = $version . $merchantID;
	$hash = strtoupper(hash_hmac('sha256', $stringToHash ,$secretKey, false));	//Compute hash value

	//Construct request message
	$xml = "<IppOptionRequest>
			<version>$version</version> 
			<merchantID>$merchantID</merchantID>
			<hashValue>$hash</hashValue>
			</IppOptionRequest>";  

	include_once('pkcs7.php');
	
	$pkcs7 = new pkcs7();
	$payload = $pkcs7->encrypt($xml,"./keys/demo2.crt"); //Encrypt payload
	
 	 
	include_once('HTTP.php');
	
	//Send request to 2C2P PGW and get back response
	$http = new HTTP();
 	$response = $http->post("https://demo2.2c2p.com/2C2PFrontend/PaymentActionV2/PaymentAction.aspx","paymentRequest=".$payload);
	 
	//Decrypt response message and display  
	$response = $pkcs7->decrypt($response,"./keys/demo2.crt","./keys/demo2.pem","2c2p");   
	echo "Response:<br/><textarea style='width:100%;height:80px'>". $response."</textarea>"; 
 
	//Validate response Hash
	$resXml=simplexml_load_string($response); 
	$res_version = $resXml->version;
	$res_timeStamp = $resXml->timeStamp;
	$res_respCode = $resXml->respCode; 
	
	
	//Compute response hash
	$res_stringToHash = $res_version . $res_respCode;
	
	$res_responseHash = strtoupper(hash_hmac('sha256',$res_stringToHash,$secretKey, false));	//Compute hash value
	echo "<br/>hash: ".$res_responseHash."<br/>"; 
	if(strtolower($resXml->hashValue) == strtolower($res_responseHash)){ echo "valid response"; } 
	else{ echo "invalid response"; }
	
?>

Next : API Parameters