3D Secure Web Payment
do3DSWebPayment
Demo that shows the usage of Payline classes for 3D Secure web payments.
display example only html code | php code | css code
<?php // INITIALIZE require_once("./include.php"); $array = array(); $payline = new paylineSDK(); // PAYMENT $array['payment']['amount'] = $_POST['amount']; $array['payment']['currency'] = $_POST['currency']; // ORDER $array['order']['ref'] = $_POST['ref']; $array['order']['amount'] = $_POST['amount']; $array['order']['currency'] = $_POST['currency']; // CONTRACT NUMBERS if (isset($_POST['paymentContractNumber'])){ $contracts = split(";",$_POST['paymentContractNumber']); $array['contracts'] = $contracts; } // EXECUTE $result = $payline->do_webpayment($array); // RESPONSE if(isset($_POST['debug'])){ echo '<H3>REQUEST</H3>'; print_a($array, 0, true); echo '<H3>RESPONSE</H3>'; print_a($result, 0, true); } else{ if(isset($result) && $result['result']['code'] == '00000'){ header("location:".$result['redirectURL']); exit(); } elseif(isset($result)) { echo 'ERROR : '.$result['result']['code']. ' '.$result['result']['longMessage'].' <BR/>'; } } ?>
<form action="../do3DSWebPayment.php" method="post" class="payline-form"> <fieldset> <h4>Do Web Payment minimal informations</h4> <div class="row"> <label for="ref">Order reference</label> <input type="text" name="ref" id="ref" value="qwerty" /> <span class="help">(required)</span> </div> <div class="row"> <label for="amount">Amount</label> <input type="text" name="amount" id="amount" value="200" /> <span class="help">value in cents (required)</span> </div> <div class="row"> <label for="currency">Currency</label> <select name="currency" id="currency"> <option value="978">EURO (EUR)</option> </select> </div> </fieldset> <input type="hidden" name="paymentContractNumber" id="paymentContractNumber" value="9876543"> <input type="submit" name="submit" class="submit" value="Start payment process" /> </form>
/* @group Forms */ form.payline-form { font-size: 11px; padding: 10px 30px; border: 1px solid #ddd; background: #f9f9f9; margin-bottom: 10px; } .payline-form fieldset { margin-bottom: 1em; } .payline-form .row { clear : both; margin: 0.15em 0.5em; color: #3d4d5b; } .payline-form hr { clear : both; border: none; border-bottom: 1px dashed #eee; } .payline-form label { display: inline; float: left; text-align : right; margin-bottom: 0.5em; line-height: 1.5em; width: 150px; } .payline-form input, .payline-form select, .payline-form textarea { background: #ddd; border: 1px solid #575757; width : 250px; font-size: 1em; margin-left: 35px; padding: auto 0.5em; color: #575757; } .payline-form input.submit { background: #575757; color: white; font-weight: bold; border: 1px solid #ddd; margin-left: 190px; width: auto; padding: 0.15em 0.5em; cursor: pointer; } .payline-form .help { margin-left: 10px; font-style: italic; letter-spacing: 1px; } .payline-form #debug, #recurring { width: auto; } /* @end */