Installment Payment Plan
Allow your customer to pay with Installment Plan!
Download full demo: PHP code / .Net code
Get Installment Payment Plan option list
Installment Payment Plan options could be viewed from my2C2P dashboard under 'IPP Plans'.
screen shot: show
and the xml file can be downloaded from the bottom of the 'IPP Plan' page.
sample:
<IPP Version="1.0">
<IPPOption>
<BankName>United Overseas Bank</BankName>
<BankShortName>UOB</BankShortName>
<BINs>
<BIN>411111</BIN>
</BINs>
<InstallmentOptions>
<Option id="1" InstallmentPeriod="3" MerInterestRate="0.40" CusInterestRate="0.50" MinAmount="0.10" CurrencyCode="SGD" ValidFrom="2014-07-01" ValidUntil="2016-12-31" PromotionCode="promoC" />
<Option id="2" InstallmentPeriod="6" MerInterestRate="0.66" CusInterestRate="0.55" MinAmount="0.10" CurrencyCode="SGD" ValidFrom="2014-07-01" ValidUntil="2019-07-01" PromotionCode="promoC" />
</InstallmentOptions>
</IPPOption>
</IPP>
Prepare Installment Payment Plan Payment Request
Set account credentials.
<?php
//Merchant Account Information
$merchantID = "JT01"; //Get MerchantID when opening account with 2C2P
$secretKey = "7jYcp4FxFdf0"; //Get SecretKey from 2C2P PGW Dashboard
Set transaction information.
//Transaction Information
$uniqueTransactionCode = "Invoice".time();
$desc = "1 room for 2 nights";
$amt = "000000000010"; //12 digit format
$currencyCode = "702"; //Ref: http://en.wikipedia.org/wiki/ISO_4217
Set cardholder information.
//Customer Information
$cardholderName = "John Doe";
$country = "SG";
Set payment request information.
//Request Information
$apiVersion = "9.3";
$encryptedCardInfo = $_POST['encryptedCardInfo']; //Retrieve encrypted credit card data
Set IPP request information.
//Construct signature string
$ippTransaction = "Y"; //IPP transaction Y/N
$installmentPeriod = "3"; //Installment period in Month
$interestType = "M"; //Interest paid by C/M (C=Customer, M=Merchant)
Set secure hash information.
//Construct signature string
$stringToHash = $apiVersion . $timeStamp . $merchantID . $uniqueTransactionCode . $desc . $amt . $currencyCode . $paymentChannel . $storeCardUniqueID . $panBank .
$country . $cardholderName . $cardholderEmail . $payCategoryID . $userDefined1 . $userDefined2 . $userDefined3 . $userDefined4 . $userDefined5 . $storeCard .
$ippTransaction . $installmentPeriod . $interestType . $recurring . $invoicePrefix . $recurringAmount . $allowAccumulate . $maxAccumulateAmt . $recurringInterval .
$recurringCount . $chargeNextDate . $promotion . $request3DS . $statementDescriptor . $agentCode . $channelCode . $paymentExpiry . $mobileNo . $tokenizeWithoutAuthorization . $encryptedCardInfo;
$hash = strtoupper(hash_hmac('sha1', $stringToHash ,$secretKey, false)); //Calculate Hash Value
Construct payment request message.
//Construct payment request message
$xml = "<PaymentRequest>
<version>$apiVersion</version>
<timeStamp>$timeStamp</timeStamp>
<merchantID>$merchantID</merchantID>
<uniqueTransactionCode>$uniqueTransactionCode</uniqueTransactionCode>
<desc>$desc</desc>
<amt>$amt</amt>
<currencyCode>$currencyCode</currencyCode>
<panCountry>$country</panCountry>
<cardholderName>$cardholderName</cardholderName>
<secureHash>$hash</secureHash>
<encCardData>$encryptedCardInfo</encCardData>
<ippTransaction>$ippTransaction</ippTransaction>
<installmentPeriod>$installmentPeriod</installmentPeriod>
<interestType>$interestType</interestType>
</PaymentRequest>";
$payload = base64_encode($xml); //Convert payload to base64
?>
Submit payment request form.
<!-- POST method to submit the form -->
<form action='https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/PaymentAuth.aspx' method='POST' name='paymentRequestForm'>
Processing payment request, Do not close the browser, press back or refresh the page.
<?php echo "<input type='hidden' name='paymentRequest' value='".$payload."'>"; ?>
</form>
<script language="JavaScript">
document.paymentRequestForm.submit();
</script>
Complete Code
Copy & Paste below code to 'payment_3d.php' file, and put this file in your Web Server.
/payment_3d.php
<?php
//Merchant Account Information
$merchantID = "JT01"; //Get MerchantID when opening account with 2C2P
$secretKey = "7jYcp4FxFdf0"; //Get SecretKey from 2C2P PGW Dashboard
//Transaction Information
$uniqueTransactionCode = "Invoice".time();
$desc = "1 room for 2 nights";
$amt = "000000000010"; //12 digit format
$currencyCode = "702"; //Ref: http://en.wikipedia.org/wiki/ISO_4217
//Cardholder Information
$cardholderName = "John Doe";
$country = "SG";
//Request Information
$apiVersion = "9.3";
$encryptedCardInfo = $_POST['encryptedCardInfo']; //Retrieve encrypted credit card data
//IPP Information
$ippTransaction = "Y"; //IPP transaction Y/N
$installmentPeriod = "3"; //Installment period in Month
$interestType = "M"; //Interest paid by C/M (C=Customer, M=Merchant)
//Construct signature string
$stringToHash = $apiVersion . $timeStamp . $merchantID . $uniqueTransactionCode . $desc . $amt . $currencyCode . $paymentChannel . $storeCardUniqueID . $panBank .
$country . $cardholderName . $cardholderEmail . $payCategoryID . $userDefined1 . $userDefined2 . $userDefined3 . $userDefined4 . $userDefined5 . $storeCard .
$ippTransaction . $installmentPeriod . $interestType . $recurring . $invoicePrefix . $recurringAmount . $allowAccumulate . $maxAccumulateAmt . $recurringInterval .
$recurringCount . $chargeNextDate . $promotion . $request3DS . $statementDescriptor . $agentCode . $channelCode . $paymentExpiry . $mobileNo . $tokenizeWithoutAuthorization . $encryptedCardInfo;
$hash = strtoupper(hash_hmac('sha1', $stringToHash ,$secretKey, false)); //Calculate Hash Value
//Construct payment request message
$xml = "<PaymentRequest>
<version>$apiVersion</version>
<timeStamp>$timeStamp</timeStamp>
<merchantID>$merchantID</merchantID>
<uniqueTransactionCode>$uniqueTransactionCode</uniqueTransactionCode>
<desc>$desc</desc>
<amt>$amt</amt>
<currencyCode>$currencyCode</currencyCode>
<panCountry>$country</panCountry>
<cardholderName>$cardholderName</cardholderName>
<secureHash>$hash</secureHash>
<encCardData>$encryptedCardInfo</encCardData>
<ippTransaction>$ippTransaction</ippTransaction>
<installmentPeriod>$installmentPeriod</installmentPeriod>
<interestType>$interestType</interestType>
</PaymentRequest>";
$payload = base64_encode($xml); //Convert payload to base64
?>
<!-- POST method to submit the form -->
<form action='https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/PaymentAuth.aspx' method='POST' name='paymentRequestForm'>
Processing payment request, Do not close the browser, press back or refresh the page.
<?php echo "<input type='hidden' name='paymentRequest' value='".$payload."'>"; ?>
</form>
<script language="JavaScript">
document.paymentRequestForm.submit();
</script>
Full Request elements and data type check here.