In sandbox environment, you can force the response given to payment attempts.
Our sandbox has its own antifraud checks, which means that if you want to try several payments, or do some load/concurrency testing, we recommend you to:
<?php
public function getRandomIp($publicOnly = true)
{
// See http://en.wikipedia.org/wiki/Reserved_IP_addresses
$reserved = array(0, 100, 127, 169, 198, 203, 224, 225, 226, 227, 228, 229, 230, 231,
232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255);
$skip = array_merge($reserved, $publicOnly?array(10, 172, 192):array());
$ip = array();
do {
$ip[0] = rand(1, 255);
} while (in_array($ip[0], $skip));
$ip[1] = rand(0, 255);
$ip[2] = rand(0, 255);
$ip[3] = rand(0, 255);
return implode('.', $ip);
}
Card Number: Any 16 digits card number starting with ‘4’ (VISA) or ‘5’ (Mastercard) that passes the LUHN test
Security Code: The validation follows the scheme of the card used, so any 3 digits for VISA/MC, or 4 digits for Amex
<?php
function isLuhnNum($num, $length=null) {
if (empty($length)) {
$length = strlen($num);
}
$tot = 0;
for($i = $length - 1; $i >= 0; $i--) {
$digit = substr($num, $i, 1);
if ((($length - $i) % 2) == 0) {
$digit = $digit*2;
if ($digit > 9) {
$digit = $digit-9;
}
}
$tot += $digit;
}
return (($tot % 10) === 0);
}
function getCardNumber () {
$cardNumber = str_pad('4'.rand('10', '99').date('U'), 15, '0', STR_PAD_RIGHT);
for ($i=0; $i<10; $i++) {
if (isLuhnNum($cardNumber.$i)) {
return $cardNumber.$i;
}
}
return null;
}
print getCardNumber() . "\n";
iDeal can be tested by providing different payment amounts giving a different result per amount value. Also note that iDEAL is not a recurring payment method, meaning that you will not be able to take further payments without having the customer inserting his bank details.
- Payment amount:
- SUCCESS payment with amount - 1.00
- CANCELLED payment with amount - 2.00
- FAILED payment with amount - 3.00 (expired failure category)
- OPEN payment with amount - 4.00
- FAILED payment with amount - 5.00