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";
To test SDD mandates signatures and payments, you will need to use the SLMPFRP1 BIC code as well as a matching and syntactically valid IBAN starting with FR7616348000019. This IBAN must have a length of 27 characters.
Note that:
In order to generate such an IBAN for your tests, you can use the following PHP example:
<?php
function generateRandomIBAN() {
$ibanNumber = str_pad(48 + (97 * rand(1, 1000000)), 12, '0', STR_PAD_LEFT);
return 'FR7616348000019' . $ibanNumber;
}
Once redirected to the mandate signature page, you will be prompted to enter a code received by SMS. Enter 0000 and tick the box that confirms that the provided information is accurate.
Once signed, you will be taken back to our confirmation page. If a payment was requested together with the mandate creation, the payment will be in WAITING status and will turn to SUCCESS automatically within the next hour. When this happens, a relevant event will be sent to your callback URL.
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
Sofort can be tested by using specific sort codes to represent the account’s country
- Sort Code:
- 88888888 - Germany
- 999 - Belgium
- 00000 - Other Countries